]> git.proxmox.com Git - pve-kernel.git/blob - patches/kernel/0021-ocfs2-make-metadata-estimation-accurate-and-clear.patch
rebase patches on top of Ubuntu-4.13.0-45.50
[pve-kernel.git] / patches / kernel / 0021-ocfs2-make-metadata-estimation-accurate-and-clear.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Changwei Ge <ge.changwei@h3c.com>
3 Date: Wed, 31 Jan 2018 16:15:02 -0800
4 Subject: [PATCH] ocfs2: make metadata estimation accurate and clear
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Current code assume that ::w_unwritten_list always has only one item on.
10 This is not right and hard to get understood. So improve how to count
11 unwritten item.
12
13 Link: http://lkml.kernel.org/r/1515479070-32653-1-git-send-email-ge.changwei@h3c.com
14 Signed-off-by: Changwei Ge <ge.changwei@h3c.com>
15 Reported-by: John Lightsey <john@nixnuts.net>
16 Tested-by: John Lightsey <john@nixnuts.net>
17 Cc: Mark Fasheh <mfasheh@versity.com>
18 Cc: Joseph Qi <jiangqi903@gmail.com>
19 Cc: Junxiao Bi <junxiao.bi@oracle.com>
20 Cc: Joel Becker <jlbec@evilplan.org>
21 Cc: Changwei Ge <ge.changwei@h3c.com>
22 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
23 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
24 (cherry picked from commit 63de8bd9328bf2a778fc277503da163ae3defa3c)
25 Signed-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
30 diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
31 index 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);