| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
- From: Changwei Ge <[email protected]>
- Date: Wed, 31 Jan 2018 16:15:02 -0800
- Subject: [PATCH] ocfs2: make metadata estimation accurate and clear
- MIME-Version: 1.0
- Content-Type: text/plain; charset=UTF-8
- Content-Transfer-Encoding: 8bit
- Current code assume that ::w_unwritten_list always has only one item on.
- This is not right and hard to get understood. So improve how to count
- unwritten item.
- Link: http://lkml.kernel.org/r/[email protected]
- Signed-off-by: Changwei Ge <[email protected]>
- Reported-by: John Lightsey <[email protected]>
- Tested-by: John Lightsey <[email protected]>
- Cc: Mark Fasheh <[email protected]>
- Cc: Joseph Qi <[email protected]>
- Cc: Junxiao Bi <[email protected]>
- Cc: Joel Becker <[email protected]>
- Cc: Changwei Ge <[email protected]>
- Signed-off-by: Andrew Morton <[email protected]>
- Signed-off-by: Linus Torvalds <[email protected]>
- (cherry picked from commit 63de8bd9328bf2a778fc277503da163ae3defa3c)
- Signed-off-by: Fabian Grünbichler <[email protected]>
- ---
- fs/ocfs2/aops.c | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
- diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
- index d1516327b787..256986aca8df 100644
- --- a/fs/ocfs2/aops.c
- +++ b/fs/ocfs2/aops.c
- @@ -797,6 +797,7 @@ struct ocfs2_write_ctxt {
- struct ocfs2_cached_dealloc_ctxt w_dealloc;
-
- struct list_head w_unwritten_list;
- + unsigned int w_unwritten_count;
- };
-
- void ocfs2_unlock_and_free_pages(struct page **pages, int num_pages)
- @@ -1386,6 +1387,7 @@ static int ocfs2_unwritten_check(struct inode *inode,
- desc->c_clear_unwritten = 0;
- list_add_tail(&new->ue_ip_node, &oi->ip_unwritten_list);
- list_add_tail(&new->ue_node, &wc->w_unwritten_list);
- + wc->w_unwritten_count++;
- new = NULL;
- unlock:
- spin_unlock(&oi->ip_lock);
- @@ -2256,7 +2258,7 @@ static int ocfs2_dio_wr_get_block(struct inode *inode, sector_t iblock,
- ue->ue_phys = desc->c_phys;
-
- list_splice_tail_init(&wc->w_unwritten_list, &dwc->dw_zero_list);
- - dwc->dw_zero_count++;
- + dwc->dw_zero_count += wc->w_unwritten_count;
- }
-
- ret = ocfs2_write_end_nolock(inode->i_mapping, pos, len, len, wc);
- --
- 2.14.2
|