[Devel] [PATCH RHEL7 COMMIT] ploop: kaio: Clear swapfile flag

Vasily Averin vvs at virtuozzo.com
Thu Oct 8 21:35:19 MSK 2020


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.35
------>
commit 709e776b4e0d20b5d4f33b56a9a91d46b4d400ea
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Thu Oct 8 21:35:19 2020 +0300

    ploop: kaio: Clear swapfile flag
    
    This allows to call defrag on image file.
    
    https://jira.sw.ru/browse/PSBM-107743
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/block/ploop/io_kaio.c     | 2 --
 drivers/block/ploop/io_kaio_map.c | 2 --
 2 files changed, 4 deletions(-)

diff --git a/drivers/block/ploop/io_kaio.c b/drivers/block/ploop/io_kaio.c
index 2c2fb90..4c4a0c6 100644
--- a/drivers/block/ploop/io_kaio.c
+++ b/drivers/block/ploop/io_kaio.c
@@ -1119,9 +1119,7 @@ static int __kaio_truncate(struct ploop_io * io, struct file * file, u64 pos)
 	newattrs.ia_valid = ATTR_SIZE;
 
 	mutex_lock(&io->files.inode->i_mutex);
-	io->files.inode->i_flags &= ~S_SWAPFILE;
 	err = notify_change(F_DENTRY(file), &newattrs, NULL);
-	io->files.inode->i_flags |= S_SWAPFILE;
 	mutex_unlock(&io->files.inode->i_mutex);
 
 	if (err) {
diff --git a/drivers/block/ploop/io_kaio_map.c b/drivers/block/ploop/io_kaio_map.c
index 09add48..d4ff39d9 100644
--- a/drivers/block/ploop/io_kaio_map.c
+++ b/drivers/block/ploop/io_kaio_map.c
@@ -58,7 +58,6 @@ int ploop_kaio_open(struct file * file, int rdonly)
 	pm->readers = rdonly ? 1 : -1;
 	list_add(&pm->list, &ploop_mappings);
 	pm = NULL;
-	mapping->host->i_flags |= S_SWAPFILE;
 
 kaio_open_done:
 	spin_unlock(&ploop_mappings_lock);
@@ -82,7 +81,6 @@ int ploop_kaio_close(struct address_space * mapping, int rdonly)
 			}
 
 			if (m->readers == 0) {
-				mapping->host->i_flags &= ~S_SWAPFILE;
 				list_del(&m->list);
 				pm = m;
 			}


More information about the Devel mailing list