mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-31 12:10:52 -04:00
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. [[email protected]: rename _submit_bh()'s `flags' to `bio_flags', delobotomize the _submit_bh declaration] [[email protected]: teeny cleanup] Signed-off-by: Darrick J. Wong <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Artem Bityutskiy <[email protected]> Reviewed-by: Jan Kara <[email protected]> Cc: Jens Axboe <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
106c992a5e
commit
7136851117
8 changed files with 34 additions and 31 deletions
|
|
@ -162,8 +162,17 @@ static void journal_do_submit_data(struct buffer_head **wbuf, int bufs,
|
|||
|
||||
for (i = 0; i < bufs; i++) {
|
||||
wbuf[i]->b_end_io = end_buffer_write_sync;
|
||||
/* We use-up our safety reference in submit_bh() */
|
||||
submit_bh(write_op, wbuf[i]);
|
||||
/*
|
||||
* Here we write back pagecache data that may be mmaped. Since
|
||||
* we cannot afford to clean the page and set PageWriteback
|
||||
* here due to lock ordering (page lock ranks above transaction
|
||||
* start), the data can change while IO is in flight. Tell the
|
||||
* block layer it should bounce the bio pages if stable data
|
||||
* during write is required.
|
||||
*
|
||||
* We use up our safety reference in submit_bh().
|
||||
*/
|
||||
_submit_bh(write_op, wbuf[i], 1 << BIO_SNAP_STABLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -667,7 +676,17 @@ start_journal_io:
|
|||
clear_buffer_dirty(bh);
|
||||
set_buffer_uptodate(bh);
|
||||
bh->b_end_io = journal_end_buffer_io_sync;
|
||||
submit_bh(write_op, bh);
|
||||
/*
|
||||
* In data=journal mode, here we can end up
|
||||
* writing pagecache data that might be
|
||||
* mmapped. Since we can't afford to clean the
|
||||
* page and set PageWriteback (see the comment
|
||||
* near the other use of _submit_bh()), the
|
||||
* data can change while the write is in
|
||||
* flight. Tell the block layer to bounce the
|
||||
* bio pages if stable pages are required.
|
||||
*/
|
||||
_submit_bh(write_op, bh, 1 << BIO_SNAP_STABLE);
|
||||
}
|
||||
cond_resched();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue