summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorXiubo Li <xiubli@redhat.com>2023-11-07 05:44:41 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-01-02 12:31:59 +0300
commitfb98248fc4a26e73d032e53160aee5d566d410cc (patch)
treec8c1f95980050f0051c8434feb85fa59521ee6e8 /include/linux
parent1d6de21f00293d819b5ca6dbe75ff1f3b6392140 (diff)
downloadlinux-fb98248fc4a26e73d032e53160aee5d566d410cc.tar.xz
ceph: try to allocate a smaller extent map for sparse read
[ Upstream commit aaefabc4a5f7ae48682c4d2d5d10faaf95c08eb9 ] 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> Stable-dep-of: 18d44c5d062b ("ceph: allocate sparse_ext map only for sparse reads") Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include/linux')
-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 f703fb8030de..50e409e84466 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -573,9 +573,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);