diff options
author | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2011-10-12 16:23:30 -0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2011-11-18 13:28:01 -0500 |
commit | 5ea42986694a96542644f9cae8b122d3a00c508f (patch) | |
tree | dd74685d8cd41e39ad14e708cb6e00e0ed016fb1 /drivers/block/xen-blkback/xenbus.c | |
parent | 97e36834f5a106459ab1b290e663a4eb6264639e (diff) |
xen/blk[front|back]: Enhance discard support with secure erasing support.
Part of the blkdev_issue_discard(xx) operation is that it can also
issue a secure discard operation that will permanantly remove the
sectors in question. We advertise that we can support that via the
'discard-secure' attribute and on the request, if the 'secure' bit
is set, we will attempt to pass in REQ_DISCARD | REQ_SECURE.
CC: Li Dongyang <lidongyang@novell.com>
[v1: Used 'flag' instead of 'secure:1' bit]
[v2: Use 'reserved' uint8_t instead of adding a new value]
[v3: Check for nseg when mapping instead of operation]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers/block/xen-blkback/xenbus.c')
-rw-r--r-- | drivers/block/xen-blkback/xenbus.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index f759ad4584c3..187fd2c1a15d 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c | |||
@@ -338,6 +338,9 @@ static int xen_vbd_create(struct xen_blkif *blkif, blkif_vdev_t handle, | |||
338 | if (q && q->flush_flags) | 338 | if (q && q->flush_flags) |
339 | vbd->flush_support = true; | 339 | vbd->flush_support = true; |
340 | 340 | ||
341 | if (q && blk_queue_secdiscard(q)) | ||
342 | vbd->discard_secure = true; | ||
343 | |||
341 | DPRINTK("Successful creation of handle=%04x (dom=%u)\n", | 344 | DPRINTK("Successful creation of handle=%04x (dom=%u)\n", |
342 | handle, blkif->domid); | 345 | handle, blkif->domid); |
343 | return 0; | 346 | return 0; |
@@ -420,6 +423,15 @@ int xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_info *be) | |||
420 | state = 1; | 423 | state = 1; |
421 | blkif->blk_backend_type = BLKIF_BACKEND_PHY; | 424 | blkif->blk_backend_type = BLKIF_BACKEND_PHY; |
422 | } | 425 | } |
426 | /* Optional. */ | ||
427 | err = xenbus_printf(xbt, dev->nodename, | ||
428 | "discard-secure", "%d", | ||
429 | blkif->vbd.discard_secure); | ||
430 | if (err) { | ||
431 | xenbus_dev_fatal(dev, err, | ||
432 | "writting discard-secure"); | ||
433 | goto kfree; | ||
434 | } | ||
423 | } | 435 | } |
424 | } else { | 436 | } else { |
425 | err = PTR_ERR(type); | 437 | err = PTR_ERR(type); |