]> git.proxmox.com Git - pve-kernel.git/blame - patches/kernel/0005-ocfs2-make-metadata-estimation-accurate-and-clear.patch
rebase patches on top of Ubuntu-4.15.0-24.26
[pve-kernel.git] / patches / kernel / 0005-ocfs2-make-metadata-estimation-accurate-and-clear.patch
CommitLineData
3323a8b7
FG
1From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Changwei Ge <ge.changwei@h3c.com>
3Date: Wed, 31 Jan 2018 16:15:02 -0800
4Subject: [PATCH] ocfs2: make metadata estimation accurate and clear
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Current code assume that ::w_unwritten_list always has only one item on.
10This is not right and hard to get understood. So improve how to count
11unwritten item.
12
13Link: http://lkml.kernel.org/r/1515479070-32653-1-git-send-email-ge.changwei@h3c.com
14Signed-off-by: Changwei Ge <ge.changwei@h3c.com>
15Reported-by: John Lightsey <john@nixnuts.net>
16Tested-by: John Lightsey <john@nixnuts.net>
17Cc: Mark Fasheh <mfasheh@versity.com>
18Cc: Joseph Qi <jiangqi903@gmail.com>
19Cc: Junxiao Bi <junxiao.bi@oracle.com>
20Cc: Joel Becker <jlbec@evilplan.org>
21Cc: Changwei Ge <ge.changwei@h3c.com>
22Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
23Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
24(cherry picked from commit 63de8bd9328bf2a778fc277503da163ae3defa3c)
25Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
26---
27 fs/ocfs2/aops.c | 4 +++-
28 1 file changed, 3 insertions(+), 1 deletion(-)
29
30diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
15baf5b4 31index d1516327b787..256986aca8df 100644
3323a8b7
FG
32--- a/fs/ocfs2/aops.c
33+++ b/fs/ocfs2/aops.c
15baf5b4 34@@ -797,6 +797,7 @@ struct ocfs2_write_ctxt {
3323a8b7
FG
35 struct ocfs2_cached_dealloc_ctxt w_dealloc;
36
37 struct list_head w_unwritten_list;
38+ unsigned int w_unwritten_count;
39 };
40
41 void ocfs2_unlock_and_free_pages(struct page **pages, int num_pages)
15baf5b4 42@@ -1386,6 +1387,7 @@ static int ocfs2_unwritten_check(struct inode *inode,
3323a8b7
FG
43 desc->c_clear_unwritten = 0;
44 list_add_tail(&new->ue_ip_node, &oi->ip_unwritten_list);
45 list_add_tail(&new->ue_node, &wc->w_unwritten_list);
46+ wc->w_unwritten_count++;
47 new = NULL;
48 unlock:
49 spin_unlock(&oi->ip_lock);
15baf5b4 50@@ -2256,7 +2258,7 @@ static int ocfs2_dio_wr_get_block(struct inode *inode, sector_t iblock,
3323a8b7
FG
51 ue->ue_phys = desc->c_phys;
52
53 list_splice_tail_init(&wc->w_unwritten_list, &dwc->dw_zero_list);
54- dwc->dw_zero_count++;
55+ dwc->dw_zero_count += wc->w_unwritten_count;
56 }
57
58 ret = ocfs2_write_end_nolock(inode->i_mapping, pos, len, len, wc);