diff mbox

Apply blk_partition_remap to REQ_OP_ZONE_RESET

Message ID 20161121190011.13259-1-shaun@tancheff.com (mailing list archive)
State New, archived
Headers show

Commit Message

Shaun Tancheff Nov. 21, 2016, 7 p.m. UTC
When a Reset WP is requested from a partition offset the blk_partition_remap
should be applied.

Signed-off-by: Shaun Tancheff <shaun.tancheff@seagate.com>
---
Based on for-4.10/block
---
 block/blk-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Jens Axboe Nov. 21, 2016, 7:11 p.m. UTC | #1
On 11/21/2016 12:00 PM, Shaun Tancheff wrote:
> When a Reset WP is requested from a partition offset the blk_partition_remap
> should be applied.

You need to provide a better explanation in your commit message, and
also put a comment in the code. A good commit message explans WHY
there's a need for the patch.
diff mbox

Patch

diff --git a/block/blk-core.c b/block/blk-core.c
index 473dd69..3f85320 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1786,8 +1786,9 @@  static blk_qc_t blk_queue_bio(struct request_queue *q, struct bio *bio)
 static inline void blk_partition_remap(struct bio *bio)
 {
 	struct block_device *bdev = bio->bi_bdev;
+	bool remap = bio_sectors(bio) != 0 || bio_op(bio) == REQ_OP_ZONE_RESET;
 
-	if (bio_sectors(bio) && bdev != bdev->bd_contains) {
+	if (remap && bdev != bdev->bd_contains) {
 		struct hd_struct *p = bdev->bd_part;
 
 		bio->bi_iter.bi_sector += p->start_sect;