Skip to contentSkip to conversation

block: Add BLKSECDISCARD

PATCH Superseded Adrian Hunter 1 participant 2 messages Jun 13, 2010

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/4 block: Add BLKSECDISCARD

Quoted 1 line

From 2bca77333187190bacb3e8b6f79a51ee11be62b5 Mon Sep 17 00:00:00 2001

From: Adrian Hunter <[email protected]>
Date: Thu, 3 Jun 2010 10:46:04 +0300
Subject: [PATCH 1/4] block: Add BLKSECDISCARD

eMMC v4.4 cards can provide a secure erase operation which guarantees that all copies of the discarded sectors (for example created by garbage collection) will also be erased. For this a new ioctl BLKSECDISCARD is added.

---

block/compat_ioctl.c |    1 +
block/ioctl.c        |    5 +++++
include/linux/fs.h   |    1 +
3 files changed, 7 insertions(+), 0 deletions(-)
block/compat_ioctl.c +0 -0
index f26051f..24a146d 100644
@@ -753,6 +753,7 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg)

case BLKFLSBUF:
case BLKROSET:
case BLKDISCARD:
+ case BLKSECDISCARD:
/*
* the ones below are implemented in blkdev_locked_ioctl,
* but we call blkdev_ioctl, which gets the lock for us

block/ioctl.c +0 -0
index e8eb679..bc5c19c 100644
@@ -238,6 +238,11 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
		return blk_ioctl_discard(bdev, range[0], range[1]);
	}

+ case BLKSECDISCARD:
+ if (!(mode & FMODE_WRITE))
+ return -EBADF;
+ return __blkdev_driver_ioctl(bdev, mode, cmd, arg);
+

	case HDIO_GETGEO: {
		struct hd_geometry geo;
include/linux/fs.h +0 -0
index 471e1ff..ed06568 100644
@@ -309,6 +309,7 @@ struct inodes_stat_t {

#define BLKALIGNOFF _IO(0x12,122)
#define BLKPBSZGET _IO(0x12,123)
#define BLKDISCARDZEROES _IO(0x12,124)
+#define BLKSECDISCARD _IO(0x12,125)

#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */
#define FIBMAP _IO(0x00,1) /* bmap access */

Signature · 1 line
1.6.3.3
#1 lore raw

PATCH v2 1/4 block: Add BLKSECDISCARD

Quoted 1 line

From 2bca77333187190bacb3e8b6f79a51ee11be62b5 Mon Sep 17 00:00:00 2001

From: Adrian Hunter <[email protected]>
Date: Thu, 3 Jun 2010 10:46:04 +0300
Subject: [PATCH 1/4] block: Add BLKSECDISCARD

eMMC v4.4 cards can provide a secure erase operation which guarantees that all copies of the discarded sectors (for example created by garbage collection) will also be erased. For this a new ioctl BLKSECDISCARD is added.

---

block/compat_ioctl.c |    1 +
block/ioctl.c        |    5 +++++
include/linux/fs.h   |    1 +
3 files changed, 7 insertions(+), 0 deletions(-)
block/compat_ioctl.c +0 -0
index f26051f..24a146d 100644
@@ -753,6 +753,7 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg)

case BLKFLSBUF:
case BLKROSET:
case BLKDISCARD:
+ case BLKSECDISCARD:
/*
* the ones below are implemented in blkdev_locked_ioctl,
* but we call blkdev_ioctl, which gets the lock for us

block/ioctl.c +0 -0
index e8eb679..bc5c19c 100644
@@ -238,6 +238,11 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
		return blk_ioctl_discard(bdev, range[0], range[1]);
	}

+ case BLKSECDISCARD:
+ if (!(mode & FMODE_WRITE))
+ return -EBADF;
+ return __blkdev_driver_ioctl(bdev, mode, cmd, arg);
+

	case HDIO_GETGEO: {
		struct hd_geometry geo;
include/linux/fs.h +0 -0
index 471e1ff..ed06568 100644
@@ -309,6 +309,7 @@ struct inodes_stat_t {

#define BLKALIGNOFF _IO(0x12,122)
#define BLKPBSZGET _IO(0x12,123)
#define BLKDISCARDZEROES _IO(0x12,124)
+#define BLKSECDISCARD _IO(0x12,125)

#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */
#define FIBMAP _IO(0x00,1) /* bmap access */

Signature · 1 line
1.6.3.3