public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>
Cc: David Sterba <dsterba@suse.com>,
	"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 4/5] btrfs: add helper to get fs_info from struct inode pointer
Date: Fri, 2 Feb 2024 13:07:22 +0100	[thread overview]
Message-ID: <20240202120722.GY31555@twin.jikos.cz> (raw)
In-Reply-To: <9eab4581-ee07-4e03-a0df-635ae4f30716@wdc.com>

On Fri, Feb 02, 2024 at 11:34:06AM +0000, Johannes Thumshirn wrote:
> On 01.02.24 19:08, David Sterba wrote:
> > diff --git a/fs/btrfs/fs.h b/fs/btrfs/fs.h
> > index ce1bfd9938b1..a8b3a8828162 100644
> > --- a/fs/btrfs/fs.h
> > +++ b/fs/btrfs/fs.h
> > @@ -836,6 +836,9 @@ struct btrfs_fs_info {
> >   #define page_to_fs_info(_page)	 (page_to_inode(_page)->root->fs_info)
> >   #define folio_to_fs_info(_folio) (folio_to_inode(_folio)->root->fs_info)
> >   
> > +#define inode_to_fs_info(_inode) (BTRFS_I(_Generic((_inode),			\
> > +					   struct inode *: (_inode)))->root->fs_info)
> 
> Didn't that trip over a NULL-pointer in the last iteration?

It did in one particular case and it's been fixed. In general
inode->root->fs_info always exists.

  reply	other threads:[~2024-02-02 12:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-01 18:02 [PATCH 0/5 v2] Struct to fs_info helpers David Sterba
2024-02-01 18:02 ` [PATCH 1/5] btrfs: tests: allocate dummy fs_info and root in test_find_delalloc() David Sterba
2024-02-01 18:02 ` [PATCH 2/5] btrfs: add helpers to get inode from page/folio pointers David Sterba
2024-02-01 18:02 ` [PATCH 3/5] btrfs: add helpers to get fs_info " David Sterba
2024-02-01 18:02 ` [PATCH 4/5] btrfs: add helper to get fs_info from struct inode pointer David Sterba
2024-02-02 11:34   ` Johannes Thumshirn
2024-02-02 12:07     ` David Sterba [this message]
2024-02-02 12:09       ` Johannes Thumshirn
2024-02-01 18:02 ` [PATCH 5/5] btrfs: hoist fs_info out of loops in end_bbio_data_write and end_bbio_data_read David Sterba
2024-02-02 12:10 ` [PATCH 0/5 v2] Struct to fs_info helpers Johannes Thumshirn
2024-02-02 12:45 ` Anand Jain
  -- strict thread matches above, loose matches on Subject: below --
2024-01-29 18:33 [PATCH 0/5] " David Sterba
2024-01-29 18:33 ` [PATCH 4/5] btrfs: add helper to get fs_info from struct inode pointer David Sterba
2024-01-30 11:49   ` Johannes Thumshirn
2024-01-30 19:31     ` David Sterba
2024-01-31  7:23   ` David Sterba
2024-01-31  8:43     ` Qu Wenruo
2024-01-31 18:04       ` David Sterba

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=20240202120722.GY31555@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=Johannes.Thumshirn@wdc.com \
    --cc=dsterba@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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