aboutsummaryrefslogtreecommitdiffstats
path: root/mkfs
diff options
context:
space:
mode:
authorChao Yu <chao2.yu@samsung.com>2015-02-05 17:36:39 +0800
committerJP Abgrall <jpa@google.com>2015-03-23 10:10:26 -0700
commit29ab4d8788d204edb362f01879e1d3d4f516e967 (patch)
treeeeb0299b8f7a98bcc8ec9bacd8d4621dc013cf21 /mkfs
parent8bcdc5fdb206196241dc6fc535e6d285d4985201 (diff)
downloadandroid_external_f2fs-tools-29ab4d8788d204edb362f01879e1d3d4f516e967.tar.gz
android_external_f2fs-tools-29ab4d8788d204edb362f01879e1d3d4f516e967.tar.bz2
android_external_f2fs-tools-29ab4d8788d204edb362f01879e1d3d4f516e967.zip
mkfs.f2fs: support large sector size
Since f2fs support large sector size in commit 55cf9cb63f0e "f2fs: support large sector size", block device with sector size of 512/1024/2048/4096 bytes can be supported. But mkfs.f2fs still use default sector size: 512 bytes as sector size, let's fix this issue in this patch. v2: o remove unneeded printed message when sector size is large than 512 bytes suggested by Kinglong. o show correct sector size in printed message. o use config.sectors_per_blk instead of DEFAULT_SECTORS_PER_BLOCK suggested by Kinglong. v3: o remove another unneeded printed message when sector size is large than 512 bytes suggested by Kinglong. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Reviewed-by: Kinglong Mee <kinglongmee@gmail.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'mkfs')
-rw-r--r--mkfs/f2fs_format.c12
-rw-r--r--mkfs/f2fs_format_utils.c2
2 files changed, 7 insertions, 7 deletions
diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
index a8d2db6..2cce7c3 100644
--- a/mkfs/f2fs_format.c
+++ b/mkfs/f2fs_format.c
@@ -198,20 +198,20 @@ static int f2fs_prepare_super_block(void)
set_sb(block_count, config.total_sectors >> log_sectors_per_block);
zone_align_start_offset =
- (config.start_sector * DEFAULT_SECTOR_SIZE +
+ (config.start_sector * config.sector_size +
2 * F2FS_BLKSIZE + zone_size_bytes - 1) /
zone_size_bytes * zone_size_bytes -
- config.start_sector * DEFAULT_SECTOR_SIZE;
+ config.start_sector * config.sector_size;
- if (config.start_sector % DEFAULT_SECTORS_PER_BLOCK) {
+ if (config.start_sector % config.sectors_per_blk) {
MSG(1, "\tWARN: Align start sector number to the page unit\n");
MSG(1, "\ti.e., start sector: %d, ofs:%d (sects/page: %d)\n",
config.start_sector,
- config.start_sector % DEFAULT_SECTORS_PER_BLOCK,
- DEFAULT_SECTORS_PER_BLOCK);
+ config.start_sector % config.sectors_per_blk,
+ config.sectors_per_blk);
}
- set_sb(segment_count, (config.total_sectors * DEFAULT_SECTOR_SIZE -
+ set_sb(segment_count, (config.total_sectors * config.sector_size -
zone_align_start_offset) / segment_size_bytes);
set_sb(segment0_blkaddr, zone_align_start_offset / blk_size_bytes);
diff --git a/mkfs/f2fs_format_utils.c b/mkfs/f2fs_format_utils.c
index 88b9953..a0f85f5 100644
--- a/mkfs/f2fs_format_utils.c
+++ b/mkfs/f2fs_format_utils.c
@@ -36,7 +36,7 @@ int f2fs_trim_device()
return 0;
range[0] = 0;
- range[1] = config.total_sectors * DEFAULT_SECTOR_SIZE;
+ range[1] = config.total_sectors * config.sector_size;
if (fstat(config.fd, &stat_buf) < 0 ) {
MSG(1, "\tError: Failed to get the device stat!!!\n");