linux-fscrypt.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: NeilBrown <neilb@suse.de>
Cc: Goldwyn Rodrigues <rgoldwyn@suse.de>,
	linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org,
	linux-fscrypt@vger.kernel.org, linux-nfs@vger.kernel.org
Subject: Re: [PATCH] fs: reduce pointers while using file_ra_state_init()
Date: Tue, 27 Jul 2021 03:05:36 +0100	[thread overview]
Message-ID: <YP9p8G6eu30+d2jH@casper.infradead.org> (raw)
In-Reply-To: <162733718119.4153.5949006309014161476@noble.neil.brown.name>

On Tue, Jul 27, 2021 at 08:06:21AM +1000, NeilBrown wrote:
> You seem to be assuming that inode->i_mapping->host is always 'inode'.
> That is not the case.

Weeeelllll ... technically, outside of the filesystems that are
changed here, the only assumption in common code that is made is that
inode_to_bdi(inode->i_mapping->host->i_mapping->host) ==
inode_to_bdi(inode)

Looking at inode_to_bdi, that just means that they have the same i_sb.
Which is ... not true for character raw devices?
        if (++raw_devices[minor].inuse == 1)
                file_inode(filp)->i_mapping =
                        bdev->bd_inode->i_mapping;
but then, who's using readahead on a character raw device?  They
force O_DIRECT.  But maybe this should pass inode->i_mapping->host
instead of inode.

> In particular, fs/coda/file.c contains
> 
> 	if (coda_inode->i_mapping == &coda_inode->i_data)
> 		coda_inode->i_mapping = host_inode->i_mapping;
> 
> So a "coda_inode" shares the mapping with a "host_inode".
> 
> This is why an inode has both i_data and i_mapping.
> 
> So I'm not really sure this patch is safe.  It might break codafs.
> 
> But it is more likely that codafs isn't used, doesn't work, should be
> removed, and i_data should be renamed to i_mapping.

I think there's also something unusual going on with either ocfs2
or gfs2.  But yes, I don't understand the rules for when I need to
go from inode->i_mapping->host.

  reply	other threads:[~2021-07-27  2:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-26 16:46 [PATCH] fs: reduce pointers while using file_ra_state_init() Goldwyn Rodrigues
2021-07-26 17:19 ` Matthew Wilcox
2021-07-29 16:08   ` Goldwyn Rodrigues
2021-07-26 22:06 ` NeilBrown
2021-07-27  2:05   ` Matthew Wilcox [this message]
2021-07-27  2:25     ` NeilBrown
2021-07-27  2:46       ` Goldwyn Rodrigues
2021-07-27  3:49         ` NeilBrown
2021-07-29  4:58 ` NeilBrown
2021-07-29 15:19   ` Goldwyn Rodrigues

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=YP9p8G6eu30+d2jH@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fscrypt@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=rgoldwyn@suse.de \
    /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).