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: "dsterba@suse.cz" <dsterba@suse.cz>,
	David Sterba <dsterba@suse.com>,
	"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 2/5] btrfs: add helpers to get inode from page/folio pointers
Date: Wed, 31 Jan 2024 18:19:46 +0100	[thread overview]
Message-ID: <20240131171946.GK31555@twin.jikos.cz> (raw)
In-Reply-To: <ab1e02ee-b1ad-44df-94af-7b788e6a63fa@wdc.com>

On Wed, Jan 31, 2024 at 09:33:58AM +0000, Johannes Thumshirn wrote:
> On 30.01.24 20:29, David Sterba wrote:
> > On Tue, Jan 30, 2024 at 11:42:30AM +0000, Johannes Thumshirn wrote:
> >> On 29.01.24 19:33, David Sterba wrote:
> >>> diff --git a/fs/btrfs/misc.h b/fs/btrfs/misc.h
> >>> index 40f2d9f1a17a..8be09234c575 100644
> >>> --- a/fs/btrfs/misc.h
> >>> +++ b/fs/btrfs/misc.h
> >>> @@ -8,6 +8,9 @@
> >>>    #include <linux/math64.h>
> >>>    #include <linux/rbtree.h>
> >>>    
> >>> +#define page_to_inode(page)	BTRFS_I((page)->mapping->host)
> >>> +#define folio_to_inode(folio)	BTRFS_I((folio)->mapping->host)
> >>> +
> >>
> >> Why are you using a macro instead of an inline function here?
> > 
> > As said in the changelog so we don't have to include headers with full
> > definitions of page, folio, fs_info, ...
> > 
> >> Shouldn't inline function give us a bit more type safety, or are
> >> compilers smart enough nowadays?
> > 
> > Yes type safety would be good but then it can't be an inline without
> > bloating misc.h (and the making include cycles).
> 
> I personally would've put them into fs.h anyways.

Right, that's more suitable, misc.h is for all the non-fs things.

  reply	other threads:[~2024-01-31 17:20 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-29 18:33 [PATCH 0/5] Struct to fs_info helpers David Sterba
2024-01-29 18:33 ` [PATCH 1/5] btrfs: tests: allocate dummy fs_info and root in test_find_delalloc() David Sterba
2024-01-29 18:33 ` [PATCH 2/5] btrfs: add helpers to get inode from page/folio pointers David Sterba
2024-01-30 11:42   ` Johannes Thumshirn
2024-01-30 19:29     ` David Sterba
2024-01-31  9:33       ` Johannes Thumshirn
2024-01-31 17:19         ` David Sterba [this message]
2024-01-29 18:33 ` [PATCH 3/5] btrfs: add helpers to get fs_info " David Sterba
2024-01-30 11:58   ` Johannes Thumshirn
2024-01-30 19:32     ` 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
2024-01-29 18:33 ` [PATCH 5/5] btrfs: hoist fs_info out of loops in end_bbio_data_write and end_bbio_data_read David Sterba
  -- strict thread matches above, loose matches on Subject: below --
2024-02-01 18:02 [PATCH 0/5 v2] Struct to fs_info helpers David Sterba
2024-02-01 18:02 ` [PATCH 2/5] btrfs: add helpers to get inode from page/folio pointers 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=20240131171946.GK31555@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