From: Shaohua Li <shli@kernel.org>
To: Goldwyn Rodrigues <rgoldwyn@suse.de>
Cc: linux-block@vger.kernel.org, hch@infradead.org, jack@suse.cz,
linux-raid@vger.kernel.org, dm-devel@redhat.com,
Goldwyn Rodrigues <rgoldwyn@suse.com>
Subject: Re: [PATCH 2/9] md: Add nowait support to md
Date: Tue, 8 Aug 2017 13:34:12 -0700 [thread overview]
Message-ID: <20170808203412.jqqqj73pcoeovbzd@kernel.org> (raw)
In-Reply-To: <20170726235806.12148-3-rgoldwyn@suse.de>
On Wed, Jul 26, 2017 at 06:57:59PM -0500, Goldwyn Rodrigues wrote:
> From: Goldwyn Rodrigues <rgoldwyn@suse.com>
>
> Set queue flags to QUEUE_FLAG_NOWAIT to indicate REQ_NOWAIT
> will be handled.
>
> If an I/O on the md will be delayed, it would bail by calling
> bio_wouldblock_error(). The conditions when this could happen are:
>
> + MD is suspended
> + There is a change pending on the SB, and current I/O would
> block until that is complete.
>
> Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
> ---
> drivers/md/md.c | 27 +++++++++++++++++++++++++--
> 1 file changed, 25 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 8cdca0296749..d96c27d16841 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -285,6 +285,13 @@ static blk_qc_t md_make_request(struct request_queue *q, struct bio *bio)
> bio_endio(bio);
> return BLK_QC_T_NONE;
> }
> +
> + if (mddev->suspended && (bio->bi_opf & REQ_NOWAIT)) {
> + bio_wouldblock_error(bio);
> + rcu_read_unlock();
this unlock is not required.
> + return BLK_QC_T_NONE;
> + }
> +
> check_suspended:
> rcu_read_lock();
> if (mddev->suspended) {
> @@ -5274,6 +5281,10 @@ static int md_alloc(dev_t dev, char *name)
> mddev->queue = NULL;
> goto abort;
> }
> +
> + /* Set the NOWAIT flags to show support */
> + queue_flag_set_unlocked(QUEUE_FLAG_NOWAIT, mddev->queue);
> +
> disk->major = MAJOR(mddev->unit);
> disk->first_minor = unit << shift;
> if (name)
> @@ -8010,8 +8021,20 @@ bool md_write_start(struct mddev *mddev, struct bio *bi)
> rcu_read_unlock();
> if (did_change)
> sysfs_notify_dirent_safe(mddev->sysfs_state);
> - wait_event(mddev->sb_wait,
> - !test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags) && !mddev->suspended);
> +
> + /* Don't wait for sb writes if marked with REQ_NOWAIT */
> + if (test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags) ||
> + mddev->suspended) {
> + if (bi->bi_opf & REQ_NOWAIT) {
> + bio_wouldblock_error(bi);
> + percpu_ref_put(&mddev->writes_pending);
> + return false;
> + }
> +
> + wait_event(mddev->sb_wait,
> + !test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags) && !mddev->suspended);
> + }
> +
> if (test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags)) {
> percpu_ref_put(&mddev->writes_pending);
> return false;
> --
> 2.12.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-08-08 20:34 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-26 23:57 [PATCH 0/9] Nowait feature for stacked block devices Goldwyn Rodrigues
2017-07-26 23:57 ` [PATCH 1/9] QUEUE_FLAG_NOWAIT to indicate device supports nowait Goldwyn Rodrigues
2017-08-08 20:32 ` Shaohua Li
2017-08-08 20:36 ` Jens Axboe
2017-08-10 2:18 ` Jens Axboe
2017-08-10 11:38 ` Goldwyn Rodrigues
2017-08-10 14:14 ` Jens Axboe
2017-08-10 17:15 ` Goldwyn Rodrigues
2017-08-10 17:17 ` Jens Axboe
2017-08-09 11:44 ` Goldwyn Rodrigues
2017-08-09 15:02 ` Shaohua Li
2017-08-09 15:35 ` Goldwyn Rodrigues
2017-08-09 20:21 ` Shaohua Li
2017-08-09 22:16 ` Goldwyn Rodrigues
2017-08-10 1:17 ` Shaohua Li
2017-08-10 2:07 ` Goldwyn Rodrigues
2017-08-10 2:17 ` Jens Axboe
2017-08-10 11:49 ` Goldwyn Rodrigues
2017-08-10 14:23 ` Jens Axboe
2017-08-10 14:25 ` Jan Kara
2017-08-10 14:28 ` Jens Axboe
2017-08-10 17:15 ` Goldwyn Rodrigues
2017-08-10 17:20 ` Jens Axboe
2017-07-26 23:57 ` [PATCH 2/9] md: Add nowait support to md Goldwyn Rodrigues
2017-08-08 20:34 ` Shaohua Li [this message]
2017-07-26 23:58 ` [PATCH 3/9] md: raid1 nowait support Goldwyn Rodrigues
2017-08-08 20:39 ` Shaohua Li
2017-08-09 11:45 ` Goldwyn Rodrigues
2017-07-26 23:58 ` [PATCH 4/9] md: raid5 " Goldwyn Rodrigues
2017-08-08 20:43 ` Shaohua Li
2017-08-09 11:45 ` Goldwyn Rodrigues
2017-07-26 23:58 ` [PATCH 5/9] md: raid10 " Goldwyn Rodrigues
2017-08-08 20:40 ` Shaohua Li
2017-07-26 23:58 ` [PATCH 6/9] dm: add " Goldwyn Rodrigues
2017-07-26 23:58 ` [PATCH 7/9] dm: Add nowait support to raid1 Goldwyn Rodrigues
2017-07-26 23:58 ` [PATCH 8/9] dm: Add nowait support to dm-delay Goldwyn Rodrigues
2017-07-26 23:58 ` [PATCH 9/9] dm-mpath: Add nowait support Goldwyn Rodrigues
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=20170808203412.jqqqj73pcoeovbzd@kernel.org \
--to=shli@kernel.org \
--cc=dm-devel@redhat.com \
--cc=hch@infradead.org \
--cc=jack@suse.cz \
--cc=linux-block@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=rgoldwyn@suse.com \
--cc=rgoldwyn@suse.de \
/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;
as well as URLs for NNTP newsgroup(s).