f2fs-tools: use F2FS_BLKSIZE instead of PAGE_*_SIZE

We don't need to check the running kernel configuration.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
Jaegeuk Kim 2022-08-08 15:18:18 -07:00
parent f09c2b7d4c
commit 6148db344e
4 changed files with 8 additions and 17 deletions

View File

@ -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",

View File

@ -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);

View File

@ -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 - \

View File

@ -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