aboutsummaryrefslogtreecommitdiffstats
path: root/mkfs/f2fs_format.c
diff options
context:
space:
mode:
Diffstat (limited to 'mkfs/f2fs_format.c')
-rw-r--r--mkfs/f2fs_format.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
index a46e60e..31b4422 100644
--- a/mkfs/f2fs_format.c
+++ b/mkfs/f2fs_format.c
@@ -376,10 +376,11 @@ static int f2fs_init_sit_area(void)
sit_seg_addr = le32_to_cpu(super_block.sit_blkaddr);
sit_seg_addr *= blk_size;
+ DBG(1, "\tFilling sit area at offset 0x%08"PRIx64"\n", sit_seg_addr);
for (index = 0;
index < (le32_to_cpu(super_block.segment_count_sit) / 2);
index++) {
- if (dev_write(zero_buf, sit_seg_addr, seg_size)) {
+ if (dev_fill(zero_buf, sit_seg_addr, seg_size)) {
MSG(1, "\tError: While zeroing out the sit area \
on disk!!!\n");
return -1;
@@ -411,10 +412,11 @@ static int f2fs_init_nat_area(void)
nat_seg_addr = le32_to_cpu(super_block.nat_blkaddr);
nat_seg_addr *= blk_size;
+ DBG(1, "\tFilling nat area at offset 0x%08"PRIx64"\n", nat_seg_addr);
for (index = 0;
index < (le32_to_cpu(super_block.segment_count_nat) / 2);
index++) {
- if (dev_write(nat_buf, nat_seg_addr, seg_size)) {
+ if (dev_fill(nat_buf, nat_seg_addr, seg_size)) {
MSG(1, "\tError: While zeroing out the nat area \
on disk!!!\n");
return -1;
@@ -510,6 +512,7 @@ static int f2fs_write_check_point_pack(void)
cp_seg_blk_offset = le32_to_cpu(super_block.segment0_blkaddr);
cp_seg_blk_offset *= blk_size_bytes;
+ DBG(1, "\tWriting main segments, ckp at offset 0x%08"PRIx64"\n", cp_seg_blk_offset);
if (dev_write(ckp, cp_seg_blk_offset, F2FS_BLKSIZE)) {
MSG(1, "\tError: While writing the ckp to disk!!!\n");
return -1;
@@ -523,6 +526,7 @@ static int f2fs_write_check_point_pack(void)
sum->entries[0].ofs_in_node = 0;
cp_seg_blk_offset += blk_size_bytes;
+ DBG(1, "\tWriting segment summary for data, ckp at offset 0x%08"PRIx64"\n", cp_seg_blk_offset);
if (dev_write(sum, cp_seg_blk_offset, F2FS_BLKSIZE)) {
MSG(1, "\tError: While writing the sum_blk to disk!!!\n");
return -1;
@@ -533,6 +537,7 @@ static int f2fs_write_check_point_pack(void)
SET_SUM_TYPE((&sum->footer), SUM_TYPE_DATA);
cp_seg_blk_offset += blk_size_bytes;
+ DBG(1, "\tWriting segment summary, ckp at offset 0x%08"PRIx64"\n", cp_seg_blk_offset);
if (dev_write(sum, cp_seg_blk_offset, F2FS_BLKSIZE)) {
MSG(1, "\tError: While writing the sum_blk to disk!!!\n");
return -1;
@@ -562,6 +567,7 @@ static int f2fs_write_check_point_pack(void)
sum->sit_j.entries[5].se.vblocks = cpu_to_le16((CURSEG_COLD_DATA << 10));
cp_seg_blk_offset += blk_size_bytes;
+ DBG(1, "\tWriting data sit for root, at offset 0x%08"PRIx64"\n", cp_seg_blk_offset);
if (dev_write(sum, cp_seg_blk_offset, F2FS_BLKSIZE)) {
MSG(1, "\tError: While writing the sum_blk to disk!!!\n");
return -1;
@@ -575,6 +581,7 @@ static int f2fs_write_check_point_pack(void)
sum->entries[0].ofs_in_node = 0;
cp_seg_blk_offset += blk_size_bytes;
+ DBG(1, "\tWriting Segment summary for node blocks, at offset 0x%08"PRIx64"\n", cp_seg_blk_offset);
if (dev_write(sum, cp_seg_blk_offset, F2FS_BLKSIZE)) {
MSG(1, "\tError: While writing the sum_blk to disk!!!\n");
return -1;
@@ -585,6 +592,7 @@ static int f2fs_write_check_point_pack(void)
SET_SUM_TYPE((&sum->footer), SUM_TYPE_NODE);
cp_seg_blk_offset += blk_size_bytes;
+ DBG(1, "\tWriting Segment summary for data block (1/2), at offset 0x%08"PRIx64"\n", cp_seg_blk_offset);
if (dev_write(sum, cp_seg_blk_offset, F2FS_BLKSIZE)) {
MSG(1, "\tError: While writing the sum_blk to disk!!!\n");
return -1;
@@ -594,6 +602,7 @@ static int f2fs_write_check_point_pack(void)
memset(sum, 0, sizeof(struct f2fs_summary_block));
SET_SUM_TYPE((&sum->footer), SUM_TYPE_NODE);
cp_seg_blk_offset += blk_size_bytes;
+ DBG(1, "\tWriting Segment summary for data block (2/2), at offset 0x%08"PRIx64"\n", cp_seg_blk_offset);
if (dev_write(sum, cp_seg_blk_offset, F2FS_BLKSIZE)) {
MSG(1, "\tError: While writing the sum_blk to disk!!!\n");
return -1;
@@ -601,6 +610,7 @@ static int f2fs_write_check_point_pack(void)
/* 8. cp page2 */
cp_seg_blk_offset += blk_size_bytes;
+ DBG(1, "\tWriting cp page2, at offset 0x%08"PRIx64"\n", cp_seg_blk_offset);
if (dev_write(ckp, cp_seg_blk_offset, F2FS_BLKSIZE)) {
MSG(1, "\tError: While writing the ckp to disk!!!\n");
return -1;
@@ -617,6 +627,7 @@ static int f2fs_write_check_point_pack(void)
cp_seg_blk_offset = (le32_to_cpu(super_block.segment0_blkaddr) +
config.blks_per_seg) *
blk_size_bytes;
+ DBG(1, "\tWriting cp page 1 of checkpoint pack 2, at offset 0x%08"PRIx64"\n", cp_seg_blk_offset);
if (dev_write(ckp, cp_seg_blk_offset, F2FS_BLKSIZE)) {
MSG(1, "\tError: While writing the ckp to disk!!!\n");
return -1;
@@ -624,6 +635,7 @@ static int f2fs_write_check_point_pack(void)
/* 10. cp page 2 of check point pack 2 */
cp_seg_blk_offset += blk_size_bytes * (le32_to_cpu(ckp->cp_pack_total_block_count) - 1);
+ DBG(1, "\tWriting cp page 2 of checkpoint pack 2, at offset 0x%08"PRIx64"\n", cp_seg_blk_offset);
if (dev_write(ckp, cp_seg_blk_offset, F2FS_BLKSIZE)) {
MSG(1, "\tError: While writing the ckp to disk!!!\n");
return -1;
@@ -643,6 +655,7 @@ static int f2fs_write_super_block(void)
memcpy(zero_buff + F2FS_SUPER_OFFSET, &super_block,
sizeof(super_block));
+ DBG(1, "\tWriting super block, at offset 0x%08x\n", 0);
for (index = 0; index < 2; index++) {
if (dev_write(zero_buff, index * F2FS_BLKSIZE, F2FS_BLKSIZE)) {
MSG(1, "\tError: While while writing supe_blk \
@@ -709,6 +722,7 @@ static int f2fs_write_root_inode(void)
config.blks_per_seg;
main_area_node_seg_blk_offset *= blk_size_bytes;
+ DBG(1, "\tWriting root inode (hot node), at offset 0x%08"PRIx64"\n", main_area_node_seg_blk_offset);
if (dev_write(raw_node, main_area_node_seg_blk_offset, F2FS_BLKSIZE)) {
MSG(1, "\tError: While writing the raw_node to disk!!!\n");
return -1;
@@ -722,6 +736,7 @@ static int f2fs_write_root_inode(void)
config.blks_per_seg;
main_area_node_seg_blk_offset *= blk_size_bytes;
+ DBG(1, "\tWriting root inode (warm node), at offset 0x%08"PRIx64"\n", main_area_node_seg_blk_offset);
if (dev_write(raw_node, main_area_node_seg_blk_offset, F2FS_BLKSIZE)) {
MSG(1, "\tError: While writing the raw_node to disk!!!\n");
return -1;
@@ -759,6 +774,7 @@ static int f2fs_update_nat_root(void)
nat_seg_blk_offset = le32_to_cpu(super_block.nat_blkaddr);
nat_seg_blk_offset *= blk_size_bytes;
+ DBG(1, "\tWriting nat root, at offset 0x%08"PRIx64"\n", nat_seg_blk_offset);
if (dev_write(nat_blk, nat_seg_blk_offset, F2FS_BLKSIZE)) {
MSG(1, "\tError: While writing the nat_blk set0 to disk!\n");
return -1;
@@ -799,6 +815,7 @@ static int f2fs_add_default_dentry_root(void)
config.blks_per_seg;
data_blk_offset *= blk_size_bytes;
+ DBG(1, "\tWriting default dentry root, at offset 0x%08"PRIx64"\n", data_blk_offset);
if (dev_write(dent_blk, data_blk_offset, F2FS_BLKSIZE)) {
MSG(1, "\tError: While writing the dentry_blk to disk!!!\n");
return -1;