diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-15 15:48:41 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-15 15:48:41 -0500 |
commit | 16008d641670571ff4cd750b416c7caf2d89f467 (patch) | |
tree | 6dc32821bd4576106cee50d52a90a8106a9d481f /drivers/block/xen-blkback | |
parent | b3c9dd182ed3bdcdaf0e42625a35924b0497afdc (diff) | |
parent | 85a0f7b220777cd3c232fd2f079db5c4a874c4ee (diff) |
Merge branch 'for-3.3/drivers' of git://git.kernel.dk/linux-block
* 'for-3.3/drivers' of git://git.kernel.dk/linux-block:
mtip32xx: do rebuild monitoring asynchronously
xen-blkfront: Use kcalloc instead of kzalloc to allocate array
mtip32xx: uninitialized variable in mtip_quiesce_io()
mtip32xx: updates based on feedback
xen-blkback: convert hole punching to discard request on loop devices
xen/blkback: Move processing of BLKIF_OP_DISCARD from dispatch_rw_block_io
xen/blk[front|back]: Enhance discard support with secure erasing support.
xen/blk[front|back]: Squash blkif_request_rw and blkif_request_discard together
mtip32xx: update to new ->make_request() API
mtip32xx: add module.h include to avoid conflict with moduleh tree
mtip32xx: mark a few more items static
mtip32xx: ensure that all local functions are static
mtip32xx: cleanup compat ioctl handling
mtip32xx: fix warnings/errors on 32-bit compiles
block: Add driver for Micron RealSSD pcie flash cards
Diffstat (limited to 'drivers/block/xen-blkback')
-rw-r--r-- | drivers/block/xen-blkback/blkback.c | 84 | ||||
-rw-r--r-- | drivers/block/xen-blkback/common.h | 67 | ||||
-rw-r--r-- | drivers/block/xen-blkback/xenbus.c | 12 |
3 files changed, 86 insertions, 77 deletions
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index 15ec4db194d1..0088bf60f368 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c | |||
@@ -39,9 +39,6 @@ | |||
39 | #include <linux/list.h> | 39 | #include <linux/list.h> |
40 | #include <linux/delay.h> | 40 | #include <linux/delay.h> |
41 | #include <linux/freezer.h> | 41 | #include <linux/freezer.h> |
42 | #include <linux/loop.h> | ||
43 | #include <linux/falloc.h> | ||
44 | #include <linux/fs.h> | ||
45 | 42 | ||
46 | #include <xen/events.h> | 43 | #include <xen/events.h> |
47 | #include <xen/page.h> | 44 | #include <xen/page.h> |
@@ -362,7 +359,7 @@ static int xen_blkbk_map(struct blkif_request *req, | |||
362 | { | 359 | { |
363 | struct gnttab_map_grant_ref map[BLKIF_MAX_SEGMENTS_PER_REQUEST]; | 360 | struct gnttab_map_grant_ref map[BLKIF_MAX_SEGMENTS_PER_REQUEST]; |
364 | int i; | 361 | int i; |
365 | int nseg = req->nr_segments; | 362 | int nseg = req->u.rw.nr_segments; |
366 | int ret = 0; | 363 | int ret = 0; |
367 | 364 | ||
368 | /* | 365 | /* |
@@ -416,30 +413,25 @@ static int xen_blkbk_map(struct blkif_request *req, | |||
416 | return ret; | 413 | return ret; |
417 | } | 414 | } |
418 | 415 | ||
419 | static void xen_blk_discard(struct xen_blkif *blkif, struct blkif_request *req) | 416 | static int dispatch_discard_io(struct xen_blkif *blkif, |
417 | struct blkif_request *req) | ||
420 | { | 418 | { |
421 | int err = 0; | 419 | int err = 0; |
422 | int status = BLKIF_RSP_OKAY; | 420 | int status = BLKIF_RSP_OKAY; |
423 | struct block_device *bdev = blkif->vbd.bdev; | 421 | struct block_device *bdev = blkif->vbd.bdev; |
424 | 422 | ||
425 | if (blkif->blk_backend_type == BLKIF_BACKEND_PHY) | 423 | blkif->st_ds_req++; |
426 | /* just forward the discard request */ | 424 | |
425 | xen_blkif_get(blkif); | ||
426 | if (blkif->blk_backend_type == BLKIF_BACKEND_PHY || | ||
427 | blkif->blk_backend_type == BLKIF_BACKEND_FILE) { | ||
428 | unsigned long secure = (blkif->vbd.discard_secure && | ||
429 | (req->u.discard.flag & BLKIF_DISCARD_SECURE)) ? | ||
430 | BLKDEV_DISCARD_SECURE : 0; | ||
427 | err = blkdev_issue_discard(bdev, | 431 | err = blkdev_issue_discard(bdev, |
428 | req->u.discard.sector_number, | 432 | req->u.discard.sector_number, |
429 | req->u.discard.nr_sectors, | 433 | req->u.discard.nr_sectors, |
430 | GFP_KERNEL, 0); | 434 | GFP_KERNEL, secure); |
431 | else if (blkif->blk_backend_type == BLKIF_BACKEND_FILE) { | ||
432 | /* punch a hole in the backing file */ | ||
433 | struct loop_device *lo = bdev->bd_disk->private_data; | ||
434 | struct file *file = lo->lo_backing_file; | ||
435 | |||
436 | if (file->f_op->fallocate) | ||
437 | err = file->f_op->fallocate(file, | ||
438 | FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE, | ||
439 | req->u.discard.sector_number << 9, | ||
440 | req->u.discard.nr_sectors << 9); | ||
441 | else | ||
442 | err = -EOPNOTSUPP; | ||
443 | } else | 435 | } else |
444 | err = -EOPNOTSUPP; | 436 | err = -EOPNOTSUPP; |
445 | 437 | ||
@@ -449,7 +441,9 @@ static void xen_blk_discard(struct xen_blkif *blkif, struct blkif_request *req) | |||
449 | } else if (err) | 441 | } else if (err) |
450 | status = BLKIF_RSP_ERROR; | 442 | status = BLKIF_RSP_ERROR; |
451 | 443 | ||
452 | make_response(blkif, req->id, req->operation, status); | 444 | make_response(blkif, req->u.discard.id, req->operation, status); |
445 | xen_blkif_put(blkif); | ||
446 | return err; | ||
453 | } | 447 | } |
454 | 448 | ||
455 | static void xen_blk_drain_io(struct xen_blkif *blkif) | 449 | static void xen_blk_drain_io(struct xen_blkif *blkif) |
@@ -573,8 +567,11 @@ __do_block_io_op(struct xen_blkif *blkif) | |||
573 | 567 | ||
574 | /* Apply all sanity checks to /private copy/ of request. */ | 568 | /* Apply all sanity checks to /private copy/ of request. */ |
575 | barrier(); | 569 | barrier(); |
576 | 570 | if (unlikely(req.operation == BLKIF_OP_DISCARD)) { | |
577 | if (dispatch_rw_block_io(blkif, &req, pending_req)) | 571 | free_req(pending_req); |
572 | if (dispatch_discard_io(blkif, &req)) | ||
573 | break; | ||
574 | } else if (dispatch_rw_block_io(blkif, &req, pending_req)) | ||
578 | break; | 575 | break; |
579 | 576 | ||
580 | /* Yield point for this unbounded loop. */ | 577 | /* Yield point for this unbounded loop. */ |
@@ -633,10 +630,6 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif, | |||
633 | blkif->st_f_req++; | 630 | blkif->st_f_req++; |
634 | operation = WRITE_FLUSH; | 631 | operation = WRITE_FLUSH; |
635 | break; | 632 | break; |
636 | case BLKIF_OP_DISCARD: | ||
637 | blkif->st_ds_req++; | ||
638 | operation = REQ_DISCARD; | ||
639 | break; | ||
640 | default: | 633 | default: |
641 | operation = 0; /* make gcc happy */ | 634 | operation = 0; /* make gcc happy */ |
642 | goto fail_response; | 635 | goto fail_response; |
@@ -644,9 +637,9 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif, | |||
644 | } | 637 | } |
645 | 638 | ||
646 | /* Check that the number of segments is sane. */ | 639 | /* Check that the number of segments is sane. */ |
647 | nseg = req->nr_segments; | 640 | nseg = req->u.rw.nr_segments; |
648 | if (unlikely(nseg == 0 && operation != WRITE_FLUSH && | 641 | |
649 | operation != REQ_DISCARD) || | 642 | if (unlikely(nseg == 0 && operation != WRITE_FLUSH) || |
650 | unlikely(nseg > BLKIF_MAX_SEGMENTS_PER_REQUEST)) { | 643 | unlikely(nseg > BLKIF_MAX_SEGMENTS_PER_REQUEST)) { |
651 | pr_debug(DRV_PFX "Bad number of segments in request (%d)\n", | 644 | pr_debug(DRV_PFX "Bad number of segments in request (%d)\n", |
652 | nseg); | 645 | nseg); |
@@ -654,12 +647,12 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif, | |||
654 | goto fail_response; | 647 | goto fail_response; |
655 | } | 648 | } |
656 | 649 | ||
657 | preq.dev = req->handle; | 650 | preq.dev = req->u.rw.handle; |
658 | preq.sector_number = req->u.rw.sector_number; | 651 | preq.sector_number = req->u.rw.sector_number; |
659 | preq.nr_sects = 0; | 652 | preq.nr_sects = 0; |
660 | 653 | ||
661 | pending_req->blkif = blkif; | 654 | pending_req->blkif = blkif; |
662 | pending_req->id = req->id; | 655 | pending_req->id = req->u.rw.id; |
663 | pending_req->operation = req->operation; | 656 | pending_req->operation = req->operation; |
664 | pending_req->status = BLKIF_RSP_OKAY; | 657 | pending_req->status = BLKIF_RSP_OKAY; |
665 | pending_req->nr_pages = nseg; | 658 | pending_req->nr_pages = nseg; |
@@ -707,7 +700,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif, | |||
707 | * the hypercall to unmap the grants - that is all done in | 700 | * the hypercall to unmap the grants - that is all done in |
708 | * xen_blkbk_unmap. | 701 | * xen_blkbk_unmap. |
709 | */ | 702 | */ |
710 | if (operation != REQ_DISCARD && xen_blkbk_map(req, pending_req, seg)) | 703 | if (xen_blkbk_map(req, pending_req, seg)) |
711 | goto fail_flush; | 704 | goto fail_flush; |
712 | 705 | ||
713 | /* | 706 | /* |
@@ -739,23 +732,16 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif, | |||
739 | 732 | ||
740 | /* This will be hit if the operation was a flush or discard. */ | 733 | /* This will be hit if the operation was a flush or discard. */ |
741 | if (!bio) { | 734 | if (!bio) { |
742 | BUG_ON(operation != WRITE_FLUSH && operation != REQ_DISCARD); | 735 | BUG_ON(operation != WRITE_FLUSH); |
743 | 736 | ||
744 | if (operation == WRITE_FLUSH) { | 737 | bio = bio_alloc(GFP_KERNEL, 0); |
745 | bio = bio_alloc(GFP_KERNEL, 0); | 738 | if (unlikely(bio == NULL)) |
746 | if (unlikely(bio == NULL)) | 739 | goto fail_put_bio; |
747 | goto fail_put_bio; | ||
748 | 740 | ||
749 | biolist[nbio++] = bio; | 741 | biolist[nbio++] = bio; |
750 | bio->bi_bdev = preq.bdev; | 742 | bio->bi_bdev = preq.bdev; |
751 | bio->bi_private = pending_req; | 743 | bio->bi_private = pending_req; |
752 | bio->bi_end_io = end_block_io_op; | 744 | bio->bi_end_io = end_block_io_op; |
753 | } else if (operation == REQ_DISCARD) { | ||
754 | xen_blk_discard(blkif, req); | ||
755 | xen_blkif_put(blkif); | ||
756 | free_req(pending_req); | ||
757 | return 0; | ||
758 | } | ||
759 | } | 745 | } |
760 | 746 | ||
761 | /* | 747 | /* |
@@ -784,7 +770,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif, | |||
784 | xen_blkbk_unmap(pending_req); | 770 | xen_blkbk_unmap(pending_req); |
785 | fail_response: | 771 | fail_response: |
786 | /* Haven't submitted any bio's yet. */ | 772 | /* Haven't submitted any bio's yet. */ |
787 | make_response(blkif, req->id, req->operation, BLKIF_RSP_ERROR); | 773 | make_response(blkif, req->u.rw.id, req->operation, BLKIF_RSP_ERROR); |
788 | free_req(pending_req); | 774 | free_req(pending_req); |
789 | msleep(1); /* back off a bit */ | 775 | msleep(1); /* back off a bit */ |
790 | return -EIO; | 776 | return -EIO; |
diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h index dfb1b3a43a5d..d0ee7edc9be8 100644 --- a/drivers/block/xen-blkback/common.h +++ b/drivers/block/xen-blkback/common.h | |||
@@ -60,58 +60,66 @@ struct blkif_common_response { | |||
60 | char dummy; | 60 | char dummy; |
61 | }; | 61 | }; |
62 | 62 | ||
63 | /* i386 protocol version */ | ||
64 | #pragma pack(push, 4) | ||
65 | |||
66 | struct blkif_x86_32_request_rw { | 63 | struct blkif_x86_32_request_rw { |
64 | uint8_t nr_segments; /* number of segments */ | ||
65 | blkif_vdev_t handle; /* only for read/write requests */ | ||
66 | uint64_t id; /* private guest value, echoed in resp */ | ||
67 | blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ | 67 | blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ |
68 | struct blkif_request_segment seg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; | 68 | struct blkif_request_segment seg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; |
69 | }; | 69 | } __attribute__((__packed__)); |
70 | 70 | ||
71 | struct blkif_x86_32_request_discard { | 71 | struct blkif_x86_32_request_discard { |
72 | uint8_t flag; /* BLKIF_DISCARD_SECURE or zero */ | ||
73 | blkif_vdev_t _pad1; /* was "handle" for read/write requests */ | ||
74 | uint64_t id; /* private guest value, echoed in resp */ | ||
72 | blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ | 75 | blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ |
73 | uint64_t nr_sectors; | 76 | uint64_t nr_sectors; |
74 | }; | 77 | } __attribute__((__packed__)); |
75 | 78 | ||
76 | struct blkif_x86_32_request { | 79 | struct blkif_x86_32_request { |
77 | uint8_t operation; /* BLKIF_OP_??? */ | 80 | uint8_t operation; /* BLKIF_OP_??? */ |
78 | uint8_t nr_segments; /* number of segments */ | ||
79 | blkif_vdev_t handle; /* only for read/write requests */ | ||
80 | uint64_t id; /* private guest value, echoed in resp */ | ||
81 | union { | 81 | union { |
82 | struct blkif_x86_32_request_rw rw; | 82 | struct blkif_x86_32_request_rw rw; |
83 | struct blkif_x86_32_request_discard discard; | 83 | struct blkif_x86_32_request_discard discard; |
84 | } u; | 84 | } u; |
85 | }; | 85 | } __attribute__((__packed__)); |
86 | |||
87 | /* i386 protocol version */ | ||
88 | #pragma pack(push, 4) | ||
86 | struct blkif_x86_32_response { | 89 | struct blkif_x86_32_response { |
87 | uint64_t id; /* copied from request */ | 90 | uint64_t id; /* copied from request */ |
88 | uint8_t operation; /* copied from request */ | 91 | uint8_t operation; /* copied from request */ |
89 | int16_t status; /* BLKIF_RSP_??? */ | 92 | int16_t status; /* BLKIF_RSP_??? */ |
90 | }; | 93 | }; |
91 | #pragma pack(pop) | 94 | #pragma pack(pop) |
92 | |||
93 | /* x86_64 protocol version */ | 95 | /* x86_64 protocol version */ |
94 | 96 | ||
95 | struct blkif_x86_64_request_rw { | 97 | struct blkif_x86_64_request_rw { |
98 | uint8_t nr_segments; /* number of segments */ | ||
99 | blkif_vdev_t handle; /* only for read/write requests */ | ||
100 | uint32_t _pad1; /* offsetof(blkif_reqest..,u.rw.id)==8 */ | ||
101 | uint64_t id; | ||
96 | blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ | 102 | blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ |
97 | struct blkif_request_segment seg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; | 103 | struct blkif_request_segment seg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; |
98 | }; | 104 | } __attribute__((__packed__)); |
99 | 105 | ||
100 | struct blkif_x86_64_request_discard { | 106 | struct blkif_x86_64_request_discard { |
107 | uint8_t flag; /* BLKIF_DISCARD_SECURE or zero */ | ||
108 | blkif_vdev_t _pad1; /* was "handle" for read/write requests */ | ||
109 | uint32_t _pad2; /* offsetof(blkif_..,u.discard.id)==8 */ | ||
110 | uint64_t id; | ||
101 | blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ | 111 | blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ |
102 | uint64_t nr_sectors; | 112 | uint64_t nr_sectors; |
103 | }; | 113 | } __attribute__((__packed__)); |
104 | 114 | ||
105 | struct blkif_x86_64_request { | 115 | struct blkif_x86_64_request { |
106 | uint8_t operation; /* BLKIF_OP_??? */ | 116 | uint8_t operation; /* BLKIF_OP_??? */ |
107 | uint8_t nr_segments; /* number of segments */ | ||
108 | blkif_vdev_t handle; /* only for read/write requests */ | ||
109 | uint64_t __attribute__((__aligned__(8))) id; | ||
110 | union { | 117 | union { |
111 | struct blkif_x86_64_request_rw rw; | 118 | struct blkif_x86_64_request_rw rw; |
112 | struct blkif_x86_64_request_discard discard; | 119 | struct blkif_x86_64_request_discard discard; |
113 | } u; | 120 | } u; |
114 | }; | 121 | } __attribute__((__packed__)); |
122 | |||
115 | struct blkif_x86_64_response { | 123 | struct blkif_x86_64_response { |
116 | uint64_t __attribute__((__aligned__(8))) id; | 124 | uint64_t __attribute__((__aligned__(8))) id; |
117 | uint8_t operation; /* copied from request */ | 125 | uint8_t operation; /* copied from request */ |
@@ -156,6 +164,7 @@ struct xen_vbd { | |||
156 | /* Cached size parameter. */ | 164 | /* Cached size parameter. */ |
157 | sector_t size; | 165 | sector_t size; |
158 | bool flush_support; | 166 | bool flush_support; |
167 | bool discard_secure; | ||
159 | }; | 168 | }; |
160 | 169 | ||
161 | struct backend_info; | 170 | struct backend_info; |
@@ -237,22 +246,23 @@ static inline void blkif_get_x86_32_req(struct blkif_request *dst, | |||
237 | { | 246 | { |
238 | int i, n = BLKIF_MAX_SEGMENTS_PER_REQUEST; | 247 | int i, n = BLKIF_MAX_SEGMENTS_PER_REQUEST; |
239 | dst->operation = src->operation; | 248 | dst->operation = src->operation; |
240 | dst->nr_segments = src->nr_segments; | ||
241 | dst->handle = src->handle; | ||
242 | dst->id = src->id; | ||
243 | switch (src->operation) { | 249 | switch (src->operation) { |
244 | case BLKIF_OP_READ: | 250 | case BLKIF_OP_READ: |
245 | case BLKIF_OP_WRITE: | 251 | case BLKIF_OP_WRITE: |
246 | case BLKIF_OP_WRITE_BARRIER: | 252 | case BLKIF_OP_WRITE_BARRIER: |
247 | case BLKIF_OP_FLUSH_DISKCACHE: | 253 | case BLKIF_OP_FLUSH_DISKCACHE: |
254 | dst->u.rw.nr_segments = src->u.rw.nr_segments; | ||
255 | dst->u.rw.handle = src->u.rw.handle; | ||
256 | dst->u.rw.id = src->u.rw.id; | ||
248 | dst->u.rw.sector_number = src->u.rw.sector_number; | 257 | dst->u.rw.sector_number = src->u.rw.sector_number; |
249 | barrier(); | 258 | barrier(); |
250 | if (n > dst->nr_segments) | 259 | if (n > dst->u.rw.nr_segments) |
251 | n = dst->nr_segments; | 260 | n = dst->u.rw.nr_segments; |
252 | for (i = 0; i < n; i++) | 261 | for (i = 0; i < n; i++) |
253 | dst->u.rw.seg[i] = src->u.rw.seg[i]; | 262 | dst->u.rw.seg[i] = src->u.rw.seg[i]; |
254 | break; | 263 | break; |
255 | case BLKIF_OP_DISCARD: | 264 | case BLKIF_OP_DISCARD: |
265 | dst->u.discard.flag = src->u.discard.flag; | ||
256 | dst->u.discard.sector_number = src->u.discard.sector_number; | 266 | dst->u.discard.sector_number = src->u.discard.sector_number; |
257 | dst->u.discard.nr_sectors = src->u.discard.nr_sectors; | 267 | dst->u.discard.nr_sectors = src->u.discard.nr_sectors; |
258 | break; | 268 | break; |
@@ -266,22 +276,23 @@ static inline void blkif_get_x86_64_req(struct blkif_request *dst, | |||
266 | { | 276 | { |
267 | int i, n = BLKIF_MAX_SEGMENTS_PER_REQUEST; | 277 | int i, n = BLKIF_MAX_SEGMENTS_PER_REQUEST; |
268 | dst->operation = src->operation; | 278 | dst->operation = src->operation; |
269 | dst->nr_segments = src->nr_segments; | ||
270 | dst->handle = src->handle; | ||
271 | dst->id = src->id; | ||
272 | switch (src->operation) { | 279 | switch (src->operation) { |
273 | case BLKIF_OP_READ: | 280 | case BLKIF_OP_READ: |
274 | case BLKIF_OP_WRITE: | 281 | case BLKIF_OP_WRITE: |
275 | case BLKIF_OP_WRITE_BARRIER: | 282 | case BLKIF_OP_WRITE_BARRIER: |
276 | case BLKIF_OP_FLUSH_DISKCACHE: | 283 | case BLKIF_OP_FLUSH_DISKCACHE: |
284 | dst->u.rw.nr_segments = src->u.rw.nr_segments; | ||
285 | dst->u.rw.handle = src->u.rw.handle; | ||
286 | dst->u.rw.id = src->u.rw.id; | ||
277 | dst->u.rw.sector_number = src->u.rw.sector_number; | 287 | dst->u.rw.sector_number = src->u.rw.sector_number; |
278 | barrier(); | 288 | barrier(); |
279 | if (n > dst->nr_segments) | 289 | if (n > dst->u.rw.nr_segments) |
280 | n = dst->nr_segments; | 290 | n = dst->u.rw.nr_segments; |
281 | for (i = 0; i < n; i++) | 291 | for (i = 0; i < n; i++) |
282 | dst->u.rw.seg[i] = src->u.rw.seg[i]; | 292 | dst->u.rw.seg[i] = src->u.rw.seg[i]; |
283 | break; | 293 | break; |
284 | case BLKIF_OP_DISCARD: | 294 | case BLKIF_OP_DISCARD: |
295 | dst->u.discard.flag = src->u.discard.flag; | ||
285 | dst->u.discard.sector_number = src->u.discard.sector_number; | 296 | dst->u.discard.sector_number = src->u.discard.sector_number; |
286 | dst->u.discard.nr_sectors = src->u.discard.nr_sectors; | 297 | dst->u.discard.nr_sectors = src->u.discard.nr_sectors; |
287 | break; | 298 | break; |
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index 37c794d31264..24a2fb57e5d0 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); |