The commit is pushed to "branch-rh9-5.14.0-427.33.1.vz9.72.x-ovz" and will appear at g...@bitbucket.org:openvz/vzkernel.git after rh9-5.14.0-427.33.1.vz9.72.2 ------> commit 420f5a3dff0d0f1eb510d94372af2088e4710cef Author: Denis V. Lunev <d...@openvz.org> Date: Mon Sep 9 20:47:52 2024 +0300
ploop: remove unnecessary flushes from ploop/dm-ploop code This patch drops vfs_flush just once the image has been fallocated. This is not required as fallocate returns once all internal checks are done and the file has been properly enlarged. In general, this follows userspace pattern. We should flush when and only when the guest sends barrier. It is ready to loose this data if something will go wrong due to the guest filesystem facilities like journal. https://virtuozzo.atlassian.net/browse/PSBM-158543 Signed-off-by: Denis V. Lunev <d...@openvz.org> CC: Alexey Kuznetsov <kuz...@virtuozzo.com> CC: Alexander Atanasov <alexander.atana...@virtuozzo.com> Reviewed-by: Andrey Zhadchenko <andrey.zhadche...@virtuozzo.com> --- drivers/md/dm-ploop-map.c | 17 ----------------- drivers/md/dm-qcow2-map.c | 17 +---------------- 2 files changed, 1 insertion(+), 33 deletions(-) diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c index 33aac1a69fdf..0809867ebd3a 100644 --- a/drivers/md/dm-ploop-map.c +++ b/drivers/md/dm-ploop-map.c @@ -1020,12 +1020,6 @@ static int ploop_truncate_prealloc_safe(struct ploop *ploop, return ret; } - ret = vfs_fsync(file, 0); - if (ret) { - PL_ERR("%s->fsync(): %d", func, ret); - return ret; - } - delta->file_size = new_len; delta->file_preallocated_area_start = len; return 0; @@ -1071,17 +1065,6 @@ static int ploop_allocate_cluster(struct ploop *ploop, u32 *dst_clu) ret = ploop_truncate_prealloc_safe(ploop, top, end, __func__); if (ret) return ret; - } else if (pos < top->file_preallocated_area_start) { - /* - * Flush punch_hole()/zero_range() modifications. - * TODO: track recentry unused blocks and do that - * in background. - */ - ret = vfs_fsync(file, 0); - if (ret) { - PL_ERR("fsync: %d", ret); - return ret; - } } if (end > top->file_preallocated_area_start) diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c index b40115b0fc5e..6585f3fac6e7 100644 --- a/drivers/md/dm-qcow2-map.c +++ b/drivers/md/dm-qcow2-map.c @@ -2141,13 +2141,7 @@ static loff_t find_unused_cluster(struct qcow2 *qcow2, struct qio **qio, int qcow2_truncate_safe(struct file *file, loff_t new_len) { - int ret; - - ret = vfs_truncate2(&file->f_path, new_len, file); - if (ret) - return ret; - - return vfs_fsync(file, 0); + return vfs_truncate2(&file->f_path, new_len, file); } static int truncate_prealloc_safe(struct qcow2 *qcow2, loff_t len, const char *func) @@ -2416,15 +2410,6 @@ static loff_t allocate_cluster(struct qcow2 *qcow2, struct qio *qio, ret = truncate_prealloc_safe(qcow2, end, __func__); if (ret) return ret; - } else if (pos < qcow2->file_preallocated_area_start) { - /* - * Flush punch_hole() modifications. - * TODO: track recentry unused blocks - * and punch holes in background. - */ - ret = vfs_fsync(file, 0); - if (ret) - return ret; } if (end > qcow2->file_preallocated_area_start) _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel