mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 04:33:26 +02: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 <kmo@daterainc.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Chris Mason <chris.mason@fusionio.com> Cc: Jaegeuk Kim <jaegeuk.kim@samsung.com> Cc: Joern Engel <joern@logfs.org> Cc: Prasad Joshi <prasadjoshi.linux@gmail.com> Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
17
fs/mpage.c
17
fs/mpage.c
@@ -43,16 +43,14 @@
|
||||
*/
|
||||
static void mpage_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 *bv;
|
||||
int i;
|
||||
|
||||
do {
|
||||
struct page *page = bvec->bv_page;
|
||||
bio_for_each_segment_all(bv, bio, i) {
|
||||
struct page *page = bv->bv_page;
|
||||
|
||||
if (--bvec >= bio->bi_io_vec)
|
||||
prefetchw(&bvec->bv_page->flags);
|
||||
if (bio_data_dir(bio) == READ) {
|
||||
if (uptodate) {
|
||||
if (!err) {
|
||||
SetPageUptodate(page);
|
||||
} else {
|
||||
ClearPageUptodate(page);
|
||||
@@ -60,14 +58,15 @@ static void mpage_end_io(struct bio *bio, int err)
|
||||
}
|
||||
unlock_page(page);
|
||||
} else { /* bio_data_dir(bio) == WRITE */
|
||||
if (!uptodate) {
|
||||
if (err) {
|
||||
SetPageError(page);
|
||||
if (page->mapping)
|
||||
set_bit(AS_EIO, &page->mapping->flags);
|
||||
}
|
||||
end_page_writeback(page);
|
||||
}
|
||||
} while (bvec >= bio->bi_io_vec);
|
||||
}
|
||||
|
||||
bio_put(bio);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user