From: Jaegeuk Kim <jaegeuk@kernel.org>
To: linux-f2fs-devel@lists.sourceforge.net
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Subject: [f2fs-dev] [PATCH] f2fs-tools: use F2FS_BLKSIZE instead of PAGE_*_SIZE
Date: Mon, 8 Aug 2022 15:20:35 -0700 [thread overview]
Message-ID: <20220808222035.1293977-1-jaegeuk@kernel.org> (raw)
We don't need to check the running kernel configuration.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
fsck/mount.c | 6 ------
fsck/xattr.c | 2 +-
fsck/xattr.h | 2 +-
include/f2fs_fs.h | 15 ++++++---------
4 files changed, 8 insertions(+), 17 deletions(-)
diff --git a/fsck/mount.c b/fsck/mount.c
index 584e6d1370ae..e2caac032aa0 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -812,12 +812,6 @@ int sanity_check_raw_super(struct f2fs_super_block *sb, enum SB_ADDR sb_addr)
return -1;
}
- if (F2FS_BLKSIZE != PAGE_CACHE_SIZE) {
- MSG(0, "Invalid page_cache_size (%d), supports only 4KB\n",
- PAGE_CACHE_SIZE);
- return -1;
- }
-
blocksize = 1 << get_sb(log_blocksize);
if (F2FS_BLKSIZE != blocksize) {
MSG(0, "Invalid blocksize (%u), supports only 4KB\n",
diff --git a/fsck/xattr.c b/fsck/xattr.c
index f0c53435e881..8e668730b374 100644
--- a/fsck/xattr.c
+++ b/fsck/xattr.c
@@ -121,7 +121,7 @@ static void write_all_xattrs(struct f2fs_sb_info *sbi,
/* write to xattr node block */
xattr_addr = (void *)xattr_node;
memcpy(xattr_addr, txattr_addr + inline_size,
- PAGE_SIZE - sizeof(struct node_footer));
+ F2FS_BLKSIZE - sizeof(struct node_footer));
ret = dev_write_block(xattr_node, blkaddr);
diff --git a/fsck/xattr.h b/fsck/xattr.h
index 74aa5418cbd3..22ea35ca0a49 100644
--- a/fsck/xattr.h
+++ b/fsck/xattr.h
@@ -132,7 +132,7 @@ static inline int f2fs_acl_count(int size)
!IS_XATTR_LAST_ENTRY(entry); \
entry = XATTR_NEXT_ENTRY(entry))
-#define MIN_OFFSET XATTR_ALIGN(PAGE_SIZE - \
+#define MIN_OFFSET XATTR_ALIGN(F2FS_BLKSIZE - \
sizeof(struct node_footer) - sizeof(__u32))
#define MAX_VALUE_LEN (MIN_OFFSET - \
diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
index 8125e9f8d082..509d75a263e0 100644
--- a/include/f2fs_fs.h
+++ b/include/f2fs_fs.h
@@ -349,10 +349,6 @@ static inline uint64_t bswap_64(uint64_t val)
snprintf(buf, len, #member)
/* these are defined in kernel */
-#ifndef PAGE_SIZE
-#define PAGE_SIZE 4096
-#endif
-#define PAGE_CACHE_SIZE 4096
#define BITS_PER_BYTE 8
#ifndef SECTOR_SHIFT
#define SECTOR_SHIFT 9
@@ -949,9 +945,10 @@ static_assert(sizeof(struct f2fs_extent) == 12, "");
DEFAULT_INLINE_XATTR_ADDRS - \
F2FS_TOTAL_EXTRA_ATTR_SIZE - \
DEF_INLINE_RESERVED_SIZE))
-#define INLINE_DATA_OFFSET (PAGE_CACHE_SIZE - sizeof(struct node_footer) \
- - sizeof(__le32)*(DEF_ADDRS_PER_INODE + 5 - \
- DEF_INLINE_RESERVED_SIZE))
+#define INLINE_DATA_OFFSET (F2FS_BLKSIZE - \
+ sizeof(struct node_footer) - \
+ sizeof(__le32) * (DEF_ADDRS_PER_INODE + \
+ 5 - DEF_INLINE_RESERVED_SIZE))
#define DEF_DIR_LEVEL 0
@@ -1093,7 +1090,7 @@ static_assert(sizeof(struct f2fs_node) == 4096, "");
/*
* For NAT entries
*/
-#define NAT_ENTRY_PER_BLOCK (PAGE_CACHE_SIZE / sizeof(struct f2fs_nat_entry))
+#define NAT_ENTRY_PER_BLOCK (F2FS_BLKSIZE / sizeof(struct f2fs_nat_entry))
#define NAT_BLOCK_OFFSET(start_nid) (start_nid / NAT_ENTRY_PER_BLOCK)
#define DEFAULT_NAT_ENTRY_RATIO 20
@@ -1120,7 +1117,7 @@ static_assert(sizeof(struct f2fs_nat_block) == 4095, "");
* Not allow to change this.
*/
#define SIT_VBLOCK_MAP_SIZE 64
-#define SIT_ENTRY_PER_BLOCK (PAGE_CACHE_SIZE / sizeof(struct f2fs_sit_entry))
+#define SIT_ENTRY_PER_BLOCK (F2FS_BLKSIZE / sizeof(struct f2fs_sit_entry))
/*
* F2FS uses 4 bytes to represent block address. As a result, supported size of
--
2.37.1.559.g78731f0fdb-goog
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
reply other threads:[~2022-08-08 22:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220808222035.1293977-1-jaegeuk@kernel.org \
--to=jaegeuk@kernel.org \
--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).