* [f2fs-dev] [PATCH] f2fs: Restrict max filesize for 16K f2fs
@ 2023-12-02 3:03 Daniel Rosenberg via Linux-f2fs-devel
2023-12-02 3:52 ` Eric Biggers
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Rosenberg via Linux-f2fs-devel @ 2023-12-02 3:03 UTC (permalink / raw)
To: linux-f2fs-devel; +Cc: Jaegeuk Kim, kernel-team, linux-kernel, Daniel Rosenberg
Blocks are tracked by u32, so the max permitted filesize is
U32_MAX * BLOCK_SIZE. Additionally, in order to support crypto block
sizes of 4K with a 16K block size, we must further restrict max filesize
to U32_MAX * 4096. This does not affect 4K blocksize f2fs as the natural
limits for those are well below that limit.
Signed-off-by: Daniel Rosenberg <drosen@google.com>
---
fs/f2fs/super.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 033af907c3b1..7258a8bd6433 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -3364,6 +3364,15 @@ loff_t max_file_blocks(struct inode *inode)
leaf_count *= NIDS_PER_BLOCK;
result += leaf_count;
+ /* For compatibility with 4K crypto unit size, we must restrict
+ * the max filesize to what can fit within U32_MAX 4K units.
+ * Since the blocksize must currently be equal to the page size,
+ * we can grab that from there. inode is NULL when setting up
+ * the superblock.
+ */
+
+ result = min(result, ((loff_t) U32_MAX * 4096) >> PAGE_SHIFT);
+
return result;
}
base-commit: d346fa09abff46988de9267b67b6900d9913d5a2
--
2.43.0.rc2.451.g8631bc7472-goog
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: Restrict max filesize for 16K f2fs
2023-12-02 3:03 [f2fs-dev] [PATCH] f2fs: Restrict max filesize for 16K f2fs Daniel Rosenberg via Linux-f2fs-devel
@ 2023-12-02 3:52 ` Eric Biggers
0 siblings, 0 replies; 2+ messages in thread
From: Eric Biggers @ 2023-12-02 3:52 UTC (permalink / raw)
To: Daniel Rosenberg; +Cc: Jaegeuk Kim, kernel-team, linux-kernel, linux-f2fs-devel
On Fri, Dec 01, 2023 at 07:03:47PM -0800, Daniel Rosenberg via Linux-f2fs-devel wrote:
> + /* For compatibility with 4K crypto unit size, we must restrict
> + * the max filesize to what can fit within U32_MAX 4K units.
> + * Since the blocksize must currently be equal to the page size,
> + * we can grab that from there. inode is NULL when setting up
> + * the superblock.
> + */
> +
> + result = min(result, ((loff_t) U32_MAX * 4096) >> PAGE_SHIFT);
This should be formatted like:
/*
* For compatibility with ...
*/
result = ...
Also, the comment should mention that this is for the IV_INO_LBLK_64 and
IV_INO_LBLK_32 encryption settings. There is no issue with the default
encryption setting.
Also, use F2FS_BLKSIZE_BITS instead of PAGE_SHIFT?
Also, the commit message could use:
Fixes: d7e9a9037de2 ("f2fs: Support Block Size == Page Size")
- Eric
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-12-02 3:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-02 3:03 [f2fs-dev] [PATCH] f2fs: Restrict max filesize for 16K f2fs Daniel Rosenberg via Linux-f2fs-devel
2023-12-02 3:52 ` Eric Biggers
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).