* [PATCH 1/2] resize.f2fs: add more information in debug messages
@ 2016-11-03 0:01 Jaegeuk Kim
2016-11-03 0:01 ` [PATCH 2/2] resize.f2fs: fix wrong offset calculation Jaegeuk Kim
0 siblings, 1 reply; 2+ messages in thread
From: Jaegeuk Kim @ 2016-11-03 0:01 UTC (permalink / raw)
To: linux-f2fs-devel; +Cc: Jaegeuk Kim
Print more information.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
fsck/resize.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/fsck/resize.c b/fsck/resize.c
index 565555c..b8d3f39 100644
--- a/fsck/resize.c
+++ b/fsck/resize.c
@@ -171,7 +171,9 @@ static void migrate_main(struct f2fs_sb_info *sbi,
}
}
free(raw);
- DBG(0, "Info: Done to migrate data and node blocks\n");
+ DBG(0, "Info: Done to migrate Main area: main_blkaddr = 0x%x -> 0x%x\n",
+ START_BLOCK(sbi, 0),
+ START_BLOCK(sbi, 0) + offset);
}
static void move_ssa(struct f2fs_sb_info *sbi, unsigned int segno,
@@ -214,7 +216,8 @@ static void migrate_ssa(struct f2fs_sb_info *sbi,
move_ssa(sbi, segno, new_sum_blkaddr + segno - offset);
}
- DBG(0, "Info: Done to migrate SSA blocks\n");
+ DBG(0, "Info: Done to migrate SSA blocks: sum_blkaddr = 0x%x -> 0x%x\n",
+ old_sum_blkaddr, new_sum_blkaddr);
}
static int shrink_nats(struct f2fs_sb_info *sbi,
@@ -323,9 +326,10 @@ static void migrate_nat(struct f2fs_sb_info *sbi,
(block_off & ((1 << sbi->log_blocks_per_seg) - 1)));
ret = dev_write_block(nat_block, block_addr);
ASSERT(ret >= 0);
- DBG(1, "Write NAT: %lx\n", block_addr);
+ DBG(3, "Write NAT: %lx\n", block_addr);
}
- DBG(0, "Info: Done to migrate NAT blocks\n");
+ DBG(0, "Info: Done to migrate NAT blocks: nat_blkaddr = 0x%x -> 0x%x\n",
+ old_nat_blkaddr, new_nat_blkaddr);
}
static void migrate_sit(struct f2fs_sb_info *sbi,
@@ -347,7 +351,7 @@ static void migrate_sit(struct f2fs_sb_info *sbi,
for (index = 0; index < sit_blks; index++) {
ret = dev_write_block(sit_blk, get_newsb(sit_blkaddr) + index);
ASSERT(ret >= 0);
- DBG(1, "Write zero sit: %x\n", get_newsb(sit_blkaddr) + index);
+ DBG(3, "Write zero sit: %x\n", get_newsb(sit_blkaddr) + index);
}
for (segno = 0; segno < TOTAL_SEGS(sbi); segno++) {
@@ -382,7 +386,8 @@ static void migrate_sit(struct f2fs_sb_info *sbi,
ASSERT(ret >= 0);
free(sit_blk);
- DBG(0, "Info: Done to migrate SIT blocks\n");
+ DBG(0, "Info: Done to restore new SIT blocks: 0x%x\n",
+ get_newsb(sit_blkaddr));
}
static void rebuild_checkpoint(struct f2fs_sb_info *sbi,
@@ -545,10 +550,8 @@ int f2fs_resize(struct f2fs_sb_info *sbi)
}
}
- c.dbg_lv = 1;
print_raw_sb_info(sb);
print_raw_sb_info(new_sb);
- c.dbg_lv = 0;
old_main_blkaddr = get_sb(main_blkaddr);
new_main_blkaddr = get_newsb(main_blkaddr);
--
2.8.3
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/2] resize.f2fs: fix wrong offset calculation
2016-11-03 0:01 [PATCH 1/2] resize.f2fs: add more information in debug messages Jaegeuk Kim
@ 2016-11-03 0:01 ` Jaegeuk Kim
0 siblings, 0 replies; 2+ messages in thread
From: Jaegeuk Kim @ 2016-11-03 0:01 UTC (permalink / raw)
To: linux-f2fs-devel; +Cc: Jaegeuk Kim
When we move whole main area into new expanded area, we do not change its
segment numbers from sit and ssa.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
fsck/resize.c | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/fsck/resize.c b/fsck/resize.c
index b8d3f39..6a645e3 100644
--- a/fsck/resize.c
+++ b/fsck/resize.c
@@ -206,14 +206,20 @@ static void migrate_ssa(struct f2fs_sb_info *sbi,
struct f2fs_super_block *sb = F2FS_RAW_SUPER(sbi);
block_t old_sum_blkaddr = get_sb(ssa_blkaddr);
block_t new_sum_blkaddr = get_newsb(ssa_blkaddr);
- int segno;
+ unsigned int segno;
- if (new_sum_blkaddr < old_sum_blkaddr + offset) {
- for (segno = offset; segno < TOTAL_SEGS(sbi); segno++)
+ if (offset && new_sum_blkaddr < old_sum_blkaddr + offset) {
+ segno = offset;
+ while (segno != TOTAL_SEGS(sbi)) {
move_ssa(sbi, segno, new_sum_blkaddr + segno - offset);
+ segno++;
+ }
} else {
- for (segno = TOTAL_SEGS(sbi) - 1; segno >= offset; segno--)
+ segno = TOTAL_SEGS(sbi) - 1;
+ while (segno != offset - 1) {
move_ssa(sbi, segno, new_sum_blkaddr + segno - offset);
+ segno--;
+ }
}
DBG(0, "Info: Done to migrate SSA blocks: sum_blkaddr = 0x%x -> 0x%x\n",
@@ -531,7 +537,8 @@ int f2fs_resize(struct f2fs_sb_info *sbi)
struct f2fs_super_block new_sb_raw;
struct f2fs_super_block *new_sb = &new_sb_raw;
block_t end_blkaddr, old_main_blkaddr, new_main_blkaddr;
- unsigned int offset, offset_seg;
+ unsigned int offset;
+ unsigned int offset_seg = 0;
int err = -1;
/* flush NAT/SIT journal entries */
@@ -565,13 +572,12 @@ int f2fs_resize(struct f2fs_sb_info *sbi)
}
err = -EAGAIN;
- offset_seg = offset >> get_sb(log_blocks_per_seg);
-
if (new_main_blkaddr < end_blkaddr) {
err = f2fs_defragment(sbi, old_main_blkaddr, offset,
new_main_blkaddr, 0);
- if (err)
- MSG(0, "Skip defragement\n");
+ if (!err)
+ offset_seg = offset >> get_sb(log_blocks_per_seg);
+ MSG(0, "Try to do defragement: %s\n", err ? "Skip": "Done");
}
/* move whole data region */
if (err)
--
2.8.3
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-11-03 0:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-03 0:01 [PATCH 1/2] resize.f2fs: add more information in debug messages Jaegeuk Kim
2016-11-03 0:01 ` [PATCH 2/2] resize.f2fs: fix wrong offset calculation Jaegeuk Kim
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.