public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Anand Jain <anand.jain@oracle.com>
Cc: Qu Wenruo <quwenruo.btrfs@gmx.com>,
	linux-btrfs@vger.kernel.org, dsterba@suse.cz
Subject: Re: [PATCH 1/4] btrfs: add NO_FS_INFO to btrfs_printk
Date: Wed, 22 Jan 2020 16:50:12 +0100	[thread overview]
Message-ID: <20200122155012.GA3929@twin.jikos.cz> (raw)
In-Reply-To: <6f0db474-905e-02f3-41e4-6cb842d776e3@oracle.com>

On Tue, Jan 14, 2020 at 03:21:14PM +0800, Anand Jain wrote:
> On 14/1/20 2:54 PM, Qu Wenruo wrote:
> > On 2020/1/14 下午2:09, Anand Jain wrote:
> >> The first argument to btrfs_printk() wrappers such as
> >> btrfs_warn_in_rcu(), btrfs_info_in_rcu(), etc.. is fs_info, but in some
> >> context like scan and assembling of the volumes there isn't fs_info yet,
> >> so those code generally don't use the btrfs_printk() wrappers and it
> >> could could still use NULL but then it would become hard to distinguish
> >> whether fs_info is NULL for genuine reason or a bug.
> >>
> >> So introduce a define NO_FS_INFO to be used instead of NULL so that we
> >> know the code where fs_info isn't initialized and also we have a
> >> consistent logging functions. Thanks.
> > 
> > I'm not sure why this is needed.
> > 
> > Could you give me an example in which NULL is not clear enough?
> 
> The first argument in btrfs_info_in_rcu() can be NULL like for example.. 
> btrfs_info_in_rcu(NULL, ..) which then it shall print the prefix..
> 
>     BTRFS info (device <unknown>):
> 
>   Lets say due to some bug local copy of the variable fs_info wasn't 
> initialized then we end up printing the same unknown <unknown>.
> 
>    So in the context of device_list_add() as there is no fs_info 
> genuinely and be different from unknown we use 
> btrfs_info_in_rcu(NO_FS_INFO, ..) to get prefix something like..
> 
>   BTRFS info (device ...):

With the fixup to set fs_info to NULL on a device that's unmounted, do
we still need the NO_FS_INFO stub?  The only difference I can see is a
to print "..." instead of "<unknown>" that I don't find too useful or
improving the output.

My idea about the stub fs info was to avoid any access to fs_info inside
device_list_add in case we can't reliably close the race where scan can
read device::fs_info during mount that sets it up, but as I'm told it's
not a problem anymore.

  parent reply	other threads:[~2020-01-22 15:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-14  6:09 [PATCH 1/4] btrfs: add NO_FS_INFO to btrfs_printk Anand Jain
2020-01-14  6:09 ` [PATCH 2/4] btrfs: stop using uninitiazlised fs_info in device_list_add() Anand Jain
2020-01-14  6:58   ` Qu Wenruo
2020-01-14  7:30     ` Nikolay Borisov
2020-01-14  6:09 ` [PATCH 3/4] btrfs: make the scan logs consistent Anand Jain
2020-01-14  6:09 ` [PATCH 4/4] btrfs: use btrfs consistent logging wrappers Anand Jain
2020-01-14  6:54 ` [PATCH 1/4] btrfs: add NO_FS_INFO to btrfs_printk Qu Wenruo
2020-01-14  7:21   ` Anand Jain
2020-01-14  7:31     ` Nikolay Borisov
2020-01-14  7:33     ` Qu Wenruo
2020-01-22 15:50     ` David Sterba [this message]
2020-01-23  7:22       ` Anand Jain
2020-02-03  4:06         ` Anand Jain

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=20200122155012.GA3929@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=anand.jain@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo.btrfs@gmx.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