f2fs-tools: use F2FS_BLKSIZE by default
PATCH 1/2 f2fs-tools: use F2FS_BLKSIZE by default
No need to do
Signed-off-by Jaegeuk Kim <[email protected]>
--- fsck/defrag.c | 2 +- fsck/dir.c | 18 +++++++++--------- fsck/dump.c | 20 ++++++++++---------- fsck/fsck.c | 24 ++++++++++++------------ fsck/fsck.h | 2 -- fsck/mkquota.c | 2 +- fsck/mount.c | 24 ++++++++++++------------ fsck/node.c | 4 ++-- fsck/node.h | 2 +- fsck/resize.c | 26 +++++++++++++------------- fsck/segment.c | 48 ++++++++++++++++++++++++------------------------ fsck/xattr.c | 6 +++--- 12 files changed, 88 insertions(+), 90 deletions(-)
fsck/defrag.c +1 -1
@@ -11,7 +11,7 @@static int migrate_block (struct f2fs_sb_info *sbi,u64 from,u64 to) { -void *raw =calloc (BLOCK_SZ ,1 ); +void *raw =calloc (F2FS_BLKSIZE ,1 );struct seg_entry *se;struct f2fs_summary sum;u64 offset;
fsck/dir.c +9 -9
@@ -130,7 +130,7 @@ static int find_in_level(struct f2fs_sb_info *sbi, struct f2fs_node *dir, bidx =dir_block_index (level, dir_level,le32_to_cpu (namehash) % nbucket); end_block = bidx + nblock; - dentry_blk =calloc (BLOCK_SZ ,1 ); + dentry_blk =calloc (F2FS_BLKSIZE ,1 );ASSERT (dentry_blk);memset (&dn,0 ,sizeof (dn));
@@ -247,7 +247,7 @@ int f2fs_add_link(struct f2fs_sb_info *sbi, struct f2fs_node *parent,return -EINVAL ; } - dentry_blk =calloc (BLOCK_SZ ,1 ); + dentry_blk =calloc (F2FS_BLKSIZE ,1 );ASSERT (dentry_blk); current_depth =le32_to_cpu (parent->i.i_current_depth);
@@ -349,7 +349,7 @@ static void make_empty_dir(struct f2fs_sb_info *sbi, struct f2fs_node *inode)get_node_info (sbi, ino, &ni); - dent_blk =calloc (BLOCK_SZ ,1 ); + dent_blk =calloc (F2FS_BLKSIZE ,1 );ASSERT (dent_blk);F2FS_DENTRY_BLOCK_DENTRY (dent_blk,0 ).hash_code =0 ;
@@ -398,7 +398,7 @@ static void page_symlink(struct f2fs_sb_info *sbi, struct f2fs_node *inode,return ; } - data_blk =calloc (BLOCK_SZ ,1 ); + data_blk =calloc (F2FS_BLKSIZE ,1 );ASSERT (data_blk);memcpy (data_blk, symname, symlen);
@@ -578,7 +578,7 @@ int convert_inline_dentry(struct f2fs_sb_info *sbi, struct f2fs_node *node,struct f2fs_dentry_block *dentry_blk;struct f2fs_dentry_ptr src, dst; - dentry_blk =calloc (BLOCK_SZ ,1 ); + dentry_blk =calloc (F2FS_BLKSIZE ,1 );ASSERT (dentry_blk);set_new_dnode (&dn, node,NULL , ino);
@@ -698,7 +698,7 @@ int f2fs_create(struct f2fs_sb_info *sbi, struct dentry *de)if (de->from_devino) found_hardlink =f2fs_search_hardlink (sbi, de); - parent =calloc (BLOCK_SZ ,1 ); + parent =calloc (F2FS_BLKSIZE ,1 );ASSERT (parent); ret =dev_read_block (parent, ni.blk_addr);
@@ -722,7 +722,7 @@ int f2fs_create(struct f2fs_sb_info *sbi, struct dentry *de) goto free_parent_dir; } - child =calloc (BLOCK_SZ ,1 ); + child =calloc (F2FS_BLKSIZE ,1 );ASSERT (child);if (found_hardlink && found_hardlink->to_ino) {
@@ -770,7 +770,7 @@ int f2fs_create(struct f2fs_sb_info *sbi, struct dentry *de)/* Replace child with original block */ free (child); - child =calloc (BLOCK_SZ ,1 ); + child =calloc (F2FS_BLKSIZE ,1 );ASSERT (child); ret =dev_read_block (child, blkaddr);
@@ -838,7 +838,7 @@ int f2fs_find_path(struct f2fs_sb_info *sbi, char *path, nid_t *ino)return -ENOENT ; *ino =F2FS_ROOT_INO (sbi); - parent =calloc (BLOCK_SZ ,1 ); + parent =calloc (F2FS_BLKSIZE ,1 );ASSERT (parent); p =strtok (path,"/" );
fsck/dump.c +10 -10
@@ -43,9 +43,9 @@ void nat_dump(struct f2fs_sb_info *sbi, nid_t start_nat, nid_t end_nat)char buf[BUF_SZ ];int fd, ret, pack; - nat_block = (struct f2fs_nat_block *)calloc (BLOCK_SZ ,1 ); + nat_block = (struct f2fs_nat_block *)calloc (F2FS_BLKSIZE ,1 );ASSERT (nat_block); - node_block = (struct f2fs_node *)calloc (BLOCK_SZ ,1 ); + node_block = (struct f2fs_node *)calloc (F2FS_BLKSIZE ,1 );ASSERT (node_block); fd =open ("dump_nat" ,O_CREAT |O_WRONLY |O_TRUNC ,0666 );
@@ -321,7 +321,7 @@ static void dump_node_blk(struct f2fs_sb_info *sbi, int ntype,get_node_info (sbi, nid, &ni); - node_blk =calloc (BLOCK_SZ ,1 ); + node_blk =calloc (F2FS_BLKSIZE ,1 );ASSERT (node_blk);dev_read_block (node_blk, ni.blk_addr);
@@ -558,7 +558,7 @@ void dump_node_scan_disk(struct f2fs_sb_info *sbi, nid_t nid)pgoff_t end_blkaddr = start_blkaddr + (SM_I (sbi)->main_segments << sbi->log_blocks_per_seg); - node_blk =calloc (BLOCK_SZ ,1 ); + node_blk =calloc (F2FS_BLKSIZE ,1 );ASSERT (node_blk);MSG (0 ,"Info: scan all nid: %u from block_addr [%lu: %lu]\n" , nid, start_blkaddr, end_blkaddr);
@@ -590,7 +590,7 @@ int dump_node(struct f2fs_sb_info *sbi, nid_t nid, int force)get_node_info (sbi, nid, &ni); - node_blk =calloc (BLOCK_SZ ,1 ); + node_blk =calloc (F2FS_BLKSIZE ,1 );ASSERT (node_blk);DBG (1 ,"Node ID [0x%x]\n" , nid);
@@ -632,7 +632,7 @@ static void dump_node_from_blkaddr(struct f2fs_sb_info *sbi, u32 blk_addr)struct f2fs_node *node_blk;int ret; - node_blk =calloc (BLOCK_SZ ,1 ); + node_blk =calloc (F2FS_BLKSIZE ,1 );ASSERT (node_blk); ret =dev_read_block (node_blk, blk_addr);
@@ -675,7 +675,7 @@ static void dump_data_offset(u32 blk_addr, int ofs_in_node)unsigned int node_ofs;int ret; - node_blk =calloc (BLOCK_SZ ,1 ); + node_blk =calloc (F2FS_BLKSIZE ,1 );ASSERT (node_blk); ret =dev_read_block (node_blk, blk_addr);
@@ -697,7 +697,7 @@ static void dump_node_offset(u32 blk_addr)struct f2fs_node *node_blk;int ret; - node_blk =calloc (BLOCK_SZ ,1 ); + node_blk =calloc (F2FS_BLKSIZE ,1 );ASSERT (node_blk); ret =dev_read_block (node_blk, blk_addr);
@@ -712,7 +712,7 @@ static int has_dirent(u32 blk_addr, int is_inline, int *enc_name)struct f2fs_node *node_blk;int ret, is_dentry =0 ; - node_blk =calloc (BLOCK_SZ ,1 ); + node_blk =calloc (F2FS_BLKSIZE ,1 );ASSERT (node_blk); ret =dev_read_block (node_blk, blk_addr);
@@ -737,7 +737,7 @@ static void dump_dirent(u32 blk_addr, int is_inline, int enc_name)void *inline_dentry, *blk;int ret, i =0 ; - blk =calloc (BLOCK_SZ ,1 ); + blk =calloc (F2FS_BLKSIZE ,1 );ASSERT (blk); ret =dev_read_block (blk, blk_addr);
fsck/fsck.c +12 -12
@@ -236,7 +236,7 @@ static int is_valid_summary(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,struct node_info ni;int ret =0 ; - node_blk = (struct f2fs_node *)calloc (BLOCK_SZ ,1 ); + node_blk = (struct f2fs_node *)calloc (F2FS_BLKSIZE ,1 );ASSERT (node_blk !=NULL );if (!IS_VALID_NID (sbi, nid))
@@ -545,7 +545,7 @@ int fsck_sanity_check_nid(struct f2fs_sb_info *sbi, u32 nid,struct node_info ni;int ret; - node_blk = (struct f2fs_node *)calloc (BLOCK_SZ ,1 ); + node_blk = (struct f2fs_node *)calloc (F2FS_BLKSIZE ,1 );ASSERT (node_blk !=NULL ); ret =sanity_check_nid (sbi, nid, node_blk, ftype, ntype, &ni);
@@ -564,7 +564,7 @@ static int fsck_chk_xattr_blk(struct f2fs_sb_info *sbi, u32 ino,if (x_nid ==0x0 )return 0 ; - node_blk = (struct f2fs_node *)calloc (BLOCK_SZ ,1 ); + node_blk = (struct f2fs_node *)calloc (F2FS_BLKSIZE ,1 );ASSERT (node_blk !=NULL );/* Sanity check */
@@ -590,7 +590,7 @@ int fsck_chk_node_blk(struct f2fs_sb_info *sbi, struct f2fs_inode *inode,struct node_info ni;struct f2fs_node *node_blk =NULL ; - node_blk = (struct f2fs_node *)calloc (BLOCK_SZ ,1 ); + node_blk = (struct f2fs_node *)calloc (F2FS_BLKSIZE ,1 );ASSERT (node_blk !=NULL );if (sanity_check_nid (sbi, nid, node_blk, ftype, ntype, &ni))
@@ -657,7 +657,7 @@ int fsck_chk_root_inode(struct f2fs_sb_info *sbi)u32 last_ctime_nsec =0 ;int ret = -EINVAL ; - node_blk =calloc (BLOCK_SZ ,1 ); + node_blk =calloc (F2FS_BLKSIZE ,1 );ASSERT (node_blk);MSG (0 ,"Info: root inode is corrupted, search and relink it\n" );
@@ -2013,7 +2013,7 @@ int fsck_chk_dentry_blk(struct f2fs_sb_info *sbi, int casefolded, u32 blk_addr,struct f2fs_dentry *new_dentry;int dentries, ret; - de_blk = (struct f2fs_dentry_block *)calloc (BLOCK_SZ ,1 ); + de_blk = (struct f2fs_dentry_block *)calloc (F2FS_BLKSIZE ,1 );ASSERT (de_blk !=NULL ); ret =dev_read_block (de_blk, blk_addr);
@@ -2113,10 +2113,10 @@ int fsck_chk_orphan_node(struct f2fs_sb_info *sbi)f2fs_ra_meta_pages (sbi, start_blk, orphan_blkaddr,META_CP ); - orphan_blk =calloc (BLOCK_SZ ,1 ); + orphan_blk =calloc (F2FS_BLKSIZE ,1 );ASSERT (orphan_blk); - new_blk =calloc (BLOCK_SZ ,1 ); + new_blk =calloc (F2FS_BLKSIZE ,1 );ASSERT (new_blk);for (i =0 ; i < orphan_blkaddr; i++) {
@@ -2164,8 +2164,8 @@ int fsck_chk_orphan_node(struct f2fs_sb_info *sbi) ret =dev_write_block (new_blk, start_blk + i);ASSERT (ret >=0 ); } -memset (orphan_blk,0 ,BLOCK_SZ ); -memset (new_blk,0 ,BLOCK_SZ ); +memset (orphan_blk,0 ,F2FS_BLKSIZE ); +memset (new_blk,0 ,F2FS_BLKSIZE ); }free (orphan_blk);free (new_blk);
@@ -2442,7 +2442,7 @@ static void fix_hard_links(struct f2fs_sb_info *sbi)if (fsck->hard_link_list_head ==NULL )return ; - node_blk = (struct f2fs_node *)calloc (BLOCK_SZ ,1 ); + node_blk = (struct f2fs_node *)calloc (F2FS_BLKSIZE ,1 );ASSERT (node_blk !=NULL ); node = fsck->hard_link_list_head;
@@ -2482,7 +2482,7 @@ static void flush_curseg_sit_entries(struct f2fs_sb_info *sbi)struct f2fs_sit_block *sit_blk;int i; - sit_blk =calloc (BLOCK_SZ ,1 ); + sit_blk =calloc (F2FS_BLKSIZE ,1 );ASSERT (sit_blk);/* update curseg sit entries, since we may change * a segment type in move_curseg_info
fsck/fsck.h +0 -2
@@ -126,8 +126,6 @@ struct f2fs_fsck {struct quota_ctx *qctx; }; -#define BLOCK_SZ F2FS_BLKSIZE -enum NODE_TYPE {TYPE_INODE =37 ,TYPE_DIRECT_NODE =43 ,
fsck/mkquota.c +1 -1
@@ -302,7 +302,7 @@ void quota_add_inode_usage(quota_ctx_t qctx, f2fs_ino_t ino, UINT_TO_VOIDPTR(ino), NULL); } -qsize_t space = (inode->i_blocks -1 ) *BLOCK_SZ ; +qsize_t space = (inode->i_blocks -1 ) *F2FS_BLKSIZE ;quota_data_add (qctx, inode, space);quota_data_inodes (qctx, inode,+1 ); }
fsck/mount.c +12 -12
@@ -859,7 +859,7 @@ void update_superblock(struct f2fs_super_block *sb, int sb_mask)uint8_t *buf;u32 old_crc, new_crc; - buf =calloc (BLOCK_SZ ,1 ); + buf =calloc (F2FS_BLKSIZE ,1 );ASSERT (buf);if (get_sb (feature) &F2FS_FEATURE_SB_CHKSUM ) {
@@ -2366,7 +2366,7 @@ struct f2fs_summary_block *get_sum_block(struct f2fs_sb_info *sbi, } } - sum_blk =calloc (BLOCK_SZ ,1 ); + sum_blk =calloc (F2FS_BLKSIZE ,1 );ASSERT (sum_blk); ret =dev_read_block (sum_blk, ssa_blk);
@@ -2410,7 +2410,7 @@ static void get_nat_entry(struct f2fs_sb_info *sbi, nid_t nid,if (lookup_nat_in_journal (sbi, nid, raw_nat) >=0 )return ; - nat_block = (struct f2fs_nat_block *)calloc (BLOCK_SZ ,1 ); + nat_block = (struct f2fs_nat_block *)calloc (F2FS_BLKSIZE ,1 );ASSERT (nat_block); entry_off = nid %NAT_ENTRY_PER_BLOCK ;
@@ -2432,7 +2432,7 @@ void update_data_blkaddr(struct f2fs_sb_info *sbi, nid_t nid,block_t oldaddr, startaddr, endaddr;int ret; - node_blk = (struct f2fs_node *)calloc (BLOCK_SZ ,1 ); + node_blk = (struct f2fs_node *)calloc (F2FS_BLKSIZE ,1 );ASSERT (node_blk);get_node_info (sbi, nid, &ni);
@@ -2484,7 +2484,7 @@ void update_nat_blkaddr(struct f2fs_sb_info *sbi, nid_t ino,int entry_off;int ret; - nat_block = (struct f2fs_nat_block *)calloc (BLOCK_SZ ,1 ); + nat_block = (struct f2fs_nat_block *)calloc (F2FS_BLKSIZE ,1 );ASSERT (nat_block); entry_off = nid %NAT_ENTRY_PER_BLOCK ;
@@ -2532,7 +2532,7 @@ static int build_sit_entries(struct f2fs_sb_info *sbi)unsigned int i, segno, end;unsigned int readed, start_blk =0 ; - sit_blk =calloc (BLOCK_SZ ,1 ); + sit_blk =calloc (F2FS_BLKSIZE ,1 );if (!sit_blk) {MSG (1 ,"\tError: Calloc failed for build_sit_entries!\n" );return -ENOMEM ;
@@ -2684,7 +2684,7 @@ void rewrite_sit_area_bitmap(struct f2fs_sb_info *sbi)struct f2fs_summary_block *sum = curseg->sum_blk;char *ptr =NULL ; - sit_blk =calloc (BLOCK_SZ ,1 ); + sit_blk =calloc (F2FS_BLKSIZE ,1 );ASSERT (sit_blk);/* remove sit journal */ F2FS_SUMMARY_BLOCK_JOURNAL (sum)->n_sits =0 ;
@@ -2734,7 +2734,7 @@ static int flush_sit_journal_entries(struct f2fs_sb_info *sbi)unsigned int segno;int i; - sit_blk =calloc (BLOCK_SZ ,1 ); + sit_blk =calloc (F2FS_BLKSIZE ,1 );ASSERT (sit_blk);for (i =0 ; i <sits_in_cursum (journal); i++) {struct f2fs_sit_entry *sit;
@@ -2770,7 +2770,7 @@ static int flush_nat_journal_entries(struct f2fs_sb_info *sbi)int ret;int i =0 ; - nat_block = (struct f2fs_nat_block *)calloc (BLOCK_SZ ,1 ); + nat_block = (struct f2fs_nat_block *)calloc (F2FS_BLKSIZE ,1 );ASSERT (nat_block); next:if (i >=nats_in_cursum (journal)) {
@@ -2814,7 +2814,7 @@ void flush_sit_entries(struct f2fs_sb_info *sbi)struct f2fs_sit_block *sit_blk;unsigned int segno =0 ; - sit_blk =calloc (BLOCK_SZ ,1 ); + sit_blk =calloc (F2FS_BLKSIZE ,1 );ASSERT (sit_blk);/* update free segments */ for (segno =0 ; segno <MAIN_SEGS (sbi); segno++) {
@@ -3129,7 +3129,7 @@ void nullify_nat_entry(struct f2fs_sb_info *sbi, u32 nid)return ; } } - nat_block = (struct f2fs_nat_block *)calloc (BLOCK_SZ ,1 ); + nat_block = (struct f2fs_nat_block *)calloc (F2FS_BLKSIZE ,1 );ASSERT (nat_block); entry_off = nid %NAT_ENTRY_PER_BLOCK ;
@@ -3331,7 +3331,7 @@ void build_nat_area_bitmap(struct f2fs_sb_info *sbi)int ret;unsigned int i; - nat_block = (struct f2fs_nat_block *)calloc (BLOCK_SZ ,1 ); + nat_block = (struct f2fs_nat_block *)calloc (F2FS_BLKSIZE ,1 );ASSERT (nat_block);/* Alloc & build nat entry bitmap */
fsck/node.c +2 -2
@@ -125,7 +125,7 @@ block_t new_node_block(struct f2fs_sb_info *sbi, f2fs_inode = dn->inode_blk; - node_blk =calloc (BLOCK_SZ ,1 ); + node_blk =calloc (F2FS_BLKSIZE ,1 );ASSERT (node_blk);F2FS_NODE_FOOTER (node_blk)->nid =cpu_to_le32 (dn->nid);
@@ -290,7 +290,7 @@ int get_dnode_of_data(struct f2fs_sb_info *sbi, struct dnode_of_data *dn,struct node_info ni;get_node_info (sbi, nids[i], &ni); - dn->node_blk =calloc (BLOCK_SZ ,1 ); + dn->node_blk =calloc (F2FS_BLKSIZE ,1 );ASSERT (dn->node_blk); ret =dev_read_block (dn->node_blk, ni.blk_addr);
fsck/node.h +1 -1
@@ -35,7 +35,7 @@ static inline unsigned int ADDRS_PER_PAGE(struct f2fs_sb_info *sbi,if (!inode_blk) {struct node_info ni; - inode_blk =calloc (BLOCK_SZ ,2 ); + inode_blk =calloc (F2FS_BLKSIZE ,2 );ASSERT (inode_blk);get_node_info (sbi, ino, &ni);
fsck/resize.c +13 -13
@@ -167,7 +167,7 @@ safe_resize:static void migrate_main (struct f2fs_sb_info *sbi,unsigned int offset) { -void *raw =calloc (BLOCK_SZ ,1 ); +void *raw =calloc (F2FS_BLKSIZE ,1 );struct seg_entry *se;block_t from, to;int i, j, ret;
@@ -243,7 +243,7 @@ static void migrate_ssa(struct f2fs_sb_info *sbi,MAIN_SEGS (sbi) - offset;block_t blkaddr;int ret; -void *zero_block =calloc (BLOCK_SZ ,1 ); +void *zero_block =calloc (F2FS_BLKSIZE ,1 );ASSERT (zero_block);if (offset && new_sum_blkaddr < old_sum_blkaddr + offset) {
@@ -287,9 +287,9 @@ static int shrink_nats(struct f2fs_sb_info *sbi,pgoff_t block_addr;int seg_off; - nat_block =malloc (BLOCK_SZ ); + nat_block =malloc (F2FS_BLKSIZE );ASSERT (nat_block); - zero_block =calloc (BLOCK_SZ ,1 ); + zero_block =calloc (F2FS_BLKSIZE ,1 );ASSERT (zero_block); nat_blocks =get_newsb (segment_count_nat) >>1 ;
@@ -309,7 +309,7 @@ static int shrink_nats(struct f2fs_sb_info *sbi, ret =dev_read_block (nat_block, block_addr);ASSERT (ret >=0 ); -if (memcmp (zero_block, nat_block,BLOCK_SZ )) { +if (memcmp (zero_block, nat_block,F2FS_BLKSIZE )) { ret =-1 ; goto not_avail; }
@@ -336,7 +336,7 @@ static void migrate_nat(struct f2fs_sb_info *sbi,pgoff_t block_addr;int seg_off; - nat_block =malloc (BLOCK_SZ ); + nat_block =malloc (F2FS_BLKSIZE );ASSERT (nat_block);for (nid = nm_i->max_nid -1 ; nid >=0 ; nid -=NAT_ENTRY_PER_BLOCK ) {
@@ -364,7 +364,7 @@ static void migrate_nat(struct f2fs_sb_info *sbi,ASSERT (ret >=0 ); }/* zero out newly assigned nids */ -memset (nat_block,0 ,BLOCK_SZ ); +memset (nat_block,0 ,F2FS_BLKSIZE ); nat_blocks =get_newsb (segment_count_nat) >>1 ; nat_blocks = nat_blocks <<get_sb (log_blocks_per_seg); new_max_nid =NAT_ENTRY_PER_BLOCK * nat_blocks;
@@ -396,7 +396,7 @@ static void migrate_sit(struct f2fs_sb_info *sbi,struct sit_info *sit_i =SIT_I (sbi);unsigned int ofs =0 , pre_ofs =0 ;unsigned int segno, index; -struct f2fs_sit_block *sit_blk =calloc (BLOCK_SZ ,1 ); +struct f2fs_sit_block *sit_blk =calloc (F2FS_BLKSIZE ,1 );block_t sit_blks =get_newsb (segment_count_sit) << (sbi->log_blocks_per_seg -1 );struct seg_entry *se;
@@ -430,7 +430,7 @@ static void migrate_sit(struct f2fs_sb_info *sbi,DBG (1 ,"Write valid sit: %x\n" , blk_addr); pre_ofs = ofs; -memset (sit_blk,0 ,BLOCK_SZ ); +memset (sit_blk,0 ,F2FS_BLKSIZE ); } sit = &sit_blk->entries[SIT_ENTRY_OFFSET (sit_i, segno - offset)];
@@ -464,10 +464,10 @@ static void rebuild_checkpoint(struct f2fs_sb_info *sbi,void *buf;int i, ret; - new_cp =calloc (new_cp_blks *BLOCK_SZ ,1 ); + new_cp =calloc (new_cp_blks *F2FS_BLKSIZE ,1 );ASSERT (new_cp); - buf =malloc (BLOCK_SZ ); + buf =malloc (F2FS_BLKSIZE );ASSERT (buf);/* ovp / free segments */
@@ -561,7 +561,7 @@ static void rebuild_checkpoint(struct f2fs_sb_info *sbi, ret =dev_write_block (new_cp, new_cp_blk_no++);ASSERT (ret >=0 ); -memset (buf,0 ,BLOCK_SZ ); +memset (buf,0 ,F2FS_BLKSIZE );for (i =0 ; i <get_newsb (cp_payload); i++) { ret =dev_write_block (buf, new_cp_blk_no++);ASSERT (ret >=0 );
@@ -594,7 +594,7 @@ static void rebuild_checkpoint(struct f2fs_sb_info *sbi,write_nat_bits (sbi, new_sb, new_cp, sbi->cur_cp ==1 ?2 :1 );/* disable old checkpoint */ -memset (buf,0 ,BLOCK_SZ ); +memset (buf,0 ,F2FS_BLKSIZE ); ret =dev_write_block (buf, old_cp_blk_no);ASSERT (ret >=0 );
fsck/segment.c +24 -24
156 lines not on this page · raw message
fsck/xattr.c +3 -3
@@ -30,7 +30,7 @@ void *read_all_xattrs(struct f2fs_sb_info *sbi, struct f2fs_node *inode,return NULL ; } - txattr_addr =calloc (inline_size +BLOCK_SZ ,1 ); + txattr_addr =calloc (inline_size +F2FS_BLKSIZE ,1 );ASSERT (txattr_addr);if (inline_size)
@@ -110,7 +110,7 @@ void write_all_xattrs(struct f2fs_sb_info *sbi,set_new_dnode (&dn, inode,NULL , xnid);get_node_info (sbi, xnid, &ni); blkaddr = ni.blk_addr; - xattr_node =calloc (BLOCK_SZ ,1 ); + xattr_node =calloc (F2FS_BLKSIZE ,1 );ASSERT (xattr_node); ret =dev_read_block (xattr_node, ni.blk_addr);if (ret <0 )
@@ -161,7 +161,7 @@ int f2fs_setxattr(struct f2fs_sb_info *sbi, nid_t ino, int index, const char *naASSERT (index ==F2FS_XATTR_INDEX_SECURITY );get_node_info (sbi, ino, &ni); - inode =calloc (BLOCK_SZ ,1 ); + inode =calloc (F2FS_BLKSIZE ,1 );ASSERT (inode); ret =dev_read_block (inode, ni.blk_addr);ASSERT (ret >=0 );
Signature · 8 lines
2.42.0.820.g83a721a137-goog _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
PATCH 2/2 fsck.f2fs: wrong report on xattr boundary
This avoids false alarm on xfstests/generic/425.
Signed-off-by Jaegeuk Kim <[email protected]>
--- fsck/xattr.c | 3 +++ 1 file changed, 3 insertions(+)
fsck/xattr.c +3 -0
@@ -44,6 +44,9 @@ void *read_all_xattrs(struct f2fs_sb_info *sbi, struct f2fs_node *inode,get_node_info (sbi, xnid, &ni); ret =dev_read_block (txattr_addr + inline_size, ni.blk_addr);ASSERT (ret >=0 ); +memset (txattr_addr + inline_size +F2FS_BLKSIZE - +sizeof (struct node_footer ),0 , +sizeof (struct node_footer )); } header =XATTR_HDR (txattr_addr);
Signature · 8 lines
2.42.0.820.g83a721a137-goog _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel