linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Daniel Rosenberg <drosen@google.com>
Cc: kernel-team@android.com, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH v2 4/7] f2fs-tools: Refactor SIT/NAT block structs
Date: Mon, 28 Aug 2023 13:22:07 -0700	[thread overview]
Message-ID: <ZO0B75KPr2u0Z/av@google.com> (raw)
In-Reply-To: <20230825224400.2206278-5-drosen@google.com>

On 08/25, Daniel Rosenberg wrote:
> This converts f2fs_nat_block and f2fs_sit_block to be variable length
> arrays. This does not change the way they are accessed, but removes a
> misleading statment that these sizes are fixed, as opposed to deriving
> from F2FS_BLKSIZE
> 
> Signed-off-by: Daniel Rosenberg <drosen@google.com>
> ---
>  include/f2fs_fs.h | 20 ++++++++++++++------
>  1 file changed, 14 insertions(+), 6 deletions(-)
> 
> diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
> index 13a1c14..b2d479f 100644
> --- a/include/f2fs_fs.h
> +++ b/include/f2fs_fs.h
> @@ -1119,11 +1119,9 @@ struct f2fs_nat_entry {
>  static_assert(sizeof(struct f2fs_nat_entry) == 9, "");
>  
>  struct f2fs_nat_block {
> -	struct f2fs_nat_entry entries[NAT_ENTRY_PER_BLOCK];
> +	struct f2fs_nat_entry entries[0]; /* NAT_ENTRY_PER_BLOCK */
>  };
>  
> -static_assert(sizeof(struct f2fs_nat_block) == F2FS_BLKSIZE - (F2FS_BLKSIZE % 9), "");
> -
>  /*
>   * For SIT entries
>   *
> @@ -1169,12 +1167,14 @@ struct f2fs_sit_entry {
>  
>  static_assert(sizeof(struct f2fs_sit_entry) == 74, "");
>  
> +/*
> + * On disk layout is:
> + * struct f2fs_sit_entry entries[SIT_ENTRY_PER_BLOCK];
> + */
>  struct f2fs_sit_block {
> -	struct f2fs_sit_entry entries[SIT_ENTRY_PER_BLOCK];
> +	struct f2fs_sit_entry entries[0];
>  };
>  
> -static_assert(sizeof(struct f2fs_sit_block) == F2FS_BLKSIZE - (F2FS_BLKSIZE % 74), "");
> -
>  /*
>   * For segment summary
>   *
> @@ -1995,6 +1995,14 @@ static inline void check_block_struct_sizes(void)
>  
>  	/* Check Indirect Block Size */
>  	assert(NIDS_PER_BLOCK * sizeof(__le32) + sizeof(struct node_footer) == F2FS_BLKSIZE);
> +
> +	/* Check NAT Block Size */
> +	assert((NAT_ENTRY_PER_BLOCK + 1) * sizeof(struct f2fs_nat_entry) > F2FS_BLKSIZE);
> +	assert(NAT_ENTRY_PER_BLOCK * sizeof(struct f2fs_nat_entry) <= F2FS_BLKSIZE);
> +
> +	/* Check SIT Block Size */
> +	assert((SIT_ENTRY_PER_BLOCK + 1) * sizeof(struct f2fs_nat_entry) > F2FS_BLKSIZE);

					sizeof(struct f2fs_sit_entry)?

> +	assert(SIT_ENTRY_PER_BLOCK * sizeof(struct f2fs_sit_entry) <= F2FS_BLKSIZE);
>  }
>  
>  #endif	/*__F2FS_FS_H */
> -- 
> 2.42.0.rc2.253.gd59a3bf2b4-goog


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

  reply	other threads:[~2023-08-28 20:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-25 22:43 [f2fs-dev] [PATCH v2 0/7] Add 16K Support for f2fs-tools Daniel Rosenberg via Linux-f2fs-devel
2023-08-25 22:43 ` [f2fs-dev] [PATCH v2 1/7] f2fs-tools: Define constants in terms of BLKSIZE Daniel Rosenberg via Linux-f2fs-devel
2023-08-25 22:43 ` [f2fs-dev] [PATCH v2 2/7] f2fs-tools: Refactor Orphan Block struct Daniel Rosenberg via Linux-f2fs-devel
2023-08-25 22:43 ` [f2fs-dev] [PATCH v2 3/7] f2fs-tools: Refactor f2fs_node struct and friends Daniel Rosenberg via Linux-f2fs-devel
2023-08-25 22:43 ` [f2fs-dev] [PATCH v2 4/7] f2fs-tools: Refactor SIT/NAT block structs Daniel Rosenberg via Linux-f2fs-devel
2023-08-28 20:22   ` Jaegeuk Kim [this message]
2023-08-25 22:43 ` [f2fs-dev] [PATCH v2 5/7] f2fs-tools: Refactor Summary block struct and friends Daniel Rosenberg via Linux-f2fs-devel
2023-08-28 18:07   ` Jaegeuk Kim
2023-08-28 23:14     ` Daniel Rosenberg via Linux-f2fs-devel
2023-08-25 22:43 ` [f2fs-dev] [PATCH v2 6/7] f2fs-tools: Refactor f2fs_dentry_block struct Daniel Rosenberg via Linux-f2fs-devel
2023-08-25 22:44 ` [f2fs-dev] [PATCH v2 7/7] f2fs-tools: Support different block sizes Daniel Rosenberg via Linux-f2fs-devel
2023-08-28 20:27   ` Jaegeuk Kim
2023-08-28 23:18     ` Daniel Rosenberg via Linux-f2fs-devel

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=ZO0B75KPr2u0Z/av@google.com \
    --to=jaegeuk@kernel.org \
    --cc=drosen@google.com \
    --cc=kernel-team@android.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    /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).