diff options
author | Ilya Dryomov <idryomov@gmail.com> | 2024-12-07 17:33:25 +0100 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2024-12-16 23:25:44 +0100 |
commit | 18d44c5d062b97b97bb0162d9742440518958dc1 (patch) | |
tree | 7d1d96ea4c9d8179850d04d151d7c3ece38770a6 /net | |
parent | ceph: fix memory leak in ceph_direct_read_write() (diff) | |
download | linux-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 'net')
-rw-r--r-- | net/ceph/osd_client.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 9b1168eb77ab..b24afec24138 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -1173,6 +1173,8 @@ EXPORT_SYMBOL(ceph_osdc_new_request); int __ceph_alloc_sparse_ext_map(struct ceph_osd_req_op *op, int cnt) { + WARN_ON(op->op != CEPH_OSD_OP_SPARSE_READ); + op->extent.sparse_ext_cnt = cnt; op->extent.sparse_ext = kmalloc_array(cnt, sizeof(*op->extent.sparse_ext), |