summaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
authorIlya Dryomov <idryomov@gmail.com>2024-12-07 17:33:25 +0100
committerIlya Dryomov <idryomov@gmail.com>2024-12-16 23:25:44 +0100
commit18d44c5d062b97b97bb0162d9742440518958dc1 (patch)
tree7d1d96ea4c9d8179850d04d151d7c3ece38770a6 /fs/ceph
parentceph: fix memory leak in ceph_direct_read_write() (diff)
downloadlinux-18d44c5d062b97b97bb0162d9742440518958dc1.tar.xz
linux-18d44c5d062b97b97bb0162d9742440518958dc1.zip
ceph: allocate sparse_ext map only for sparse reads
If mounted with sparseread option, ceph_direct_read_write() ends up making an unnecessarily allocation for O_DIRECT writes. Fixes: 03bc06c7b0bd ("ceph: add new mount option to enable sparse reads") Signed-off-by: Ilya Dryomov <idryomov@gmail.com> Reviewed-by: Alex Markuze <amarkuze@redhat.com>
Diffstat (limited to 'fs/ceph')
-rw-r--r--fs/ceph/file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 67468d88f139..851d70200c6b 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -1552,7 +1552,7 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,
}
op = &req->r_ops[0];
- if (sparse) {
+ if (!write && sparse) {
extent_cnt = __ceph_sparse_read_ext_count(inode, size);
ret = ceph_alloc_sparse_ext_map(op, extent_cnt);
if (ret) {