From: Alexander Larsson <alexl@redhat.com>
To: Brian Masney <bmasney@redhat.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
gscrivan@redhat.com
Subject: Re: [PATCH 4/6] composefs: Add filesystem implementation
Date: Tue, 10 Jan 2023 17:41:40 +0100 [thread overview]
Message-ID: <b4ab67415708b67a2bd323acb69edf6dd3f3705b.camel@redhat.com> (raw)
In-Reply-To: <Y7gRofheB9EaR4Mi@x1>
On Fri, 2023-01-06 at 07:18 -0500, Brian Masney wrote:
> On Mon, Nov 28, 2022 at 12:17:12PM +0100, Alexander Larsson wrote:
> > This is the basic inode and filesystem implementation.
> >
> > Signed-off-by: Alexander Larsson <alexl@redhat.com>
> > Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
>
> Note: I'm looking at this from the VFS viewpoint since I haven't done
> anything in this subsystem. Just looking for some generic
> suggestions.
>
> >
> > +
> > +struct cfs_inode {
> > + /* must be first for clear in cfs_alloc_inode to work */
> > + struct inode vfs_inode;
>
> [ snip ]
>
> > +static struct inode *cfs_alloc_inode(struct super_block *sb)
> > +{
> > + struct cfs_inode *cino =
> > + alloc_inode_sb(sb, cfs_inode_cachep, GFP_KERNEL);
> > +
> > + if (!cino)
> > + return NULL;
> > +
> > + memset((u8 *)cino + sizeof(struct inode), 0,
> > + sizeof(struct cfs_inode) - sizeof(struct inode));
>
> Why not use container_of() to look up the vfs_inode and then you can
> get
> rid of the restriction of this being first. This may also break with
> structure randomization turned on.
This is not clearing vfs_inode though, it is clearing everything after
vfs_inode, because we're using an allocation cache for the vfs_inode
part. I don't see how container_of can help us here?
Also, surely structure randomization won't change the offset of the
first element of the struct? That will break all sorts of "derived
object" usecases.
>
> > +static inline struct cfs_inode *CFS_I(struct inode *inode)
>
> CFS_I in upper case doesn't match naming conventions in the rest of
> the kernel.
>
It is similar to VFS_I, XFS_I, BTRFS_I, EXT4_I, etc
> > +static unsigned int cfs_split_basedirs(char *str)
> > +{
> > + unsigned int ctr = 1;
> > + char *s, *d;
> > +
> > + for (s = d = str;; s++, d++) {
> > + if (*s == '\\') {
> > + s++;
> > + } else if (*s == ':') {
> > + *d = '\0';
> > + ctr++;
> > + continue;
> > + }
> > + *d = *s;
> > + if (!*s)
> > + break;
> > + }
> > + return ctr;
> > +}
>
> To expand on the comment, this is ovl_split_lowerdirs in
> fs/overlayfs/super.c. It'd be nice if there was a common place where
> this could go.
>
It would be nice, but its not like a huge amount of code duplication,
as it is rather specialized.
>
>
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=-=-=
Alexander Larsson Red Hat,
Inc
alexl@redhat.com alexander.larsson@gmail.com
He's a superhumanly strong neurotic barbarian with no name. She's a
blind
cigar-chomping bounty hunter from a different time and place. They
fight
crime!
next prev parent reply other threads:[~2023-01-10 16:42 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-28 11:13 [PATCH RFC 0/6] Composefs: an opportunistically sharing verified image filesystem Alexander Larsson
2022-11-28 11:13 ` [PATCH 1/6] fsverity: Export fsverity_get_digest Alexander Larsson
2022-11-28 11:16 ` [PATCH 2/6] composefs: Add on-disk layout Alexander Larsson
2023-01-05 15:55 ` Brian Masney
2023-01-10 16:19 ` Alexander Larsson
2022-11-28 11:16 ` [PATCH 3/6] composefs: Add descriptor parsing code Alexander Larsson
2023-01-05 20:02 ` Brian Masney
2023-01-10 16:33 ` Alexander Larsson
2022-11-28 11:17 ` [PATCH 4/6] composefs: Add filesystem implementation Alexander Larsson
2023-01-06 12:18 ` Brian Masney
2023-01-10 16:41 ` Alexander Larsson [this message]
2022-11-28 11:17 ` [PATCH 5/6] composefs: Add documentation Alexander Larsson
2022-11-29 14:08 ` Bagas Sanjaya
2022-11-28 11:17 ` [PATCH 6/6] composefs: Add kconfig and build support Alexander Larsson
2022-11-28 14:16 ` kernel test robot
2022-11-28 17:28 ` kernel test robot
2022-11-29 7:08 ` kernel test robot
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=b4ab67415708b67a2bd323acb69edf6dd3f3705b.camel@redhat.com \
--to=alexl@redhat.com \
--cc=bmasney@redhat.com \
--cc=gscrivan@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@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;
as well as URLs for NNTP newsgroup(s).