linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Ext4 Developers List <linux-ext4@vger.kernel.org>
Cc: Theodore Ts'o <tytso@mit.edu>
Subject: [PATCH,RFC 6/7] ext4: move setup of the mpd structure to write_cache_pages_da()
Date: Sat, 12 Feb 2011 19:15:56 -0500	[thread overview]
Message-ID: <1297556157-21559-7-git-send-email-tytso@mit.edu> (raw)
In-Reply-To: <1297556157-21559-1-git-send-email-tytso@mit.edu>

Move the initialization of all of the fields of the mpd structure to
write_cache_pages_da().  This simplifies the code considerably.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
 fs/ext4/inode.c |   29 +++++++----------------------
 1 files changed, 7 insertions(+), 22 deletions(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 2ac64e3..235a90e 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2714,7 +2714,8 @@ static int ext4_da_writepages_trans_blocks(struct inode *inode)
 /*
  * write_cache_pages_da - walk the list of dirty pages of the given
  * address space and accumulate pages that need writing, and call
- * mpage_da_map_and_submit to map the pages and then write them.
+ * mpage_da_map_and_submit to map a single contiguous memory region
+ * and then write them.
  */
 static int write_cache_pages_da(struct address_space *mapping,
 				struct writeback_control *wbc,
@@ -2722,7 +2723,7 @@ static int write_cache_pages_da(struct address_space *mapping,
 				pgoff_t *done_index)
 {
 	struct buffer_head	*bh, *head;
-	struct inode		*inode = mpd->inode;
+	struct inode		*inode = mapping->host;
 	struct pagevec		pvec;
 	unsigned int		nr_pages;
 	sector_t		logical;
@@ -2730,6 +2731,9 @@ static int write_cache_pages_da(struct address_space *mapping,
 	long			nr_to_write = wbc->nr_to_write;
 	int			i, tag, ret = 0;
 
+	memset(mpd, 0, sizeof(struct mpage_da_data));
+	mpd->wbc = wbc;
+	mpd->inode = inode;
 	pagevec_init(&pvec, 0);
 	index = wbc->range_start >> PAGE_CACHE_SHIFT;
 	end = wbc->range_end >> PAGE_CACHE_SHIFT;
@@ -2794,16 +2798,8 @@ static int write_cache_pages_da(struct address_space *mapping,
 
 			BUG_ON(PageWriteback(page));
 
-			if (mpd->next_page != page->index) {
-				/*
-				 * Start next extent of pages and blocks
-				 */
+			if (mpd->next_page != page->index)
 				mpd->first_page = page->index;
-				mpd->b_size = 0;
-				mpd->b_state = 0;
-				mpd->b_blocknr = 0;
-			}
-
 			mpd->next_page = page->index + 1;
 			logical = (sector_t) page->index <<
 				(PAGE_CACHE_SHIFT - inode->i_blkbits);
@@ -2975,9 +2971,6 @@ static int ext4_da_writepages(struct address_space *mapping,
 		wbc->nr_to_write = desired_nr_to_write;
 	}
 
-	mpd.wbc = wbc;
-	mpd.inode = mapping->host;

  parent reply	other threads:[~2011-02-13  0:57 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-13  0:15 [PATCH,RFC 0/7] Simplify buffered write submissions, part II Theodore Ts'o
2011-02-13  0:15 ` [PATCH,RFC 1/7] ext4: fold __mpage_da_writepage() into write_cache_pages_da() Theodore Ts'o
2011-02-13  1:25   ` Josef Bacik
2011-02-13  5:42     ` Ted Ts'o
2011-02-13 12:48       ` Josef Bacik
2011-02-13  0:15 ` [PATCH,RFC 2/7] ext4: simple cleanups to write_cache_pages_da() Theodore Ts'o
2011-02-13  1:31   ` Josef Bacik
2011-02-13  0:15 ` [PATCH,RFC 3/7] ext4: clear the dirty bit for a page in writeback at the last minute Theodore Ts'o
2011-02-13  1:34   ` Josef Bacik
2011-02-13  0:15 ` [PATCH,RFC 4/7] ext4: remove page_skipped hackery in ext4_da_writepages() Theodore Ts'o
2011-02-13  1:36   ` Josef Bacik
2011-02-13  0:15 ` [PATCH,RFC 5/7] ext4: don't lock the next page in write_cache_pages if not needed Theodore Ts'o
2011-02-13  1:38   ` Josef Bacik
2011-02-13  0:15 ` Theodore Ts'o [this message]
2011-02-13  1:40   ` [PATCH,RFC 6/7] ext4: move setup of the mpd structure to write_cache_pages_da() Josef Bacik
2011-02-13  0:15 ` [PATCH,RFC 7/7] ext4: move ext4_journal_start/stop to mpage_da_map_and_submit() Theodore Ts'o
2011-02-18  4:23   ` Ted Ts'o
2011-02-18 10:42     ` Amir Goldstein
2011-02-18 11:44       ` Yongqiang Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1297556157-21559-7-git-send-email-tytso@mit.edu \
    --to=tytso@mit.edu \
    --cc=linux-ext4@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).