libceph: support the RADOS copy-from operation
Add support for performing remote object copies using the 'copy-from' operation. [ Add COPY_FROM to get_num_data_items(). ] Signed-off-by: Luis Henriques <lhenriques@suse.com> Reviewed-by: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:

committed by
Ilya Dryomov

parent
2ee9dd958d
commit
23ddf9bea9
@@ -136,6 +136,13 @@ struct ceph_osd_req_op {
|
||||
u64 expected_object_size;
|
||||
u64 expected_write_size;
|
||||
} alloc_hint;
|
||||
struct {
|
||||
u64 snapid;
|
||||
u64 src_version;
|
||||
u8 flags;
|
||||
u32 src_fadvise_flags;
|
||||
struct ceph_osd_data osd_data;
|
||||
} copy_from;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -510,6 +517,16 @@ extern int ceph_osdc_writepages(struct ceph_osd_client *osdc,
|
||||
struct timespec64 *mtime,
|
||||
struct page **pages, int nr_pages);
|
||||
|
||||
int ceph_osdc_copy_from(struct ceph_osd_client *osdc,
|
||||
u64 src_snapid, u64 src_version,
|
||||
struct ceph_object_id *src_oid,
|
||||
struct ceph_object_locator *src_oloc,
|
||||
u32 src_fadvise_flags,
|
||||
struct ceph_object_id *dst_oid,
|
||||
struct ceph_object_locator *dst_oloc,
|
||||
u32 dst_fadvise_flags,
|
||||
u8 copy_from_flags);
|
||||
|
||||
/* watch/notify */
|
||||
struct ceph_osd_linger_request *
|
||||
ceph_osdc_watch(struct ceph_osd_client *osdc,
|
||||
|
@@ -410,6 +410,14 @@ enum {
|
||||
enum {
|
||||
CEPH_OSD_OP_FLAG_EXCL = 1, /* EXCL object create */
|
||||
CEPH_OSD_OP_FLAG_FAILOK = 2, /* continue despite failure */
|
||||
CEPH_OSD_OP_FLAG_FADVISE_RANDOM = 0x4, /* the op is random */
|
||||
CEPH_OSD_OP_FLAG_FADVISE_SEQUENTIAL = 0x8, /* the op is sequential */
|
||||
CEPH_OSD_OP_FLAG_FADVISE_WILLNEED = 0x10,/* data will be accessed in
|
||||
the near future */
|
||||
CEPH_OSD_OP_FLAG_FADVISE_DONTNEED = 0x20,/* data will not be accessed
|
||||
in the near future */
|
||||
CEPH_OSD_OP_FLAG_FADVISE_NOCACHE = 0x40,/* data will be accessed only
|
||||
once by this client */
|
||||
};
|
||||
|
||||
#define EOLDSNAPC ERESTART /* ORDERSNAP flag set; writer has old snapc*/
|
||||
@@ -431,6 +439,15 @@ enum {
|
||||
CEPH_OSD_CMPXATTR_MODE_U64 = 2
|
||||
};
|
||||
|
||||
enum {
|
||||
CEPH_OSD_COPY_FROM_FLAG_FLUSH = 1, /* part of a flush operation */
|
||||
CEPH_OSD_COPY_FROM_FLAG_IGNORE_OVERLAY = 2, /* ignore pool overlay */
|
||||
CEPH_OSD_COPY_FROM_FLAG_IGNORE_CACHE = 4, /* ignore osd cache logic */
|
||||
CEPH_OSD_COPY_FROM_FLAG_MAP_SNAP_CLONE = 8, /* map snap direct to
|
||||
* cloneid */
|
||||
CEPH_OSD_COPY_FROM_FLAG_RWORDERED = 16, /* order with write */
|
||||
};
|
||||
|
||||
enum {
|
||||
CEPH_OSD_WATCH_OP_UNWATCH = 0,
|
||||
CEPH_OSD_WATCH_OP_LEGACY_WATCH = 1,
|
||||
@@ -497,6 +514,17 @@ struct ceph_osd_op {
|
||||
__le64 expected_object_size;
|
||||
__le64 expected_write_size;
|
||||
} __attribute__ ((packed)) alloc_hint;
|
||||
struct {
|
||||
__le64 snapid;
|
||||
__le64 src_version;
|
||||
__u8 flags; /* CEPH_OSD_COPY_FROM_FLAG_* */
|
||||
/*
|
||||
* CEPH_OSD_OP_FLAG_FADVISE_*: fadvise flags
|
||||
* for src object, flags for dest object are in
|
||||
* ceph_osd_op::flags.
|
||||
*/
|
||||
__le32 src_fadvise_flags;
|
||||
} __attribute__ ((packed)) copy_from;
|
||||
};
|
||||
__le32 payload_len;
|
||||
} __attribute__ ((packed));
|
||||
|
Reference in New Issue
Block a user