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>
This commit is contained in:
Xiubo Li
2023-11-07 10:44:41 +08:00
committed by Ilya Dryomov
parent b79e4a0aa9
commit aaefabc4a5
4 changed files with 28 additions and 5 deletions
+5 -2
View File
@@ -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);