lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPhsuW7ySGEQtSHg0jxvRRDQWumF7DsVF8fro6MYCc_bY6Ssew@mail.gmail.com>
Date:   Fri, 30 Jun 2023 16:53:57 -0700
From:   Song Liu <song@...nel.org>
To:     linan666@...weicloud.com
Cc:     guoqing.jiang@...ud.ionos.com, colyli@...e.de, xni@...hat.com,
        linux-raid@...r.kernel.org, linux-kernel@...r.kernel.org,
        linan122@...wei.com, yukuai3@...wei.com, yi.zhang@...wei.com,
        houtao1@...wei.com, yangerkun@...wei.com
Subject: Re: [PATCH 2/3] md/raid10: factor out get_rdev_repl_from_mirror()

On Tue, Jun 27, 2023 at 6:58 PM <linan666@...weicloud.com> wrote:
>
[...]

>
> +static void get_rdev_repl_from_mirror(struct raid10_info *mirror,
> +                                struct md_rdev **prdev,
> +                                struct md_rdev **prrdev)
> +{
> +       struct md_rdev *rdev, *rrdev;
> +
> +       rrdev = rcu_dereference(mirror->replacement);
> +       /*
> +        * Read replacement first to prevent reading both rdev and
> +        * replacement as NULL during replacement replace rdev.
> +        */
> +       smp_mb();
> +       rdev = rcu_dereference(mirror->rdev);
> +       if (rdev == rrdev)
> +               rrdev = NULL;
> +
> +       *prrdev = rrdev;
> +       *prdev = rdev;

I don't think the reduction in duplicated code justifies two output arguments.

How about

static struct md_rdev *dereference_rdev_and_rrdev(struct raid10_info *mirror,
                               struct md_rdev **prrdev)
{
    ...
    *prrdev = xxx;
    return rdev;
}

So we only have one argument for output.

Also, "from_mirror" in the function name doesn't really add more value.

Thanks,
Song

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ