Re: [f2fs-dev] [PATCH] f2fs: introduce f2fs_is_readonly() for readability

From: Eric Biggers
Date: Wed Nov 23 2022 - 13:33:37 EST


On Thu, Nov 24, 2022 at 01:01:53AM +0800, Yangtao Li via Linux-f2fs-devel wrote:
> Introduce f2fs_is_readonly() and use it to simplify code.
>
> Signed-off-by: Yangtao Li <frank.li@xxxxxxxx>
> ---
> fs/f2fs/f2fs.h | 5 +++++
> fs/f2fs/super.c | 5 ++---
> 2 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index f0833638f59e..efc9d6d7b506 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -4576,6 +4576,11 @@ static inline void f2fs_handle_page_eio(struct f2fs_sb_info *sbi, pgoff_t ofs,
> }
> }
>
> +static inline bool f2fs_is_readonly(struct f2fs_sb_info *sbi)
> +{
> + return !!f2fs_sb_has_readonly(sbi) || f2fs_readonly(sbi->sb);
> +}

There is no need for the !! here.

- Eric