[RH7] ploop: kaio: Clear swapfile flag

Submitted by Kirill Tkhai on Oct. 8, 2020, 3:10 p.m.

Details

Message ID 160216982483.46435.15294258897986576456.stgit@localhost.localdomain
State New
Series "ploop: kaio: Clear swapfile flag"
Headers show

Commit Message

Kirill Tkhai Oct. 8, 2020, 3:10 p.m.
This allows to call defrag on image file.

https://jira.sw.ru/browse/PSBM-107743

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 drivers/block/ploop/io_kaio.c     |    2 --
 drivers/block/ploop/io_kaio_map.c |    2 --
 2 files changed, 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/block/ploop/io_kaio.c b/drivers/block/ploop/io_kaio.c
index 2c2fb90d2b53..4c4a0c6a908c 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 09add482db8b..d4ff39d95e74 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;
 			}