Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Filipe Manana <fdmanana@kernel.org>
To: dsterba@suse.cz, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 09/15] btrfs: shrink the size of struct btrfs_delayed_item
Date: Mon, 22 Aug 2022 15:15:32 +0100	[thread overview]
Message-ID: <20220822141532.GA3129988@falcondesktop> (raw)
In-Reply-To: <20220822134326.GX13489@twin.jikos.cz>

On Mon, Aug 22, 2022 at 03:43:26PM +0200, David Sterba wrote:
> On Wed, Aug 17, 2022 at 12:22:42PM +0100, fdmanana@kernel.org wrote:
> >  	}
> >  
> >  	item->index = index;
> > -	item->ins_or_del = BTRFS_DELAYED_DELETION_ITEM;
> >  
> >  	ret = btrfs_delayed_item_reserve_metadata(trans, item);
> >  	/*
> > diff --git a/fs/btrfs/delayed-inode.h b/fs/btrfs/delayed-inode.h
> > index fd6fe785f748..729d352ca8a1 100644
> > --- a/fs/btrfs/delayed-inode.h
> > +++ b/fs/btrfs/delayed-inode.h
> > @@ -16,9 +16,10 @@
> >  #include <linux/refcount.h>
> >  #include "ctree.h"
> >  
> > -/* types of the delayed item */
> > -#define BTRFS_DELAYED_INSERTION_ITEM	1
> > -#define BTRFS_DELAYED_DELETION_ITEM	2
> > +enum btrfs_delayed_item_type {
> > +	BTRFS_DELAYED_INSERTION_ITEM,
> > +	BTRFS_DELAYED_DELETION_ITEM
> > +};
> >  
> >  struct btrfs_delayed_root {
> >  	spinlock_t lock;
> > @@ -80,8 +81,9 @@ struct btrfs_delayed_item {
> >  	u64 bytes_reserved;
> >  	struct btrfs_delayed_node *delayed_node;
> >  	refcount_t refs;
> > -	int ins_or_del;
> > -	u32 data_len;
> > +	enum btrfs_delayed_item_type type:1;
> 
> Bit fields next to atomicly accessed variables could be problemantic on
> architectures without safe unaligned access. Either this can be :8 or
> moved after 'key' where's a 7 byte hole.

Yep, I forgot that.

The 'key' doesn't exist anymore, it was removed in a previous patch of
the series, so the 7 bytes holes is not there anymore.

I don't see any other place in the structure where I can move the fields
and still reduce its size. If switching from :1 to :8 is enough to
guarantee safety, I guess it's the only solution.

Do you me to send a new version just to switch :1 to :8 or will you do
that change?

Thanks.

  reply	other threads:[~2022-08-22 14:16 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-17 11:22 [PATCH 00/15] btrfs: some updates to delayed items and inode logging fdmanana
2022-08-17 11:22 ` [PATCH 01/15] btrfs: don't drop dir index range items when logging a directory fdmanana
2022-08-17 11:22 ` [PATCH 02/15] btrfs: remove the root argument from log_new_dir_dentries() fdmanana
2022-08-17 11:22 ` [PATCH 03/15] btrfs: update stale comment for log_new_dir_dentries() fdmanana
2022-08-17 11:22 ` [PATCH 04/15] btrfs: free list element sooner at log_new_dir_dentries() fdmanana
2022-08-17 11:22 ` [PATCH 05/15] btrfs: avoid memory allocation at log_new_dir_dentries() for common case fdmanana
2022-08-17 11:22 ` [PATCH 06/15] btrfs: remove root argument from btrfs_delayed_item_reserve_metadata() fdmanana
2022-08-17 11:22 ` [PATCH 07/15] btrfs: store index number instead of key in struct btrfs_delayed_item fdmanana
2022-08-17 11:22 ` [PATCH 08/15] btrfs: remove unused logic when looking up delayed items fdmanana
2022-08-17 11:22 ` [PATCH 09/15] btrfs: shrink the size of struct btrfs_delayed_item fdmanana
2022-08-22 13:43   ` David Sterba
2022-08-22 14:15     ` Filipe Manana [this message]
2022-08-22 15:29       ` David Sterba
2022-08-22 16:00         ` Filipe Manana
2022-08-17 11:22 ` [PATCH 10/15] btrfs: search for last logged dir index if it's not cached in the inode fdmanana
2022-08-17 11:22 ` [PATCH 11/15] btrfs: move need_log_inode() to above log_conflicting_inodes() fdmanana
2022-08-17 11:22 ` [PATCH 12/15] btrfs: move log_new_dir_dentries() above btrfs_log_inode() fdmanana
2022-08-17 11:22 ` [PATCH 13/15] btrfs: log conflicting inodes without holding log mutex of the initial inode fdmanana
2022-08-17 11:22 ` [PATCH 14/15] btrfs: skip logging parent dir when conflicting inode is not a dir fdmanana
2022-08-17 11:22 ` [PATCH 15/15] btrfs: use delayed items when logging a directory fdmanana
2022-08-22 10:51 ` [PATCH v2 00/15] btrfs: some updates to delayed items and inode logging fdmanana
2022-08-22 10:51   ` [PATCH v2 01/15] btrfs: don't drop dir index range items when logging a directory fdmanana
2022-08-22 10:51   ` [PATCH v2 02/15] btrfs: remove the root argument from log_new_dir_dentries() fdmanana
2022-08-22 10:51   ` [PATCH v2 03/15] btrfs: update stale comment for log_new_dir_dentries() fdmanana
2022-08-22 10:51   ` [PATCH v2 04/15] btrfs: free list element sooner at log_new_dir_dentries() fdmanana
2022-08-22 10:51   ` [PATCH v2 05/15] btrfs: avoid memory allocation at log_new_dir_dentries() for common case fdmanana
2022-08-22 10:51   ` [PATCH v2 06/15] btrfs: remove root argument from btrfs_delayed_item_reserve_metadata() fdmanana
2022-08-22 10:51   ` [PATCH v2 07/15] btrfs: store index number instead of key in struct btrfs_delayed_item fdmanana
2022-08-22 10:51   ` [PATCH v2 08/15] btrfs: remove unused logic when looking up delayed items fdmanana
2022-08-22 10:51   ` [PATCH v2 09/15] btrfs: shrink the size of struct btrfs_delayed_item fdmanana
2022-08-22 10:51   ` [PATCH v2 10/15] btrfs: search for last logged dir index if it's not cached in the inode fdmanana
2022-08-22 10:51   ` [PATCH v2 11/15] btrfs: move need_log_inode() to above log_conflicting_inodes() fdmanana
2022-08-22 10:51   ` [PATCH v2 12/15] btrfs: move log_new_dir_dentries() above btrfs_log_inode() fdmanana
2022-08-22 10:51   ` [PATCH v2 13/15] btrfs: log conflicting inodes without holding log mutex of the initial inode fdmanana
2022-08-22 10:51   ` [PATCH v2 14/15] btrfs: skip logging parent dir when conflicting inode is not a dir fdmanana
2022-08-22 10:51   ` [PATCH v2 15/15] btrfs: use delayed items when logging a directory fdmanana
2022-08-22 15:45   ` [PATCH v2 00/15] btrfs: some updates to delayed items and inode logging 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=20220822141532.GA3129988@falcondesktop \
    --to=fdmanana@kernel.org \
    --cc=dsterba@suse.cz \
    --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