]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
raid5: copy write hint from origin bio to stripe
authorMariusz Dabrowski <mariusz.dabrowski@intel.com>
Thu, 19 Apr 2018 17:28:10 +0000 (19:28 +0200)
committerShaohua Li <shli@fb.com>
Thu, 17 May 2018 16:55:58 +0000 (09:55 -0700)
Store write hint from original bio in stripe head so it can be assigned
to bio sent to each RAID device.

Signed-off-by: Mariusz Dabrowski <mariusz.dabrowski@intel.com>
Reviewed-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Reviewed-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
Signed-off-by: Shaohua Li <shli@fb.com>
drivers/md/raid5.c
drivers/md/raid5.h

index be117d0a65a81c55d2141a8c5646bfd68192d16d..1e1515c817ff0b25bdee7ef8e8a3fb800407599c 100644 (file)
@@ -1139,6 +1139,9 @@ again:
                        bi->bi_io_vec[0].bv_len = STRIPE_SIZE;
                        bi->bi_io_vec[0].bv_offset = 0;
                        bi->bi_iter.bi_size = STRIPE_SIZE;
+                       bi->bi_write_hint = sh->dev[i].write_hint;
+                       if (!rrdev)
+                               sh->dev[i].write_hint = RWF_WRITE_LIFE_NOT_SET;
                        /*
                         * If this is discard request, set bi_vcnt 0. We don't
                         * want to confuse SCSI because SCSI will replace payload
@@ -1190,6 +1193,8 @@ again:
                        rbi->bi_io_vec[0].bv_len = STRIPE_SIZE;
                        rbi->bi_io_vec[0].bv_offset = 0;
                        rbi->bi_iter.bi_size = STRIPE_SIZE;
+                       rbi->bi_write_hint = sh->dev[i].write_hint;
+                       sh->dev[i].write_hint = RWF_WRITE_LIFE_NOT_SET;
                        /*
                         * If this is discard request, set bi_vcnt 0. We don't
                         * want to confuse SCSI because SCSI will replace payload
@@ -3204,6 +3209,7 @@ static int add_stripe_bio(struct stripe_head *sh, struct bio *bi, int dd_idx,
                (unsigned long long)sh->sector);
 
        spin_lock_irq(&sh->stripe_lock);
+       sh->dev[dd_idx].write_hint = bi->bi_write_hint;
        /* Don't allow new IO added to stripes in batch list */
        if (sh->batch_head)
                goto overlap;
index 3f8da26032accce9fdf492b58fc120a94ac31582..aea2447b0ea7efe140c198d4493a6462e6db317a 100644 (file)
@@ -257,6 +257,7 @@ struct stripe_head {
                sector_t        sector;                 /* sector of this page */
                unsigned long   flags;
                u32             log_checksum;
+               unsigned short  write_hint;
        } dev[1]; /* allocated with extra space depending of RAID geometry */
 };