Re: [PATCH -next] rbd: Use list_for_each_entry() helper

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

 



On Wed, Aug 30, 2023 at 10:59 AM Jinjie Ruan <ruanjinjie@xxxxxxxxxx> wrote:
>
> Convert list_for_each() to list_for_each_entry() so that the tmp
> list_head pointer and list_entry() call are no longer needed, which
> can reduce a few lines of code. No functional changed.
>
> Signed-off-by: Jinjie Ruan <ruanjinjie@xxxxxxxxxx>
> ---
>  drivers/block/rbd.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 2328cc05be36..3de11f077144 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -7199,7 +7199,6 @@ static void rbd_dev_remove_parent(struct rbd_device *rbd_dev)
>  static ssize_t do_rbd_remove(const char *buf, size_t count)
>  {
>         struct rbd_device *rbd_dev = NULL;
> -       struct list_head *tmp;
>         int dev_id;
>         char opt_buf[6];
>         bool force = false;
> @@ -7226,8 +7225,7 @@ static ssize_t do_rbd_remove(const char *buf, size_t count)
>
>         ret = -ENOENT;
>         spin_lock(&rbd_dev_list_lock);
> -       list_for_each(tmp, &rbd_dev_list) {
> -               rbd_dev = list_entry(tmp, struct rbd_device, node);
> +       list_for_each_entry(rbd_dev, &rbd_dev_list, node) {
>                 if (rbd_dev->dev_id == dev_id) {
>                         ret = 0;
>                         break;
> --
> 2.34.1
>

Applied.

Thanks,

                Ilya




[Index of Archives]     [CEPH Users]     [Ceph Large]     [Ceph Dev]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux