* [RFC PATCH 16/17] fs: convert buffer head etc. to use immutable biovecs API. [not found] ` <cover.1419241597.git.dongsu.park@profitbricks.com> @ 2014-12-22 11:48 ` Dongsu Park 2014-12-23 10:51 ` Christoph Hellwig 0 siblings, 1 reply; 3+ messages in thread From: Dongsu Park @ 2014-12-22 11:48 UTC (permalink / raw) To: linux-kernel Cc: Jens Axboe, Kent Overstreet, Ming Lin, Dongsu Park, Al Viro, linux-fsdevel, linux-pm From: Kent Overstreet <kmo@daterainc.com> Increase bio->bi_remaining instead of calling bio_get(), and call bio_end() instead of bio_put() upon buffer_head submission. Also make bio submission in kernel/power/block_io.c to properly submit bios by checking whether bio_chain is available or not. Doing that, some codes that have been still using the older API can be converted in order to use the immutable biovecs API. Signed-off-by: Kent Overstreet <kmo@daterainc.com> [dpark: add more description in commit message] Signed-off-by: Dongsu Park <dongsu.park@profitbricks.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: linux-fsdevel@vger.kernel.org Cc: linux-pm@vger.kernel.org --- fs/buffer.c | 4 ++-- kernel/power/block_io.c | 23 ++++++++++++++++++----- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index 35ac0ec..78e63e3 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -3038,13 +3038,13 @@ int _submit_bh(int rw, struct buffer_head *bh, unsigned long bio_flags) if (buffer_prio(bh)) rw |= REQ_PRIO; - bio_get(bio); + atomic_inc(&bio->bi_remaining); submit_bio(rw, bio); if (bio_flagged(bio, BIO_EOPNOTSUPP)) ret = -EOPNOTSUPP; - bio_put(bio); + bio_endio(bio, 0); return ret; } EXPORT_SYMBOL_GPL(_submit_bh); diff --git a/kernel/power/block_io.c b/kernel/power/block_io.c index 9a58bc2..7206408 100644 --- a/kernel/power/block_io.c +++ b/kernel/power/block_io.c @@ -34,7 +34,6 @@ static int submit(int rw, struct block_device *bdev, sector_t sector, bio = bio_alloc(__GFP_WAIT | __GFP_HIGH, 1); bio->bi_iter.bi_sector = sector; bio->bi_bdev = bdev; - bio->bi_end_io = end_swap_bio_read; if (bio_add_page(bio, page, PAGE_SIZE, 0) < PAGE_SIZE) { printk(KERN_ERR "PM: Adding page to bio failed at %llu\n", @@ -44,15 +43,29 @@ static int submit(int rw, struct block_device *bdev, sector_t sector, } lock_page(page); - bio_get(bio); if (bio_chain == NULL) { - submit_bio(bio_rw, bio); - wait_on_page_locked(page); + int err = submit_bio_wait(bio_rw, bio); + + if (err) { + SetPageError(page); + ClearPageUptodate(page); + pr_alert("Read-error on swap-device (%u:%u:%llu)\n", + imajor(bio->bi_bdev->bd_inode), + iminor(bio->bi_bdev->bd_inode), + (unsigned long long)bio->bi_iter.bi_sector); + } else { + SetPageUptodate(page); + } + if (rw == READ) - bio_set_pages_dirty(bio); + set_page_dirty_lock(page); + unlock_page(page); bio_put(bio); } else { + bio->bi_end_io = end_swap_bio_read; + bio_get(bio); + if (rw == READ) get_page(page); /* These pages are freed later */ bio->bi_private = *bio_chain; -- 2.1.0 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RFC PATCH 16/17] fs: convert buffer head etc. to use immutable biovecs API. 2014-12-22 11:48 ` [RFC PATCH 16/17] fs: convert buffer head etc. to use immutable biovecs API Dongsu Park @ 2014-12-23 10:51 ` Christoph Hellwig 2014-12-23 12:33 ` Dongsu Park 0 siblings, 1 reply; 3+ messages in thread From: Christoph Hellwig @ 2014-12-23 10:51 UTC (permalink / raw) To: Dongsu Park Cc: linux-kernel, Jens Axboe, Kent Overstreet, Ming Lin, Al Viro, linux-fsdevel, linux-pm On Mon, Dec 22, 2014 at 12:48:43PM +0100, Dongsu Park wrote: > From: Kent Overstreet <kmo@daterainc.com> > > Increase bio->bi_remaining instead of calling bio_get(), > and call bio_end() instead of bio_put() upon buffer_head submission. Nees an explanation on why this is done. > Also make bio submission in kernel/power/block_io.c to properly submit > bios by checking whether bio_chain is available or not. Should be a separate patch. And of course both should go into the preparation series of cleanups. ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC PATCH 16/17] fs: convert buffer head etc. to use immutable biovecs API. 2014-12-23 10:51 ` Christoph Hellwig @ 2014-12-23 12:33 ` Dongsu Park 0 siblings, 0 replies; 3+ messages in thread From: Dongsu Park @ 2014-12-23 12:33 UTC (permalink / raw) To: Christoph Hellwig Cc: linux-kernel, Jens Axboe, Kent Overstreet, Ming Lin, Al Viro, linux-fsdevel, linux-pm On 23.12.2014 02:51, Christoph Hellwig wrote: > On Mon, Dec 22, 2014 at 12:48:43PM +0100, Dongsu Park wrote: > > From: Kent Overstreet <kmo@daterainc.com> > > > > Increase bio->bi_remaining instead of calling bio_get(), > > and call bio_end() instead of bio_put() upon buffer_head submission. > > Nees an explanation on why this is done. Right. > > Also make bio submission in kernel/power/block_io.c to properly submit > > bios by checking whether bio_chain is available or not. > > Should be a separate patch. > > And of course both should go into the preparation series of cleanups. Yep, agreed. I'll split it up and also move them to the prep series. Thanks, Dongsu ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-12-23 12:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <d26a9a0fc9a7d1529c115785ee5935d5750782bd.1419241597.git.dongsu.park@profitbricks.com>
[not found] ` <f67d71b4a375ab504c2fc02e94a9d2a651686cab.1419241597.git.dongsu.park@profitbricks.com>
[not found] ` <fe96db02d805ca6191dd605d03dac0d04c926fc1.1419241597.git.dongsu.park@profitbricks.com>
[not found] ` <bb0051ceb5805896089ded26c0f7f06758b25105.1419241597.git.dongsu.park@profitbricks.com>
[not found] ` <e4b7b017eaa81784889ebb2a4e6a7d4366adf13a.1419241597.git.dongsu.park@profitbricks.com>
[not found] ` <83a9ee8a309f8e08490c5dd715a608ea054f5c33.1419241597.git.dongsu.park@profitbricks.com>
[not found] ` <fc859b23b383f6f4c1e81f4210aa62cb1bdc935f.1419241597.git.dongsu.park@profitbricks.com>
[not found] ` <0b6ba533a64aec98e8447bfd30c6622d0729d12e.1419241597.git.dongsu.park@profitbricks.com>
[not found] ` <d42dae3d2a64fa4c3a0893f1af963151b31869e3.1419241597.git.dongsu.park@profitbricks.com>
[not found] ` <4334b90a56b96ad7a11e4ba7eb97c2cf4405950d.1419241597.git.dongsu.park@profitbricks.com>
[not found] ` <abe647cf7cf272220227fad4dac9c43641192f01.1419241597.git.dongsu.park@profitbricks.com>
[not found] ` <b7767767957ca758ac492e94dfb320bea4f52dd7.1419241597.git.dongsu.park@profitbricks.com>
[not found] ` <e35d37b66d621c51f2eb24ff024291bd1d53422e.1419241597.git.dongsu.park@profitbricks.com>
[not found] ` <a7118fb6a3353958a19f4d848472da2de76de238.1419241597.git.dongsu.park@profitbricks.com>
[not found] ` <a0e8166c0c5455755b0cd2d79e8066636c22aa77.1419241597.git.dongsu.park@profitbricks.com>
[not found] ` <cover.1419241597.git.dongsu.park@profitbricks.com>
2014-12-22 11:48 ` [RFC PATCH 16/17] fs: convert buffer head etc. to use immutable biovecs API Dongsu Park
2014-12-23 10:51 ` Christoph Hellwig
2014-12-23 12:33 ` Dongsu Park
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).