mbox series

[v2,00/16] btrfs: inode creation cleanups and fixes

Message ID cover.1646875648.git.osandov@fb.com (mailing list archive)
Headers show
Series btrfs: inode creation cleanups and fixes | expand

Message

Omar Sandoval March 10, 2022, 1:31 a.m. UTC
From: Omar Sandoval <osandov@fb.com>

This series contains several cleanups and fixes for our inode creation
codepaths. The main motivation for this is preparation for fscrypt
support (in particular, setting up the fscrypt context and encrypted
names at inode creation time). But, it also reduces a lot of code
duplication and fixes some minor bugs, so it's worth getting in ahead of
time.

Patches 1-3 are small fixes. Patches 5-12 are small cleanups. Patches
13-16 are the bulk of the change.

Based on misc-next.

Changes since v1 [1]:

- Split the big final patch into patches 3 and 13-16.
- Added Sweet Tea's reviewed-by to the remaining patches.
- Rebased on latest misc-next.

Thanks!

1: https://lore.kernel.org/linux-btrfs/cover.1646348486.git.osandov@fb.com/

Omar Sandoval (16):
  btrfs: reserve correct number of items for unlink and rmdir
  btrfs: reserve correct number of items for rename
  btrfs: fix anon_dev leak in create_subvol()
  btrfs: get rid of btrfs_add_nondir()
  btrfs: remove unnecessary btrfs_i_size_write(0) calls
  btrfs: remove unnecessary inode_set_bytes(0) call
  btrfs: remove unnecessary set_nlink() in btrfs_create_subvol_root()
  btrfs: remove unused mnt_userns parameter from __btrfs_set_acl
  btrfs: remove redundant name and name_len parameters to create_subvol
  btrfs: don't pass parent objectid to btrfs_new_inode() explicitly
  btrfs: move btrfs_get_free_objectid() call into btrfs_new_inode()
  btrfs: set inode flags earlier in btrfs_new_inode()
  btrfs: allocate inode outside of btrfs_new_inode()
  btrfs: factor out common part of btrfs_{mknod,create,mkdir}()
  btrfs: reserve correct number of items for inode creation
  btrfs: move common inode creation code into btrfs_create_new_inode()

 fs/btrfs/acl.c   |  39 +-
 fs/btrfs/ctree.h |  37 +-
 fs/btrfs/inode.c | 942 +++++++++++++++++++++++------------------------
 fs/btrfs/ioctl.c | 176 ++++-----
 fs/btrfs/props.c |  40 +-
 fs/btrfs/props.h |   4 -
 6 files changed, 579 insertions(+), 659 deletions(-)

Comments

David Sterba March 14, 2022, 12:50 p.m. UTC | #1
On Wed, Mar 09, 2022 at 05:31:30PM -0800, Omar Sandoval wrote:
> From: Omar Sandoval <osandov@fb.com>
> 
> This series contains several cleanups and fixes for our inode creation
> codepaths. The main motivation for this is preparation for fscrypt
> support (in particular, setting up the fscrypt context and encrypted
> names at inode creation time). But, it also reduces a lot of code
> duplication and fixes some minor bugs, so it's worth getting in ahead of
> time.
> 
> Patches 1-3 are small fixes. Patches 5-12 are small cleanups. Patches
> 13-16 are the bulk of the change.
> 
> Based on misc-next.
> 
> Changes since v1 [1]:
> 
> - Split the big final patch into patches 3 and 13-16.
> - Added Sweet Tea's reviewed-by to the remaining patches.
> - Rebased on latest misc-next.
> 
> Thanks!
> 
> 1: https://lore.kernel.org/linux-btrfs/cover.1646348486.git.osandov@fb.com/
> 
> Omar Sandoval (16):
>   btrfs: reserve correct number of items for unlink and rmdir
>   btrfs: reserve correct number of items for rename
>   btrfs: fix anon_dev leak in create_subvol()
>   btrfs: get rid of btrfs_add_nondir()
>   btrfs: remove unnecessary btrfs_i_size_write(0) calls
>   btrfs: remove unnecessary inode_set_bytes(0) call
>   btrfs: remove unnecessary set_nlink() in btrfs_create_subvol_root()
>   btrfs: remove unused mnt_userns parameter from __btrfs_set_acl
>   btrfs: remove redundant name and name_len parameters to create_subvol
>   btrfs: don't pass parent objectid to btrfs_new_inode() explicitly
>   btrfs: move btrfs_get_free_objectid() call into btrfs_new_inode()
>   btrfs: set inode flags earlier in btrfs_new_inode()
>   btrfs: allocate inode outside of btrfs_new_inode()

Patches 1-13 added to misc-next. The remaining patches seem to be still
a bit big for review.

>   btrfs: factor out common part of btrfs_{mknod,create,mkdir}()
>   btrfs: reserve correct number of items for inode creation
>   btrfs: move common inode creation code into btrfs_create_new_inode()
> 
>  fs/btrfs/acl.c   |  39 +-
>  fs/btrfs/ctree.h |  37 +-
>  fs/btrfs/inode.c | 942 +++++++++++++++++++++++------------------------
>  fs/btrfs/ioctl.c | 176 ++++-----
>  fs/btrfs/props.c |  40 +-
>  fs/btrfs/props.h |   4 -
>  6 files changed, 579 insertions(+), 659 deletions(-)
> 
> -- 
> 2.35.1
Omar Sandoval March 14, 2022, 6:42 p.m. UTC | #2
On Mon, Mar 14, 2022 at 01:50:59PM +0100, David Sterba wrote:
> On Wed, Mar 09, 2022 at 05:31:30PM -0800, Omar Sandoval wrote:
> > From: Omar Sandoval <osandov@fb.com>
> > 
> > This series contains several cleanups and fixes for our inode creation
> > codepaths. The main motivation for this is preparation for fscrypt
> > support (in particular, setting up the fscrypt context and encrypted
> > names at inode creation time). But, it also reduces a lot of code
> > duplication and fixes some minor bugs, so it's worth getting in ahead of
> > time.
> > 
> > Patches 1-3 are small fixes. Patches 5-12 are small cleanups. Patches
> > 13-16 are the bulk of the change.
> > 
> > Based on misc-next.
> > 
> > Changes since v1 [1]:
> > 
> > - Split the big final patch into patches 3 and 13-16.
> > - Added Sweet Tea's reviewed-by to the remaining patches.
> > - Rebased on latest misc-next.
> > 
> > Thanks!
> > 
> > 1: https://lore.kernel.org/linux-btrfs/cover.1646348486.git.osandov@fb.com/
> > 
> > Omar Sandoval (16):
> >   btrfs: reserve correct number of items for unlink and rmdir
> >   btrfs: reserve correct number of items for rename
> >   btrfs: fix anon_dev leak in create_subvol()
> >   btrfs: get rid of btrfs_add_nondir()
> >   btrfs: remove unnecessary btrfs_i_size_write(0) calls
> >   btrfs: remove unnecessary inode_set_bytes(0) call
> >   btrfs: remove unnecessary set_nlink() in btrfs_create_subvol_root()
> >   btrfs: remove unused mnt_userns parameter from __btrfs_set_acl
> >   btrfs: remove redundant name and name_len parameters to create_subvol
> >   btrfs: don't pass parent objectid to btrfs_new_inode() explicitly
> >   btrfs: move btrfs_get_free_objectid() call into btrfs_new_inode()
> >   btrfs: set inode flags earlier in btrfs_new_inode()
> >   btrfs: allocate inode outside of btrfs_new_inode()
> 
> Patches 1-13 added to misc-next. The remaining patches seem to be still
> a bit big for review.

I see that misc-next has the whole series, did you change your mind? I
was going to resend with a couple of Sweet Tea's comments addressed
(passing btrfs_new_inode_args to btrfs_init_inode_security() and
mentioning the d_instantiate() change in the commit message for patch
13), but I don't see a good way to split these up further.
David Sterba March 14, 2022, 7:27 p.m. UTC | #3
On Mon, Mar 14, 2022 at 11:42:17AM -0700, Omar Sandoval wrote:
> On Mon, Mar 14, 2022 at 01:50:59PM +0100, David Sterba wrote:
> > On Wed, Mar 09, 2022 at 05:31:30PM -0800, Omar Sandoval wrote:
> > > - Added Sweet Tea's reviewed-by to the remaining patches.
> > > - Rebased on latest misc-next.
> > > 
> > > Thanks!
> > > 
> > > 1: https://lore.kernel.org/linux-btrfs/cover.1646348486.git.osandov@fb.com/
> > > 
> > > Omar Sandoval (16):
> > >   btrfs: reserve correct number of items for unlink and rmdir
> > >   btrfs: reserve correct number of items for rename
> > >   btrfs: fix anon_dev leak in create_subvol()
> > >   btrfs: get rid of btrfs_add_nondir()
> > >   btrfs: remove unnecessary btrfs_i_size_write(0) calls
> > >   btrfs: remove unnecessary inode_set_bytes(0) call
> > >   btrfs: remove unnecessary set_nlink() in btrfs_create_subvol_root()
> > >   btrfs: remove unused mnt_userns parameter from __btrfs_set_acl
> > >   btrfs: remove redundant name and name_len parameters to create_subvol
> > >   btrfs: don't pass parent objectid to btrfs_new_inode() explicitly
> > >   btrfs: move btrfs_get_free_objectid() call into btrfs_new_inode()
> > >   btrfs: set inode flags earlier in btrfs_new_inode()
> > >   btrfs: allocate inode outside of btrfs_new_inode()
> > 
> > Patches 1-13 added to misc-next. The remaining patches seem to be still
> > a bit big for review.
> 
> I see that misc-next has the whole series, did you change your mind? I

I added the branch to misc-next on friday and noticed some comments for
the the patches at the end, so I removed them again.
Omar Sandoval March 14, 2022, 7:55 p.m. UTC | #4
On Mon, Mar 14, 2022 at 08:27:03PM +0100, David Sterba wrote:
> On Mon, Mar 14, 2022 at 11:42:17AM -0700, Omar Sandoval wrote:
> > On Mon, Mar 14, 2022 at 01:50:59PM +0100, David Sterba wrote:
> > > On Wed, Mar 09, 2022 at 05:31:30PM -0800, Omar Sandoval wrote:
> > > > - Added Sweet Tea's reviewed-by to the remaining patches.
> > > > - Rebased on latest misc-next.
> > > > 
> > > > Thanks!
> > > > 
> > > > 1: https://lore.kernel.org/linux-btrfs/cover.1646348486.git.osandov@fb.com/
> > > > 
> > > > Omar Sandoval (16):
> > > >   btrfs: reserve correct number of items for unlink and rmdir
> > > >   btrfs: reserve correct number of items for rename
> > > >   btrfs: fix anon_dev leak in create_subvol()
> > > >   btrfs: get rid of btrfs_add_nondir()
> > > >   btrfs: remove unnecessary btrfs_i_size_write(0) calls
> > > >   btrfs: remove unnecessary inode_set_bytes(0) call
> > > >   btrfs: remove unnecessary set_nlink() in btrfs_create_subvol_root()
> > > >   btrfs: remove unused mnt_userns parameter from __btrfs_set_acl
> > > >   btrfs: remove redundant name and name_len parameters to create_subvol
> > > >   btrfs: don't pass parent objectid to btrfs_new_inode() explicitly
> > > >   btrfs: move btrfs_get_free_objectid() call into btrfs_new_inode()
> > > >   btrfs: set inode flags earlier in btrfs_new_inode()
> > > >   btrfs: allocate inode outside of btrfs_new_inode()
> > > 
> > > Patches 1-13 added to misc-next. The remaining patches seem to be still
> > > a bit big for review.
> > 
> > I see that misc-next has the whole series, did you change your mind? I
> 
> I added the branch to misc-next on friday and noticed some comments for
> the the patches at the end, so I removed them again.

I see. I'll resend 13-16 with the updates.