/** * ceph_cls_lock - grab rados lock for object * @osdc: OSD client instance * @oid: object to lock * @oloc: object to lock * @lock_name: the name of the lock * @type: lock type (CEPH_CLS_LOCK_EXCLUSIVE or CEPH_CLS_LOCK_SHARED) * @cookie: user-defined identifier for this instance of the lock * @tag: user-defined tag * @desc: user-defined lock description * @flags: lock flags * * All operations on the same lock should use the same tag.
*/ int ceph_cls_lock(struct ceph_osd_client *osdc, struct ceph_object_id *oid, struct ceph_object_locator *oloc, char *lock_name, u8 type, char *cookie, char *tag, char *desc, u8 flags)
{ int lock_op_buf_size; int name_len = strlen(lock_name); int cookie_len = strlen(cookie); int tag_len = strlen(tag); int desc_len = strlen(desc); void *p, *end; struct page *lock_op_page; struct timespec64 mtime; int ret;
lock_op_buf_size = name_len + sizeof(__le32) +
cookie_len + sizeof(__le32) +
tag_len + sizeof(__le32) +
desc_len + sizeof(__le32) + sizeof(struct ceph_timespec) + /* flag and type */ sizeof(u8) + sizeof(u8) +
CEPH_ENCODING_START_BLK_LEN; if (lock_op_buf_size > PAGE_SIZE) return -E2BIG;
lock_op_page = alloc_page(GFP_NOIO); if (!lock_op_page) return -ENOMEM;
p = page_address(lock_op_page);
end = p + lock_op_buf_size;
dout("%s: status %d\n", __func__, ret);
__free_page(lock_op_page); return ret;
}
EXPORT_SYMBOL(ceph_cls_lock);
/** * ceph_cls_unlock - release rados lock for object * @osdc: OSD client instance * @oid: object to lock * @oloc: object to lock * @lock_name: the name of the lock * @cookie: user-defined identifier for this instance of the lock
*/ int ceph_cls_unlock(struct ceph_osd_client *osdc, struct ceph_object_id *oid, struct ceph_object_locator *oloc, char *lock_name, char *cookie)
{ int unlock_op_buf_size; int name_len = strlen(lock_name); int cookie_len = strlen(cookie); void *p, *end; struct page *unlock_op_page; int ret;
dout("%s: status %d\n", __func__, ret);
__free_page(unlock_op_page); return ret;
}
EXPORT_SYMBOL(ceph_cls_unlock);
/** * ceph_cls_break_lock - release rados lock for object for specified client * @osdc: OSD client instance * @oid: object to lock * @oloc: object to lock * @lock_name: the name of the lock * @cookie: user-defined identifier for this instance of the lock * @locker: current lock owner
*/ int ceph_cls_break_lock(struct ceph_osd_client *osdc, struct ceph_object_id *oid, struct ceph_object_locator *oloc, char *lock_name, char *cookie, struct ceph_entity_name *locker)
{ int break_op_buf_size; int name_len = strlen(lock_name); int cookie_len = strlen(cookie); struct page *break_op_page; void *p, *end; int ret;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.