aboutsummaryrefslogtreecommitdiffstats
path: root/fs/logfs
diff options
context:
space:
mode:
authorKent Overstreet <kmo@daterainc.com>2013-11-07 15:20:26 -0500
committerKent Overstreet <kmo@daterainc.com>2013-11-24 01:33:46 -0500
commit2c30c71bd653afcbed7f6754e8fe3d16e0e708a1 (patch)
treea6b1147e4302b7216600c397cb47ca7f7f375a43 /fs/logfs
parent33879d4512c021ae65be9706608dacb36b4687b1 (diff)
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>
Diffstat (limited to 'fs/logfs')
-rw-r--r--fs/logfs/dev_bdev.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/fs/logfs/dev_bdev.c b/fs/logfs/dev_bdev.c
index 0f95f0d0b313..e6df3be3b31b 100644
--- a/fs/logfs/dev_bdev.c
+++ b/fs/logfs/dev_bdev.c
@@ -56,22 +56,18 @@ static DECLARE_WAIT_QUEUE_HEAD(wq);
56static void writeseg_end_io(struct bio *bio, int err) 56static void writeseg_end_io(struct bio *bio, int err)
57{ 57{
58 const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); 58 const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
59 struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1; 59 struct bio_vec *bvec;
60 int i;
60 struct super_block *sb = bio->bi_private; 61 struct super_block *sb = bio->bi_private;
61 struct logfs_super *super = logfs_super(sb); 62 struct logfs_super *super = logfs_super(sb);
62 struct page *page;
63 63
64 BUG_ON(!uptodate); /* FIXME: Retry io or write elsewhere */ 64 BUG_ON(!uptodate); /* FIXME: Retry io or write elsewhere */
65 BUG_ON(err); 65 BUG_ON(err);
66 BUG_ON(bio->bi_vcnt == 0); 66
67 do { 67 bio_for_each_segment_all(bvec, bio, i) {
68 page = bvec->bv_page; 68 end_page_writeback(bvec->bv_page);
69 if (--bvec >= bio->bi_io_vec) 69 page_cache_release(bvec->bv_page);
70 prefetchw(&bvec->bv_page->flags); 70 }
71
72 end_page_writeback(page);
73 page_cache_release(page);
74 } while (bvec >= bio->bi_io_vec);
75 bio_put(bio); 71 bio_put(bio);
76 if (atomic_dec_and_test(&super->s_pending_writes)) 72 if (atomic_dec_and_test(&super->s_pending_writes))
77 wake_up(&wq); 73 wake_up(&wq);