From: Christoph Hellwig <hch@infradead.org>
To: Shan Hai <shan.hai@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH RFC 5/8] xfs: consider the local format inode in misc operations
Date: Sun, 8 Jul 2018 08:51:14 -0700 [thread overview]
Message-ID: <20180708155114.GC8625@infradead.org> (raw)
In-Reply-To: <1530846750-6686-6-git-send-email-shan.hai@oracle.com>
On Fri, Jul 06, 2018 at 11:12:26AM +0800, Shan Hai wrote:
> The local format inode is a legal citizen from now on and consider
> it in misc operations.
This probably wants to go towards the front of the series, and split
into multiple patches with better changelogs for each.
>
> if (unlikely(XFS_TEST_ERROR(
> (XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS &&
> - XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE),
> + XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE &&
> + XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_LOCAL),
This are all the three possible values. It is kinda confusing to read
the checks this way as we alreayd checked for a valid fork type in
the inode read verifies.
Also this seems to be in xfs_bmapi_read, for which reading allowing
inline format forks seems wrong to me.
> - if (!(ifp->if_flags & XFS_IFEXTENTS)) {
> + if (!(ifp->if_flags & (XFS_IFINLINE | XFS_IFEXTENTS))) {
> error = xfs_iread_extents(NULL, ip, whichfork);
> if (error)
> return error;
I think we need to clean this up better. We probably want an
xfs_inode_has_extents helper, or even hide the check inside
xfs_iread_extents itself. Also I wonder if the above is read, the
XFS_IFEXTENTS flag has always meant that we have the current extent list
in memory, which should always be the case for a fork in inline format.
> @@ -5244,11 +5239,18 @@ __xfs_bunmapi(
> ifp = XFS_IFORK_PTR(ip, whichfork);
> if (unlikely(
> XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS &&
> + XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_LOCAL &&
> XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE)) {
> XFS_ERROR_REPORT("xfs_bunmapi", XFS_ERRLEVEL_LOW,
> ip->i_mount);
> return -EFSCORRUPTED;
> }
> +
> + if (XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_LOCAL) {
> + *rlen = 0;
> + return 0;
> + }
I don't think we should ever call bunmapi for an inline format fork.
> };
>
> -
> /*
Spurious whitespace change.
> * This routine is called to map an inode to the buffer containing the on-disk
> * version of the inode. It returns a pointer to the buffer containing the
> @@ -384,12 +383,7 @@ xfs_dinode_verify_fork(
>
> switch (XFS_DFORK_FORMAT(dip, whichfork)) {
> case XFS_DINODE_FMT_LOCAL:
> - /*
> - * no local regular files yet
> - */
> if (whichfork == XFS_DATA_FORK) {
> - if (S_ISREG(be16_to_cpu(dip->di_mode)))
> - return __this_address;
I think you need to check the new feature bit here and only allow the
inline regular case if the feature bit it set.
> @@ -283,7 +283,7 @@ xfs_scrub_dinode(
> xfs_scrub_ino_set_corrupt(sc, ino);
> break;
> case XFS_DINODE_FMT_LOCAL:
> - if (!S_ISDIR(mode) && !S_ISLNK(mode))
> + if (!S_ISREG(mode) && !S_ISDIR(mode) && !S_ISLNK(mode))
> xfs_scrub_ino_set_corrupt(sc, ino);
> break;
Same here.
next prev parent reply other threads:[~2018-07-08 15:51 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-06 3:12 [PATCH RFC 0/8] xfs: introduce inode data inline feature Shan Hai
2018-07-06 3:12 ` [PATCH RFC 1/8] xfs: introduce inline data superblock feature bit Shan Hai
2018-07-06 3:34 ` Darrick J. Wong
2018-07-06 4:06 ` Shan Hai
2018-07-06 3:12 ` [PATCH RFC 2/8] xfs: introduce extents to local conversion helper Shan Hai
2018-07-06 3:45 ` Darrick J. Wong
2018-07-06 4:15 ` Shan Hai
2018-07-08 15:42 ` Christoph Hellwig
2018-07-09 1:58 ` Shan Hai
2018-07-06 3:12 ` [PATCH RFC 3/8] xfs: convert inode from extents to local format Shan Hai
2018-07-06 3:47 ` Darrick J. Wong
2018-07-06 4:24 ` Shan Hai
2018-07-06 3:12 ` [PATCH RFC 4/8] xfs: implement inline data read write code Shan Hai
2018-07-06 3:33 ` Darrick J. Wong
2018-07-06 4:05 ` Shan Hai
2018-07-08 15:45 ` Christoph Hellwig
2018-07-09 2:08 ` Shan Hai
2018-07-06 3:12 ` [PATCH RFC 5/8] xfs: consider the local format inode in misc operations Shan Hai
2018-07-06 3:40 ` Darrick J. Wong
2018-07-06 4:40 ` Shan Hai
2018-07-08 15:51 ` Christoph Hellwig [this message]
2018-07-09 3:06 ` Shan Hai
2018-07-06 3:12 ` [PATCH RFC 6/8] xfs: fix imbalanced locking Shan Hai
2018-07-08 15:53 ` Christoph Hellwig
2018-07-09 3:07 ` Shan Hai
2018-07-06 3:12 ` [PATCH RFC 7/8] xfs: return non-zero blocks for inline data Shan Hai
2018-07-08 15:54 ` Christoph Hellwig
2018-07-11 13:08 ` Carlos Maiolino
2018-07-12 1:03 ` Shan Hai
2018-07-12 1:13 ` Shan Hai
2018-07-12 1:31 ` Darrick J. Wong
2018-07-12 1:46 ` Shan Hai
2018-07-12 9:08 ` Carlos Maiolino
2018-07-12 10:48 ` Shan Hai
2018-07-13 12:39 ` Carlos Maiolino
2018-07-17 13:57 ` Christoph Hellwig
2018-07-18 15:03 ` Carlos Maiolino
2018-07-06 3:12 ` [PATCH RFC 8/8] xfs: skip local format inode for reflinking Shan Hai
2018-07-06 3:26 ` Darrick J. Wong
2018-07-06 3:54 ` Shan Hai
2018-07-08 16:00 ` Christoph Hellwig
2018-07-06 3:12 ` [PATCH RFC 1/1] xfsprogs: add inode inline data support Shan Hai
2018-07-06 3:35 ` Darrick J. Wong
2018-07-06 19:14 ` Eric Sandeen
2018-07-06 3:51 ` [PATCH RFC 0/8] xfs: introduce inode data inline feature Darrick J. Wong
2018-07-06 4:09 ` Shan Hai
2018-07-06 5:42 ` Dave Chinner
2018-07-06 6:39 ` Shan Hai
2018-07-06 7:11 ` Shan Hai
2018-07-08 15:58 ` Christoph Hellwig
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=20180708155114.GC8625@infradead.org \
--to=hch@infradead.org \
--cc=linux-xfs@vger.kernel.org \
--cc=shan.hai@oracle.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).