From: Lukas Czerner <lczerner@redhat.com>
To: linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Lukas Czerner <lczerner@redhat.com>,
Jens Axboe <jaxboe@fusionio.com>, Jeff Moyer <jmoyer@redhat.com>
Subject: [PATCH] blkdev: Do not return -EOPNOTSUPP if discard is supported
Date: Thu, 5 May 2011 17:12:45 +0200 [thread overview]
Message-ID: <1304608365-17199-1-git-send-email-lczerner@redhat.com> (raw)
In-Reply-To: <1304345841-20063-1-git-send-email-lczerner@redhat.com>
Currently we return -EOPNOTSUPP in blkdev_issue_discard() if any of the
bio fails due to underlying device not supporting discard request.
However, if the device is for example dm device composed of devices
which some of them support discard and some of them does not, it is ok
for some bios to fail with EOPNOTSUPP, but it does not mean that discard
is not supported at all.
This commit removes the check for bios failed with EOPNOTSUPP and change
blkdev_issue_discard() to return operation not supported if and only if
the device does not actually supports it, not just part of the device as
some bios might indicate.
This change also fixes problem with BLKDISCARD ioctl() which now works
correctly on such dm devices.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
CC: Jens Axboe <jaxboe@fusionio.com>
CC: Jeff Moyer <jmoyer@redhat.com>
---
block/blk-lib.c | 9 ++-------
1 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/block/blk-lib.c b/block/blk-lib.c
index d7a98d3..78e627e 100644
--- a/block/blk-lib.c
+++ b/block/blk-lib.c
@@ -19,11 +19,8 @@ static void bio_batch_end_io(struct bio *bio, int err)
{
struct bio_batch *bb = bio->bi_private;
- if (err) {
- if (err == -EOPNOTSUPP)
- set_bit(BIO_EOPNOTSUPP, &bb->flags);
+ if (err && (err != -EOPNOTSUPP))
clear_bit(BIO_UPTODATE, &bb->flags);
- }
if (atomic_dec_and_test(&bb->done))
complete(bb->wait);
bio_put(bio);
@@ -107,9 +104,7 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
if (!atomic_dec_and_test(&bb.done))
wait_for_completion(&wait);
- if (test_bit(BIO_EOPNOTSUPP, &bb.flags))
- ret = -EOPNOTSUPP;
- else if (!test_bit(BIO_UPTODATE, &bb.flags))
+ if (!test_bit(BIO_UPTODATE, &bb.flags))
ret = -EIO;
return ret;
--
1.7.4.4
next prev parent reply other threads:[~2011-05-05 15:13 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-02 14:17 [PATCH 1/3] blkdev: Submit discard bio in batches in blkdev_issue_discard() Lukas Czerner
2011-05-02 14:17 ` [PATCH 2/3] blkdev: Simple cleanup in blkdev_issue_zeroout() Lukas Czerner
2011-05-02 14:17 ` [PATCH 3/3] blkdev: honor discard_granularity in blkdev_issue_discard() Lukas Czerner
2011-05-02 14:38 ` Martin K. Petersen
2011-05-02 16:10 ` Jeff Moyer
2011-05-02 17:07 ` Martin K. Petersen
2011-05-02 23:21 ` Dave Chinner
2011-05-02 16:23 ` [PATCH 1/3] blkdev: Submit discard bio in batches " Jens Axboe
2011-05-03 9:30 ` Lukas Czerner
2011-05-03 9:57 ` Christoph Hellwig
2011-05-07 1:23 ` Jens Axboe
2011-05-05 15:20 ` Lukas Czerner
2011-05-07 1:24 ` Jens Axboe
2011-05-09 14:30 ` Christoph Hellwig
2011-05-05 15:12 ` Lukas Czerner [this message]
2011-05-07 1:30 ` [PATCH] blkdev: Do not return -EOPNOTSUPP if discard is supported Jens Axboe
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=1304608365-17199-1-git-send-email-lczerner@redhat.com \
--to=lczerner@redhat.com \
--cc=jaxboe@fusionio.com \
--cc=jmoyer@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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
Powered by JetHome