Re: [PATCH] md/raid5: use bdev_write_cache instead of open coding it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 9, 2022 at 2:10 AM Christoph Hellwig <hch@xxxxxx> wrote:
>
> Use the bdev_write_cache instead of two equivalent open coded checks.
>
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>

Applied to md-next. Thanks!
Song

> ---
>  drivers/md/raid5-cache.c | 5 +----
>  drivers/md/raid5-ppl.c   | 5 +----
>  2 files changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c
> index 832d8566e1656..4458b551ec4d0 100644
> --- a/drivers/md/raid5-cache.c
> +++ b/drivers/md/raid5-cache.c
> @@ -3061,7 +3061,6 @@ void r5c_update_on_rdev_error(struct mddev *mddev, struct md_rdev *rdev)
>
>  int r5l_init_log(struct r5conf *conf, struct md_rdev *rdev)
>  {
> -       struct request_queue *q = bdev_get_queue(rdev->bdev);
>         struct r5l_log *log;
>         int ret;
>
> @@ -3090,9 +3089,7 @@ int r5l_init_log(struct r5conf *conf, struct md_rdev *rdev)
>         if (!log)
>                 return -ENOMEM;
>         log->rdev = rdev;
> -
> -       log->need_cache_flush = test_bit(QUEUE_FLAG_WC, &q->queue_flags) != 0;
> -
> +       log->need_cache_flush = bdev_write_cache(rdev->bdev);
>         log->uuid_checksum = crc32c_le(~0, rdev->mddev->uuid,
>                                        sizeof(rdev->mddev->uuid));
>
> diff --git a/drivers/md/raid5-ppl.c b/drivers/md/raid5-ppl.c
> index 31b9157bc9ae9..e495939bb3e03 100644
> --- a/drivers/md/raid5-ppl.c
> +++ b/drivers/md/raid5-ppl.c
> @@ -1301,8 +1301,6 @@ static int ppl_validate_rdev(struct md_rdev *rdev)
>
>  static void ppl_init_child_log(struct ppl_log *log, struct md_rdev *rdev)
>  {
> -       struct request_queue *q;
> -
>         if ((rdev->ppl.size << 9) >= (PPL_SPACE_SIZE +
>                                       PPL_HEADER_SIZE) * 2) {
>                 log->use_multippl = true;
> @@ -1316,8 +1314,7 @@ static void ppl_init_child_log(struct ppl_log *log, struct md_rdev *rdev)
>         }
>         log->next_io_sector = rdev->ppl.sector;
>
> -       q = bdev_get_queue(rdev->bdev);
> -       if (test_bit(QUEUE_FLAG_WC, &q->queue_flags))
> +       if (bdev_write_cache(rdev->bdev))
>                 log->wb_cache_on = true;
>  }
>
> --
> 2.30.2
>



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux