mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 16:13:19 +09:00
libceph: add sparse read support to OSD client
Have get_reply check for the presence of sparse read ops in the request and set the sparse_read boolean in the msg. That will queue the messenger layer to use the sparse read codepath instead of the normal data receive. Add a new sparse_read operation for the OSD client, driven by its own state machine. The messenger will repeatedly call the sparse_read operation, and it will pass back the necessary info to set up to read the next extent of data, while zero-filling the sparse regions. The state machine will stop at the end of the last extent, and will attach the extent map buffer to the ceph_osd_req_op so that the caller can use it. Signed-off-by: Jeff Layton <jlayton@kernel.org> Reviewed-by: Xiubo Li <xiubli@redhat.com> Reviewed-and-tested-by: Luís Henriques <lhenriques@suse.de> Reviewed-by: Milind Changire <mchangir@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:
committed by
Ilya Dryomov
parent
d396f89db3
commit
f628d79997
@@ -40,6 +40,36 @@ struct ceph_sparse_extent {
|
||||
u64 len;
|
||||
} __packed;
|
||||
|
||||
/* Sparse read state machine state values */
|
||||
enum ceph_sparse_read_state {
|
||||
CEPH_SPARSE_READ_HDR = 0,
|
||||
CEPH_SPARSE_READ_EXTENTS,
|
||||
CEPH_SPARSE_READ_DATA_LEN,
|
||||
CEPH_SPARSE_READ_DATA,
|
||||
};
|
||||
|
||||
/*
|
||||
* A SPARSE_READ reply is a 32-bit count of extents, followed by an array of
|
||||
* 64-bit offset/length pairs, and then all of the actual file data
|
||||
* concatenated after it (sans holes).
|
||||
*
|
||||
* Unfortunately, we don't know how long the extent array is until we've
|
||||
* started reading the data section of the reply. The caller should send down
|
||||
* a destination buffer for the array, but we'll alloc one if it's too small
|
||||
* or if the caller doesn't.
|
||||
*/
|
||||
struct ceph_sparse_read {
|
||||
enum ceph_sparse_read_state sr_state; /* state machine state */
|
||||
u64 sr_req_off; /* orig request offset */
|
||||
u64 sr_req_len; /* orig request length */
|
||||
u64 sr_pos; /* current pos in buffer */
|
||||
int sr_index; /* current extent index */
|
||||
__le32 sr_datalen; /* length of actual data */
|
||||
u32 sr_count; /* extent count in reply */
|
||||
int sr_ext_len; /* length of extent array */
|
||||
struct ceph_sparse_extent *sr_extent; /* extent array */
|
||||
};
|
||||
|
||||
/*
|
||||
* A given osd we're communicating with.
|
||||
*
|
||||
@@ -48,6 +78,7 @@ struct ceph_sparse_extent {
|
||||
*/
|
||||
struct ceph_osd {
|
||||
refcount_t o_ref;
|
||||
int o_sparse_op_idx;
|
||||
struct ceph_osd_client *o_osdc;
|
||||
int o_osd;
|
||||
int o_incarnation;
|
||||
@@ -63,6 +94,7 @@ struct ceph_osd {
|
||||
unsigned long lru_ttl;
|
||||
struct list_head o_keepalive_item;
|
||||
struct mutex lock;
|
||||
struct ceph_sparse_read o_sparse_read;
|
||||
};
|
||||
|
||||
#define CEPH_OSD_SLAB_OPS 2
|
||||
|
||||
Reference in New Issue
Block a user