From: Kent Overstreet <kmo@daterainc.com>
To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-btrfs@vger.kernel.org
Cc: axboe@kernel.dk, hch@infradead.org,
Kent Overstreet <kmo@daterainc.com>,
Joern Engel <joern@logfs.org>,
Prasad Joshi <prasadjoshi.linux@gmail.com>
Subject: [PATCH 2/9] block: submit_bio_wait() conversions
Date: Mon, 4 Nov 2013 15:36:20 -0800 [thread overview]
Message-ID: <1383608187-27368-3-git-send-email-kmo@daterainc.com> (raw)
In-Reply-To: <1383608187-27368-1-git-send-email-kmo@daterainc.com>
It was being open coded in a few places.
Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Joern Engel <joern@logfs.org>
Cc: Prasad Joshi <prasadjoshi.linux@gmail.com>
---
block/blk-flush.c | 19 +------------------
fs/logfs/dev_bdev.c | 8 +-------
2 files changed, 2 insertions(+), 25 deletions(-)
diff --git a/block/blk-flush.c b/block/blk-flush.c
index 5580b05..9288aaf 100644
--- a/block/blk-flush.c
+++ b/block/blk-flush.c
@@ -502,15 +502,6 @@ void blk_abort_flushes(struct request_queue *q)
}
}
-static void bio_end_flush(struct bio *bio, int err)
-{
- if (err)
- clear_bit(BIO_UPTODATE, &bio->bi_flags);
- if (bio->bi_private)
- complete(bio->bi_private);
- bio_put(bio);
-}
-
/**
* blkdev_issue_flush - queue a flush
* @bdev: blockdev to issue flush for
@@ -526,7 +517,6 @@ static void bio_end_flush(struct bio *bio, int err)
int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask,
sector_t *error_sector)
{
- DECLARE_COMPLETION_ONSTACK(wait);
struct request_queue *q;
struct bio *bio;
int ret = 0;
@@ -548,13 +538,9 @@ int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask,
return -ENXIO;
bio = bio_alloc(gfp_mask, 0);
- bio->bi_end_io = bio_end_flush;
bio->bi_bdev = bdev;
- bio->bi_private = &wait;
- bio_get(bio);
- submit_bio(WRITE_FLUSH, bio);
- wait_for_completion_io(&wait);
+ ret = submit_bio_wait(WRITE_FLUSH, bio);
/*
* The driver must store the error location in ->bi_sector, if
@@ -564,9 +550,6 @@ int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask,
if (error_sector)
*error_sector = bio->bi_iter.bi_sector;
- if (!bio_flagged(bio, BIO_UPTODATE))
- ret = -EIO;
-
bio_put(bio);
return ret;
}
diff --git a/fs/logfs/dev_bdev.c b/fs/logfs/dev_bdev.c
index ca42715..80adce7 100644
--- a/fs/logfs/dev_bdev.c
+++ b/fs/logfs/dev_bdev.c
@@ -23,7 +23,6 @@ static int sync_request(struct page *page, struct block_device *bdev, int rw)
{
struct bio bio;
struct bio_vec bio_vec;
- struct completion complete;
bio_init(&bio);
bio.bi_max_vecs = 1;
@@ -35,13 +34,8 @@ static int sync_request(struct page *page, struct block_device *bdev, int rw)
bio.bi_iter.bi_size = PAGE_SIZE;
bio.bi_bdev = bdev;
bio.bi_iter.bi_sector = page->index * (PAGE_SIZE >> 9);
- init_completion(&complete);
- bio.bi_private = &complete;
- bio.bi_end_io = request_complete;
- submit_bio(rw, &bio);
- wait_for_completion(&complete);
- return test_bit(BIO_UPTODATE, &bio.bi_flags) ? 0 : -EIO;
+ return submit_bio_wait(rw, &bio);
}
static int bdev_readpage(void *_sb, struct page *page)
--
1.8.4.rc3
next prev parent reply other threads:[~2013-11-04 23:36 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-04 23:36 [PATCH] Block layer stuff/DIO rewrite prep for 3.14 Kent Overstreet
2013-11-04 23:36 ` [PATCH 1/9] block: Convert various code to bio_for_each_segment() Kent Overstreet
2013-11-05 13:53 ` Josef Bacik
2013-11-07 11:26 ` Jan Kara
2013-11-07 20:21 ` Kent Overstreet
2013-11-04 23:36 ` Kent Overstreet [this message]
2013-11-04 23:36 ` [PATCH 3/9] block: Move bouncing to generic_make_request() Kent Overstreet
2013-11-04 23:36 ` [PATCH 4/9] block: Make generic_make_request handle arbitrary sized bios Kent Overstreet
2013-11-04 23:56 ` [dm-devel] " Mike Christie
2013-11-05 0:55 ` Kent Overstreet
2013-11-04 23:36 ` [PATCH 5/9] block: Gut bio_add_page(), kill bio_add_pc_page() Kent Overstreet
2013-11-04 23:36 ` [PATCH 6/9] mtip32xx: handle arbitrary size bios Kent Overstreet
2013-11-05 13:49 ` Josef Bacik
2013-11-04 23:36 ` [PATCH 7/9] blk-lib.c: generic_make_request() handles large bios now Kent Overstreet
2013-11-04 23:36 ` [PATCH 8/9] bcache: " Kent Overstreet
2013-11-04 23:36 ` [PATCH 9/9] block: Add bio_get_user_pages() Kent Overstreet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1383608187-27368-3-git-send-email-kmo@daterainc.com \
--to=kmo@daterainc.com \
--cc=axboe@kernel.dk \
--cc=hch@infradead.org \
--cc=joern@logfs.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=prasadjoshi.linux@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®