linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: linux-f2fs-devel@lists.sourceforge.net
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Subject: [f2fs-dev] [PATCH 2/2] resize.f2fs: add force option to rewrite broken calculation
Date: Thu,  1 Apr 2021 20:26:42 -0700	[thread overview]
Message-ID: <20210402032642.2537641-2-jaegeuk@kernel.org> (raw)
In-Reply-To: <20210402032642.2537641-1-jaegeuk@kernel.org>

This patch adds "-f" for resize.f2fs to fix broken resized f2fs.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fsck/main.c   | 6 +++++-
 fsck/resize.c | 5 +++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/fsck/main.c b/fsck/main.c
index be30e0073a5e..64efa8789cd4 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -506,7 +506,7 @@ void f2fs_parse_options(int argc, char *argv[])
 #endif
 	} else if (!strcmp("resize.f2fs", prog)) {
 #ifdef WITH_RESIZE
-		const char *option_string = "d:st:iV";
+		const char *option_string = "d:fst:iV";
 
 		c.func = RESIZE;
 		while ((option = getopt(argc, argv, option_string)) != EOF) {
@@ -522,6 +522,10 @@ void f2fs_parse_options(int argc, char *argv[])
 				MSG(0, "Info: Debug level = %d\n",
 							c.dbg_lv);
 				break;
+			case 'f':
+				c.force = 1;
+				MSG(0, "Info: Force to resize\n");
+				break;
 			case 's':
 				c.safe_resize = 1;
 				break;
diff --git a/fsck/resize.c b/fsck/resize.c
index 46b1cfb218cf..0425498b9760 100644
--- a/fsck/resize.c
+++ b/fsck/resize.c
@@ -714,8 +714,9 @@ int f2fs_resize(struct f2fs_sb_info *sbi)
 		} else {
 			return f2fs_resize_shrink(sbi);
 		}
-	else if ((c.target_sectors * c.sector_size >>
-			get_sb(log_blocksize)) > get_sb(block_count))
+	else if (((c.target_sectors * c.sector_size >>
+			get_sb(log_blocksize)) > get_sb(block_count)) ||
+			c.force)
 		return f2fs_resize_grow(sbi);
 	else {
 		MSG(0, "Nothing to resize.\n");
-- 
2.31.0.208.g409f899ff0-goog



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

      reply	other threads:[~2021-04-02  3:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-02  3:26 [f2fs-dev] [PATCH 1/2] resize.f2fs: fix wrong ovp calculation Jaegeuk Kim
2021-04-02  3:26 ` Jaegeuk Kim [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210402032642.2537641-2-jaegeuk@kernel.org \
    --to=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).