linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Anand Jain <anand.jain@oracle.com>
Cc: Nikolay Borisov <nborisov@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: reduce return argument of btrfs_chunk_readonly
Date: Thu, 26 Aug 2021 20:10:17 +0200	[thread overview]
Message-ID: <20210826181017.GP3379@twin.jikos.cz> (raw)
In-Reply-To: <249bb6d8-4be1-90b6-1893-c7d0adef1a0b@oracle.com>

On Thu, Aug 12, 2021 at 04:58:30PM +0800, Anand Jain wrote:
> On 11/08/2021 15:15, Nikolay Borisov wrote:
> > On 10.08.21 г. 18:48, Anand Jain wrote:
> >> btrfs_chunk_readonly() checks if the given chunk is writeable. It returns
> >> 1 for readonly, and 0 for writeable. So the return argument type bool
> >> shall suffice instead of the current type int.
> >>
> >> Also, rename btrfs_chunk_readonly() to btrfs_chunk_writeable() as we check
> >> if the bg is writeable, and helps to keep the logic at the parent function
> >> simpler.
> 
> > I don't see how the logic is kept simpler, given that you just invert
> > it.
> 
>   IMO it is simpler to read. No? In btrfs_chunk_readonly(), we consider a
>   chunk is readonly when the device it is on has _no_ DEV_STATE_WRITEABLE
>   flag set.  So rename to btrfs_chunk_writeable() is correct. We also use
>   readonly to the filesystem.

The logic in the function is to check for each stripe if it has
writeable flag and short cuircit if not, and this follows as we're
indeed checking for the writeable status. Further there's a check for
the missing devices that can drop previous witebale status. This all
reads as the the main point is 'writeable' status, so I'm fine with the
rename.

      reply	other threads:[~2021-08-26 18:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210824052742.6E-Km1SWTTGkqvPnsnUECQI3TIDMt6LfxrwXZGZrNE8@z>
2021-08-24  5:27 ` [PATCH RESEND] btrfs: reduce return argument of btrfs_chunk_readonly Anand Jain
2021-08-11  7:15   ` [PATCH] " Nikolay Borisov
2021-08-12  8:58     ` Anand Jain
2021-08-26 18:10       ` David Sterba [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210826181017.GP3379@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=anand.jain@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).