[RHEL7,COMMIT] ploop: Move v1 PLOOP_S_NO_FALLOC_DISCARD to ploop1_open()

Submitted by Vasily Averin on Aug. 28, 2020, 4:38 a.m.

Details

Message ID 202008280438.07S4c51r009707@vz7build.vvs.sw.ru
State New
Series "Series without cover letter"
Headers show

Commit Message

Vasily Averin Aug. 28, 2020, 4:38 a.m.
The commit is pushed to "branch-rh7-3.10.0-1127.18.2.vz7.163.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1127.18.2.vz7.163.13
------>
commit 15b40e1f148033ddc21f6207970d334930ba1196
Author: Kirill Tkhai <ktkhai@virtuozzo.com>
Date:   Fri Aug 28 07:38:05 2020 +0300

    ploop: Move v1 PLOOP_S_NO_FALLOC_DISCARD to ploop1_open()
    
    Every delta comes thru open stage, so we may move
    the assignment there.
    
    https://jira.sw.ru/browse/PSBM-105347
    Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 drivers/block/ploop/fmt_ploop1.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/block/ploop/fmt_ploop1.c b/drivers/block/ploop/fmt_ploop1.c
index 29c3166..ab8e182 100644
--- a/drivers/block/ploop/fmt_ploop1.c
+++ b/drivers/block/ploop/fmt_ploop1.c
@@ -175,12 +175,6 @@  static int populate_holes_bitmap(struct ploop_delta *delta,
 	if (test_bit(PLOOP_S_NO_FALLOC_DISCARD, &delta->plo->state))
 		return 0;
 
-	/* To do: add discard alignment for v1 */
-	if (delta->plo->fmt_version != PLOOP_FMT_V2) {
-		set_bit(PLOOP_S_NO_FALLOC_DISCARD, &delta->plo->state);
-		return 0;
-	}
-
 	ret = -ENOMEM;
 	/* Use multiplier 10 for bigger batch and better performance */
 	nr_all_pages = 10 * cluster_size_in_bytes(delta->plo) / PAGE_SIZE;
@@ -338,6 +332,10 @@  ploop1_open(struct ploop_delta * delta)
 	    delta->io.files.inode->i_sb->s_magic == FUSE_SUPER_MAGIC)
 		set_bit(PLOOP_S_NO_FALLOC_DISCARD, &delta->plo->state);
 
+	/* TODO: add discard alignment for v1 */
+	if (delta->plo->fmt_version != PLOOP_FMT_V2)
+		set_bit(PLOOP_S_NO_FALLOC_DISCARD, &delta->plo->state);
+
 	return 0;
 
 out_err: