aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2013-04-29 18:07:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-29 18:54:33 -0400
commit7136851117744f1d291bed6d307432699d405109 (patch)
tree6dc7d6bef45e24ad0d3d5d1b9290a81109758172 /mm
parent106c992a5ebef28193cf5958e49ceff5e4aebb04 (diff)
mm: make snapshotting pages for stable writes a per-bio operation
Walking a bio's page mappings has proved problematic, so create a new bio flag to indicate that a bio's data needs to be snapshotted in order to guarantee stable pages during writeback. Next, for the one user (ext3/jbd) of snapshotting, hook all the places where writes can be initiated without PG_writeback set, and set BIO_SNAP_STABLE there. We must also flag journal "metadata" bios for stable writeout, since file data can be written through the journal. Finally, the MS_SNAP_STABLE mount flag (only used by ext3) is now superfluous, so get rid of it. [akpm@linux-foundation.org: rename _submit_bh()'s `flags' to `bio_flags', delobotomize the _submit_bh declaration] [akpm@linux-foundation.org: teeny cleanup] Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Artem Bityutskiy <dedekind1@gmail.com> Reviewed-by: Jan Kara <jack@suse.cz> Cc: Jens Axboe <axboe@kernel.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/bounce.c21
-rw-r--r--mm/page-writeback.c4
2 files changed, 1 insertions, 24 deletions
diff --git a/mm/bounce.c b/mm/bounce.c
index 5f8901768602..a5c2ec3589cb 100644
--- a/mm/bounce.c
+++ b/mm/bounce.c
@@ -181,32 +181,13 @@ static void bounce_end_io_read_isa(struct bio *bio, int err)
181#ifdef CONFIG_NEED_BOUNCE_POOL 181#ifdef CONFIG_NEED_BOUNCE_POOL
182static int must_snapshot_stable_pages(struct request_queue *q, struct bio *bio) 182static int must_snapshot_stable_pages(struct request_queue *q, struct bio *bio)
183{ 183{
184 struct page *page;
185 struct backing_dev_info *bdi;
186 struct address_space *mapping;
187 struct bio_vec *from;
188 int i;
189
190 if (bio_data_dir(bio) != WRITE) 184 if (bio_data_dir(bio) != WRITE)
191 return 0; 185 return 0;
192 186
193 if (!bdi_cap_stable_pages_required(&q->backing_dev_info)) 187 if (!bdi_cap_stable_pages_required(&q->backing_dev_info))
194 return 0; 188 return 0;
195 189
196 /* 190 return test_bit(BIO_SNAP_STABLE, &bio->bi_flags);
197 * Based on the first page that has a valid mapping, decide whether or
198 * not we have to employ bounce buffering to guarantee stable pages.
199 */
200 bio_for_each_segment(from, bio, i) {
201 page = from->bv_page;
202 mapping = page_mapping(page);
203 if (!mapping)
204 continue;
205 bdi = mapping->backing_dev_info;
206 return mapping->host->i_sb->s_flags & MS_SNAP_STABLE;
207 }
208
209 return 0;
210} 191}
211#else 192#else
212static int must_snapshot_stable_pages(struct request_queue *q, struct bio *bio) 193static int must_snapshot_stable_pages(struct request_queue *q, struct bio *bio)
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index efe68148f621..4514ad7415c3 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -2311,10 +2311,6 @@ void wait_for_stable_page(struct page *page)
2311 2311
2312 if (!bdi_cap_stable_pages_required(bdi)) 2312 if (!bdi_cap_stable_pages_required(bdi))
2313 return; 2313 return;
2314#ifdef CONFIG_NEED_BOUNCE_POOL
2315 if (mapping->host->i_sb->s_flags & MS_SNAP_STABLE)
2316 return;
2317#endif /* CONFIG_NEED_BOUNCE_POOL */
2318 2314
2319 wait_on_page_writeback(page); 2315 wait_on_page_writeback(page);
2320} 2316}