summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorIlya Dryomov <idryomov@gmail.com>2024-12-07 17:33:25 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-01-02 10:32:00 +0100
commitd41fa58fca6f55608133c6e6077c87118f785d1b (patch)
tree208bfe0bf93eab4654d6ca0740ef08a9a6d421cc /fs
parent44e518abbb498075ae85c7d1d1a503a6bb05ea2d (diff)
downloadlinux-d41fa58fca6f55608133c6e6077c87118f785d1b.tar.gz
linux-d41fa58fca6f55608133c6e6077c87118f785d1b.tar.bz2
linux-d41fa58fca6f55608133c6e6077c87118f785d1b.zip
ceph: allocate sparse_ext map only for sparse reads
[ Upstream commit 18d44c5d062b97b97bb0162d9742440518958dc1 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs')
-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 5233bbab8a76..a03b11cf7887 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -1455,7 +1455,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) {