[Devel] [PATCH RH7 3/5] ploop: Move v1 PLOOP_S_NO_FALLOC_DISCARD to ploop1_open()

Kirill Tkhai ktkhai at virtuozzo.com
Thu Aug 27 18:41:58 MSK 2020


Every delta comes thru open stage, so we may move
the assignment there.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/block/ploop/fmt_ploop1.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/block/ploop/fmt_ploop1.c b/drivers/block/ploop/fmt_ploop1.c
index 29c3166b24eb..ab8e182d60ab 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:




More information about the Devel mailing list