[PATCH] block: Make blkdev_issue_discard() interruptible

Lukas Czerner
2010-10-22T11:06:23Z

It has been tested on SSD device where mkfs.ext4 without -K takes rally
long due to discarding whole device. With this patch I am able to
successfully terminate that with ctrl+c. Aside that discard functionality
remains unchanged.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
---
block/blk-lib.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/block/blk-lib.c b/block/blk-lib.c
index c392029..54994e7 100644
--- a/block/blk-lib.c
+++ b/block/blk-lib.c
@@ -101,6 +101,9 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
else if (!bio_flagged(bio, BIO_UPTODATE))
ret = -EIO;
bio_put(bio);
+
+ if (unlikely(fatal_signal_pending(current)))
+ ret = -ERESTARTSYS;
}

return ret;
--
1.7.2.3