From: Daniel Rosenberg via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: linux-f2fs-devel@lists.sourceforge.net
Cc: Jaegeuk Kim <jaegeuk@kernel.org>,
kernel-team@android.com, linux-kernel@vger.kernel.org,
Daniel Rosenberg <drosen@google.com>
Subject: [f2fs-dev] [PATCH] f2fs: Restrict max filesize for 16K f2fs
Date: Fri, 1 Dec 2023 19:03:47 -0800 [thread overview]
Message-ID: <20231202030347.2330936-1-drosen@google.com> (raw)
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
WARNING: multiple messages have this Message-ID (diff)
From: Daniel Rosenberg <drosen@google.com>
To: linux-f2fs-devel@lists.sourceforge.net
Cc: Jaegeuk Kim <jaegeuk@kernel.org>, Chao Yu <chao@kernel.org>,
linux-kernel@vger.kernel.org, kernel-team@android.com,
Daniel Rosenberg <drosen@google.com>
Subject: [PATCH] f2fs: Restrict max filesize for 16K f2fs
Date: Fri, 1 Dec 2023 19:03:47 -0800 [thread overview]
Message-ID: <20231202030347.2330936-1-drosen@google.com> (raw)
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
next reply other threads:[~2023-12-02 3:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-02 3:03 Daniel Rosenberg via Linux-f2fs-devel [this message]
2023-12-02 3:03 ` [PATCH] f2fs: Restrict max filesize for 16K f2fs Daniel Rosenberg
2023-12-02 3:52 ` [f2fs-dev] " Eric Biggers
2023-12-02 3:52 ` Eric Biggers
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=20231202030347.2330936-1-drosen@google.com \
--to=linux-f2fs-devel@lists.sourceforge.net \
--cc=drosen@google.com \
--cc=jaegeuk@kernel.org \
--cc=kernel-team@android.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.