summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorXiubo Li <xiubli@redhat.com>2023-11-07 10:44:41 +0800
committerIlya Dryomov <idryomov@gmail.com>2024-01-15 15:40:50 +0100
commitaaefabc4a5f7ae48682c4d2d5d10faaf95c08eb9 (patch)
tree68fb900421a3f1eb962988abc7a13b621cacac69 /include
parentb79e4a0aa902322756ced7361a2c637d462c3c1c (diff)
downloadlinux-stable-aaefabc4a5f7ae48682c4d2d5d10faaf95c08eb9.tar.gz
linux-stable-aaefabc4a5f7ae48682c4d2d5d10faaf95c08eb9.tar.bz2
linux-stable-aaefabc4a5f7ae48682c4d2d5d10faaf95c08eb9.zip
ceph: try to allocate a smaller extent map for sparse read
In fscrypt case and for a smaller read length we can predict the max count of the extent map. And for small read length use cases this could save some memories. [ idryomov: squash into a single patch to avoid build break, drop redundant variable in ceph_alloc_sparse_ext_map() ] Signed-off-by: Xiubo Li <xiubli@redhat.com> Reviewed-by: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/ceph/osd_client.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index b8610e9d2471..fa018d5864e7 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -572,9 +572,12 @@ int __ceph_alloc_sparse_ext_map(struct ceph_osd_req_op *op, int cnt);
*/
#define CEPH_SPARSE_EXT_ARRAY_INITIAL 16
-static inline int ceph_alloc_sparse_ext_map(struct ceph_osd_req_op *op)
+static inline int ceph_alloc_sparse_ext_map(struct ceph_osd_req_op *op, int cnt)
{
- return __ceph_alloc_sparse_ext_map(op, CEPH_SPARSE_EXT_ARRAY_INITIAL);
+ if (!cnt)
+ cnt = CEPH_SPARSE_EXT_ARRAY_INITIAL;
+
+ return __ceph_alloc_sparse_ext_map(op, cnt);
}
extern void ceph_osdc_get_request(struct ceph_osd_request *req);