@@ -346,8 +346,7 @@ static void ceph_netfs_issue_op(struct netfs_read_subrequest *subreq)
}
if (sparse) {
- err = ceph_alloc_sparse_ext_map(&req->r_ops[0],
- CEPH_SPARSE_EXT_ARRAY_INITIAL);
+ err = ceph_alloc_sparse_ext_map(&req->r_ops[0]);
if (err) {
ceph_osdc_put_request(req);
goto out;
@@ -1009,7 +1009,7 @@ ssize_t __ceph_sync_read(struct inode *inode, loff_t *ki_pos,
op = &req->r_ops[0];
if (sparse) {
- ret = ceph_alloc_sparse_ext_map(op, CEPH_SPARSE_EXT_ARRAY_INITIAL);
+ ret = ceph_alloc_sparse_ext_map(op);
if (ret) {
ceph_osdc_put_request(req);
break;
@@ -1462,7 +1462,7 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,
osd_req_op_extent_osd_data_bvecs(req, 0, bvecs, num_pages, len);
op = &req->r_ops[0];
if (sparse) {
- ret = ceph_alloc_sparse_ext_map(op, CEPH_SPARSE_EXT_ARRAY_INITIAL);
+ ret = ceph_alloc_sparse_ext_map(op);
if (ret) {
ceph_osdc_put_request(req);
break;
@@ -1708,7 +1708,7 @@ ceph_sync_write(struct kiocb *iocb, struct iov_iter *from, loff_t pos,
offset_in_page(first_pos),
false, false);
/* We only expect a single extent here */
- ret = ceph_alloc_sparse_ext_map(op, 1);
+ ret = __ceph_alloc_sparse_ext_map(op, 1);
if (ret) {
ceph_osdc_put_request(req);
ceph_release_page_vector(pages, num_pages);
@@ -1727,7 +1727,7 @@ ceph_sync_write(struct kiocb *iocb, struct iov_iter *from, loff_t pos,
ci->i_truncate_seq);
}
- ret = ceph_alloc_sparse_ext_map(op, 1);
+ ret = __ceph_alloc_sparse_ext_map(op, 1);
if (ret) {
ceph_osdc_put_request(req);
ceph_release_page_vector(pages, num_pages);
@@ -81,13 +81,6 @@
#define CEPH_CAPS_WANTED_DELAY_MIN_DEFAULT 5 /* cap release delay */
#define CEPH_CAPS_WANTED_DELAY_MAX_DEFAULT 60 /* cap release delay */
-/*
- * How big an extent array should we preallocate for a sparse read? This is
- * just a starting value. If we get more than this back from the OSD, the
- * receiver will reallocate.
- */
-#define CEPH_SPARSE_EXT_ARRAY_INITIAL 16
-
struct ceph_mount_options {
unsigned int flags;
@@ -556,7 +556,19 @@ extern struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *,
u32 truncate_seq, u64 truncate_size,
bool use_mempool);
-int ceph_alloc_sparse_ext_map(struct ceph_osd_req_op *op, int cnt);
+int __ceph_alloc_sparse_ext_map(struct ceph_osd_req_op *op, int cnt);
+
+/*
+ * How big an extent array should we preallocate for a sparse read? This is
+ * just a starting value. If we get more than this back from the OSD, the
+ * receiver will reallocate.
+ */
+#define CEPH_SPARSE_EXT_ARRAY_INITIAL 16
+
+static inline int ceph_alloc_sparse_ext_map(struct ceph_osd_req_op *op)
+{
+ return __ceph_alloc_sparse_ext_map(op, CEPH_SPARSE_EXT_ARRAY_INITIAL);
+}
extern void ceph_osdc_get_request(struct ceph_osd_request *req);
extern void ceph_osdc_put_request(struct ceph_osd_request *req);
@@ -1165,7 +1165,7 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
}
EXPORT_SYMBOL(ceph_osdc_new_request);
-int ceph_alloc_sparse_ext_map(struct ceph_osd_req_op *op, int cnt)
+int __ceph_alloc_sparse_ext_map(struct ceph_osd_req_op *op, int cnt)
{
op->extent.sparse_ext_cnt = cnt;
op->extent.sparse_ext = kmalloc_array(cnt,
@@ -1175,7 +1175,7 @@ int ceph_alloc_sparse_ext_map(struct ceph_osd_req_op *op, int cnt)
return -ENOMEM;
return 0;
}
-EXPORT_SYMBOL(ceph_alloc_sparse_ext_map);
+EXPORT_SYMBOL(__ceph_alloc_sparse_ext_map);
/*
* We keep osd requests in an rbtree, sorted by ->r_tid.
Make it a wrapper around a version that requires a length and just have it default to CEPH_SPARSE_EXT_ARRAY_INITIAL. Signed-off-by: Jeff Layton <jlayton@kernel.org> --- fs/ceph/addr.c | 3 +-- fs/ceph/file.c | 8 ++++---- fs/ceph/super.h | 7 ------- include/linux/ceph/osd_client.h | 14 +++++++++++++- net/ceph/osd_client.c | 4 ++-- 5 files changed, 20 insertions(+), 16 deletions(-) Another one for the sparse_read series. Again, I'll probably fold this into the appropriate patches and re-push into testing.