[Devel] [PATCH rh7] ve/fs/sync: sync detached inodes with dirty metadata

Andrey Ryabinin aryabinin at virtuozzo.com
Wed Feb 17 00:40:15 PST 2016


Inodes with dirty metadata could be detached from UB
(mapping->dirtied_ub == NULL). So sync() will skip such inodes.
With this patch sync() will skip inodes with dirty data only.

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

Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 fs/fs-writeback.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index b6b33d0..11c44d8 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -657,6 +657,12 @@ static long writeback_chunk_size(struct backing_dev_info *bdi,
 	return pages;
 }
 
+static inline bool sync_should_skip_inode(struct inode *inode)
+{
+	return inode->i_mapping->dirtied_ub ||
+		((inode->i_state & I_DIRTY) == I_DIRTY_PAGES);
+}
+
 /*
  * Write a portion of b_io inodes which belong to @sb.
  *
@@ -714,7 +720,9 @@ static long writeback_sb_inodes(struct super_block *sb,
 			continue;
 		}
 		if ((work->ub || work->filter_ub) &&
-		     ub_should_skip_writeback(work->ub, inode)) {
+		     ub_should_skip_writeback(work->ub, inode) &&
+		     (work->reason != WB_REASON_SYNC ||
+			     sync_should_skip_inode(inode))) {
 			spin_unlock(&inode->i_lock);
 			redirty_tail(inode, wb);
 			continue;
@@ -1411,7 +1419,8 @@ static void wait_sb_inodes(struct super_block *sb, struct user_beancounter *ub)
 			spin_unlock(&inode->i_lock);
 			continue;
 		}
-		if (ub && (mapping->dirtied_ub != ub)) {
+		if (ub && (mapping->dirtied_ub != ub) &&
+		    sync_should_skip_inode(inode)) {
 			spin_unlock(&inode->i_lock);
 			continue;
 		}
-- 
2.4.10



More information about the Devel mailing list