]> git.proxmox.com Git - pve-kernel.git/blame - patches/kernel/0020-ocfs2-make-metadata-estimation-accurate-and-clear.patch
update sources to Ubuntu-4.13.0-45.50
[pve-kernel.git] / patches / kernel / 0020-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
31index 88a31e9340a0..77ec9b495027 100644
32--- a/fs/ocfs2/aops.c
33+++ b/fs/ocfs2/aops.c
34@@ -784,6 +784,7 @@ struct ocfs2_write_ctxt {
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)
42@@ -1373,6 +1374,7 @@ static int ocfs2_unwritten_check(struct inode *inode,
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);
50@@ -2246,7 +2248,7 @@ static int ocfs2_dio_get_block(struct inode *inode, sector_t iblock,
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);
59--
602.14.2
61