+ fs-mpagec-factor-clean_buffers-out-of-__mpage_writepage.patch added to -mm tree
Subject: + fs-mpagec-factor-clean_buffers-out-of-__mpage_writepage.patch added to -mm tree
To: [email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Thu, 24 Apr 2014 11:17:58 -0700
The patch titled
Subject: fs/mpage.c: factor clean_buffers() out of __mpage_writepage()
has been added to the -mm tree. Its filename is
fs-mpagec-factor-clean_buffers-out-of-__mpage_writepage.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/fs-mpagec-factor-clean_buffers-out-of-__mpage_writepage.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/fs-mpagec-factor-clean_buffers-out-of-__mpage_writepage.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Matthew Wilcox <[email protected]>
Subject: fs/mpage.c: factor clean_buffers() out of __mpage_writepage()
__mpage_writepage() is over 200 lines long, has 20 local variables, four goto labels and could desperately use simplification. Splitting clean_buffers() into a helper function improves matters a little, removing 20+ lines from it.
---
fs/mpage.c | 54 ++++++++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 24 deletions(-)
fs/mpage.c renamed from fs/mpage.c~fs-mpagec-factor-clean_buffers-out-of-__mpage_writepage +30 -24
@@ -439,6 +439,35 @@ struct mpage_data {unsigned use_writepage; }; +/* +* We have our BIO, so we can now mark the buffers clean. Make +* sure to only clean buffers which we know we'll be writing. +*/ +static void clean_buffers (struct page *page,unsigned first_unmapped) +{ +unsigned buffer_counter =0 ; +struct buffer_head *bh, *head; +if (!page_has_buffers (page)) +return ; + head =page_buffers (page); + bh = head; + +do { +if (buffer_counter++ == first_unmapped) +break ; +clear_buffer_dirty (bh); + bh = bh->b_this_page; + }while (bh != head); + +/* +* we cannot drop the bh if the page is not uptodate or a concurrent +* readpage would fail to serialize with the bh and it would read from +* disk before we reach the platter. +*/ +if (buffer_heads_over_limit &&PageUptodate (page)) +try_to_free_buffers (page); +} +static int __mpage_writepage (struct page *page,struct writeback_control *wbc,void *data) {
@@ -592,30 +621,7 @@ alloc_new: goto alloc_new; } -/* -* OK, we have our BIO, so we can now mark the buffers clean. Make -* sure to only clean buffers which we know we'll be writing. -*/ -if (page_has_buffers (page)) { -struct buffer_head *head =page_buffers (page); -struct buffer_head *bh = head; -unsigned buffer_counter =0 ; - -do { -if (buffer_counter++ == first_unmapped) -break ; -clear_buffer_dirty (bh); - bh = bh->b_this_page; - }while (bh != head); - -/* -* we cannot drop the bh if the page is not uptodate -* or a concurrent readpage would fail to serialize with the bh -* and it would read from disk before we reach the platter. -*/ -if (buffer_heads_over_limit &&PageUptodate (page)) -try_to_free_buffers (page); - } +clean_buffers (page, first_unmapped);BUG_ON (PageWriteback (page));set_page_writeback (page);
_
Patches currently in -mm which might be from [email protected] are
origin.patch mm-introduce-do_shared_fault-and-drop-do_fault-fix-fix.patch fs-bufferc-remove-block_write_full_page_endio.patch fs-mpagec-factor-clean_buffers-out-of-__mpage_writepage.patch fs-mpagec-factor-page_endio-out-of-mpage_end_io.patch fs-block_devc-add-bdev_read_page-and-bdev_write_page.patch swap-use-bdev_read_page-bdev_write_page.patch brd-add-support-for-rw_page.patch brd-return-enospc-rather-than-enomem-on-page-allocation-failure.patch do_shared_fault-check-that-mmap_sem-is-held.patch linux-next.patch