diff options
author | Changwei Ge <ge.changwei@h3c.com> | 2018-01-31 19:15:02 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-01-31 20:18:35 -0500 |
commit | 63de8bd9328bf2a778fc277503da163ae3defa3c (patch) | |
tree | 2f758fb093924c9353687380b7c6eb21357d500f /fs/ocfs2 | |
parent | 16c8d569f5704a84164f30ff01b29879f3438065 (diff) |
ocfs2: make metadata estimation accurate and clear
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/1515479070-32653-1-git-send-email-ge.changwei@h3c.com
Signed-off-by: Changwei Ge <ge.changwei@h3c.com>
Reported-by: John Lightsey <john@nixnuts.net>
Tested-by: John Lightsey <john@nixnuts.net>
Cc: Mark Fasheh <mfasheh@versity.com>
Cc: Joseph Qi <jiangqi903@gmail.com>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Changwei Ge <ge.changwei@h3c.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/aops.c | 4 |
1 files changed, 3 insertions, 1 deletions
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 { | |||
797 | struct ocfs2_cached_dealloc_ctxt w_dealloc; | 797 | struct ocfs2_cached_dealloc_ctxt w_dealloc; |
798 | 798 | ||
799 | struct list_head w_unwritten_list; | 799 | struct list_head w_unwritten_list; |
800 | unsigned int w_unwritten_count; | ||
800 | }; | 801 | }; |
801 | 802 | ||
802 | void ocfs2_unlock_and_free_pages(struct page **pages, int num_pages) | 803 | void ocfs2_unlock_and_free_pages(struct page **pages, int num_pages) |
@@ -1386,6 +1387,7 @@ retry: | |||
1386 | desc->c_clear_unwritten = 0; | 1387 | desc->c_clear_unwritten = 0; |
1387 | list_add_tail(&new->ue_ip_node, &oi->ip_unwritten_list); | 1388 | list_add_tail(&new->ue_ip_node, &oi->ip_unwritten_list); |
1388 | list_add_tail(&new->ue_node, &wc->w_unwritten_list); | 1389 | list_add_tail(&new->ue_node, &wc->w_unwritten_list); |
1390 | wc->w_unwritten_count++; | ||
1389 | new = NULL; | 1391 | new = NULL; |
1390 | unlock: | 1392 | unlock: |
1391 | spin_unlock(&oi->ip_lock); | 1393 | spin_unlock(&oi->ip_lock); |
@@ -2256,7 +2258,7 @@ static int ocfs2_dio_wr_get_block(struct inode *inode, sector_t iblock, | |||
2256 | ue->ue_phys = desc->c_phys; | 2258 | ue->ue_phys = desc->c_phys; |
2257 | 2259 | ||
2258 | list_splice_tail_init(&wc->w_unwritten_list, &dwc->dw_zero_list); | 2260 | list_splice_tail_init(&wc->w_unwritten_list, &dwc->dw_zero_list); |
2259 | dwc->dw_zero_count++; | 2261 | dwc->dw_zero_count += wc->w_unwritten_count; |
2260 | } | 2262 | } |
2261 | 2263 | ||
2262 | ret = ocfs2_write_end_nolock(inode->i_mapping, pos, len, len, wc); | 2264 | ret = ocfs2_write_end_nolock(inode->i_mapping, pos, len, len, wc); |