diff options
author | Xiubo Li <xiubli@redhat.com> | 2023-11-07 10:44:41 +0800 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2024-01-15 15:40:50 +0100 |
commit | aaefabc4a5f7ae48682c4d2d5d10faaf95c08eb9 (patch) | |
tree | 68fb900421a3f1eb962988abc7a13b621cacac69 /fs/ceph/addr.c | |
parent | b79e4a0aa902322756ced7361a2c637d462c3c1c (diff) |
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 'fs/ceph/addr.c')
-rw-r--r-- | fs/ceph/addr.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 85be3bf18cdf..a5caafc1859e 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -357,6 +357,7 @@ static void ceph_netfs_issue_read(struct netfs_io_subrequest *subreq) u64 len = subreq->len; bool sparse = IS_ENCRYPTED(inode) || ceph_test_mount_opt(fsc, SPARSEREAD); u64 off = subreq->start; + int extent_cnt; if (ceph_inode_is_shutdown(inode)) { err = -EIO; @@ -379,7 +380,8 @@ static void ceph_netfs_issue_read(struct netfs_io_subrequest *subreq) } if (sparse) { - err = ceph_alloc_sparse_ext_map(&req->r_ops[0]); + extent_cnt = __ceph_sparse_read_ext_count(inode, len); + err = ceph_alloc_sparse_ext_map(&req->r_ops[0], extent_cnt); if (err) goto out; } |