On Mon, Oct 07, 2019 at 06:36:14PM +0300, Nikolay Borisov wrote:
>
>
> On 7.10.19 г. 12:11 ч., Johannes Thumshirn wrote:
> > From: David Sterba <dsterba@xxxxxxxx>
> >
> > Export supported checksum algorithms via sysfs.
> >
> > Co-developed-by: David Sterba <dsterba@xxxxxxxx>
> > Signed-off-by: Johannes Thumshirn <jthumshirn@xxxxxxx>
> > ---
> > fs/btrfs/ctree.c | 5 +++++
> > fs/btrfs/ctree.h | 2 ++
> > fs/btrfs/sysfs.c | 33 +++++++++++++++++++++++++++++++++
> > 3 files changed, 40 insertions(+)
> >
> > diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
> > index b66509ee62eb..5debd74dc61c 100644
> > --- a/fs/btrfs/ctree.c
> > +++ b/fs/btrfs/ctree.c
> > @@ -53,6 +53,11 @@ const char *btrfs_super_csum_name(u16 csum_type)
> > return btrfs_csums[csum_type].name;
> > }
> >
> > +size_t btrfs_get_num_csums(void)
> > +{
> > + return ARRAY_SIZE(btrfs_csums);
> > +}
>
> nit: This function is used only once and the ARRAY_SIZE() macro is
> descriptive enough, why not just remove it and opencoude the call to
> array_size
Agreed, ARRAY_SIZE in loops is fine, it's a compile-time constant.