This patch fix a resize faill for sector size mismatch.
The initial fs comes from an image file, with sector size
512KB, and the block device sector size is equal to block
size.

Signed-off-by: Yunlei He <[email protected]>
---
 fsck/main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fsck/main.c b/fsck/main.c
index 8bf5cd9..c61eb84 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -537,8 +537,9 @@ static int do_resize(struct f2fs_sb_info *sbi)
                return -1;
        }
 
-       if (c.target_sectors <=
-                       (get_sb(block_count) << get_sb(log_sectors_per_block))) 
{
+       /* may different sector size */
+       if ((c.target_sectors * c.sector_size >>
+                       get_sb(log_blocksize)) <= get_sb(block_count)) {
                ASSERT_MSG("Nothing to resize, now only support resize to 
expand\n");
                return -1;
        }
-- 
2.10.1


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to