summaryrefslogtreecommitdiff
path: root/block/blk-lib.c
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@nokia.com>2010-08-11 14:17:49 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-12 08:43:30 -0700
commit8d57a98ccd0b4489003473979da8f5a1363ba7a3 (patch)
tree2982997ce66bb6a92c020b7189966c3097095fd7 /block/blk-lib.c
parent93caf8e69eac763f6a20cf253ace8e7fc1ab7953 (diff)
downloadlinux-3.10-8d57a98ccd0b4489003473979da8f5a1363ba7a3.tar.gz
linux-3.10-8d57a98ccd0b4489003473979da8f5a1363ba7a3.tar.bz2
linux-3.10-8d57a98ccd0b4489003473979da8f5a1363ba7a3.zip
block: add secure discard
Secure discard is the same as discard except that all copies of the discarded sectors (perhaps created by garbage collection) must also be erased. Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com> Acked-by: Jens Axboe <axboe@kernel.dk> Cc: Kyungmin Park <kmpark@infradead.org> Cc: Madhusudhan Chikkature <madhu.cr@ti.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Ben Gardiner <bengardiner@nanometrics.ca> Cc: <linux-mmc@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'block/blk-lib.c')
-rw-r--r--block/blk-lib.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/block/blk-lib.c b/block/blk-lib.c
index c1fc55a83ba..c392029a104 100644
--- a/block/blk-lib.c
+++ b/block/blk-lib.c
@@ -62,6 +62,12 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
max_discard_sectors &= ~(disc_sects - 1);
}
+ if (flags & BLKDEV_IFL_SECURE) {
+ if (!blk_queue_secdiscard(q))
+ return -EOPNOTSUPP;
+ type |= DISCARD_SECURE;
+ }
+
while (nr_sects && !ret) {
bio = bio_alloc(gfp_mask, 1);
if (!bio) {