mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
block: Convert various code to bio_for_each_segment()
With immutable biovecs we don't want code accessing bi_io_vec directly - the uses this patch changes weren't incorrect since they all own the bio, but it makes the code harder to audit for no good reason - also, this will help with multipage bvecs later. Signed-off-by: Kent Overstreet <[email protected]> Cc: Jens Axboe <[email protected]> Cc: Alexander Viro <[email protected]> Cc: Chris Mason <[email protected]> Cc: Jaegeuk Kim <[email protected]> Cc: Joern Engel <[email protected]> Cc: Prasad Joshi <[email protected]> Cc: Trond Myklebust <[email protected]>
This commit is contained in:
parent
33879d4512
commit
2c30c71bd6
10 changed files with 67 additions and 102 deletions
|
|
@ -56,22 +56,18 @@ static DECLARE_WAIT_QUEUE_HEAD(wq);
|
|||
static void writeseg_end_io(struct bio *bio, int err)
|
||||
{
|
||||
const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
|
||||
struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
|
||||
struct bio_vec *bvec;
|
||||
int i;
|
||||
struct super_block *sb = bio->bi_private;
|
||||
struct logfs_super *super = logfs_super(sb);
|
||||
struct page *page;
|
||||
|
||||
BUG_ON(!uptodate); /* FIXME: Retry io or write elsewhere */
|
||||
BUG_ON(err);
|
||||
BUG_ON(bio->bi_vcnt == 0);
|
||||
do {
|
||||
page = bvec->bv_page;
|
||||
if (--bvec >= bio->bi_io_vec)
|
||||
prefetchw(&bvec->bv_page->flags);
|
||||
|
||||
end_page_writeback(page);
|
||||
page_cache_release(page);
|
||||
} while (bvec >= bio->bi_io_vec);
|
||||
bio_for_each_segment_all(bvec, bio, i) {
|
||||
end_page_writeback(bvec->bv_page);
|
||||
page_cache_release(bvec->bv_page);
|
||||
}
|
||||
bio_put(bio);
|
||||
if (atomic_dec_and_test(&super->s_pending_writes))
|
||||
wake_up(&wq);
|
||||
|
|
|
|||
Loading…
Reference in a new issue