0007-ocfs2-make-metadata-estimation-accurate-and-clear.patch 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Changwei Ge <[email protected]>
  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. Current code assume that ::w_unwritten_list always has only one item on.
  9. This is not right and hard to get understood. So improve how to count
  10. unwritten item.
  11. Link: http://lkml.kernel.org/r/[email protected]
  12. Signed-off-by: Changwei Ge <[email protected]>
  13. Reported-by: John Lightsey <[email protected]>
  14. Tested-by: John Lightsey <[email protected]>
  15. Cc: Mark Fasheh <[email protected]>
  16. Cc: Joseph Qi <[email protected]>
  17. Cc: Junxiao Bi <[email protected]>
  18. Cc: Joel Becker <[email protected]>
  19. Cc: Changwei Ge <[email protected]>
  20. Signed-off-by: Andrew Morton <[email protected]>
  21. Signed-off-by: Linus Torvalds <[email protected]>
  22. (cherry picked from commit 63de8bd9328bf2a778fc277503da163ae3defa3c)
  23. Signed-off-by: Fabian Grünbichler <[email protected]>
  24. ---
  25. fs/ocfs2/aops.c | 4 +++-
  26. 1 file changed, 3 insertions(+), 1 deletion(-)
  27. diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
  28. index d1516327b787..256986aca8df 100644
  29. --- a/fs/ocfs2/aops.c
  30. +++ b/fs/ocfs2/aops.c
  31. @@ -797,6 +797,7 @@ struct ocfs2_write_ctxt {
  32. struct ocfs2_cached_dealloc_ctxt w_dealloc;
  33. struct list_head w_unwritten_list;
  34. + unsigned int w_unwritten_count;
  35. };
  36. void ocfs2_unlock_and_free_pages(struct page **pages, int num_pages)
  37. @@ -1386,6 +1387,7 @@ static int ocfs2_unwritten_check(struct inode *inode,
  38. desc->c_clear_unwritten = 0;
  39. list_add_tail(&new->ue_ip_node, &oi->ip_unwritten_list);
  40. list_add_tail(&new->ue_node, &wc->w_unwritten_list);
  41. + wc->w_unwritten_count++;
  42. new = NULL;
  43. unlock:
  44. spin_unlock(&oi->ip_lock);
  45. @@ -2256,7 +2258,7 @@ static int ocfs2_dio_wr_get_block(struct inode *inode, sector_t iblock,
  46. ue->ue_phys = desc->c_phys;
  47. list_splice_tail_init(&wc->w_unwritten_list, &dwc->dw_zero_list);
  48. - dwc->dw_zero_count++;
  49. + dwc->dw_zero_count += wc->w_unwritten_count;
  50. }
  51. ret = ocfs2_write_end_nolock(inode->i_mapping, pos, len, len, wc);
  52. --
  53. 2.14.2