diff mbox series

[1/3] btrfs-progs: check: remove inode cache clearing functionality

Message ID 9ded4d71f4ab77ee4ed8d3ff31df839e85756def.1701672971.git.wqu@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: tune: run "btrfs check" before and after full fs conversion | expand

Commit Message

Qu Wenruo Dec. 4, 2023, 6:56 a.m. UTC
Since we're already directing the end user to use "btrfs rescue
clear-ino-cache" command, there is not much need to support it in
btrfs-check.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 check/main.c                                        |  12 ++----------
 .../060-ino-cache-clean}/ino-cache-enabled.raw.xz   | Bin
 .../060-ino-cache-clean}/test.sh                    |   2 +-
 3 files changed, 3 insertions(+), 11 deletions(-)
 rename tests/{fsck-tests/046-ino-cache-clean => misc-tests/060-ino-cache-clean}/ino-cache-enabled.raw.xz (100%)
 rename tests/{fsck-tests/046-ino-cache-clean => misc-tests/060-ino-cache-clean}/test.sh (97%)

Comments

David Sterba Dec. 5, 2023, 4:47 p.m. UTC | #1
On Mon, Dec 04, 2023 at 05:26:27PM +1030, Qu Wenruo wrote:
> Since we're already directing the end user to use "btrfs rescue
> clear-ino-cache" command, there is not much need to support it in
> btrfs-check.
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>
> ---
>  check/main.c                                        |  12 ++----------
>  .../060-ino-cache-clean}/ino-cache-enabled.raw.xz   | Bin
>  .../060-ino-cache-clean}/test.sh                    |   2 +-
>  3 files changed, 3 insertions(+), 11 deletions(-)
>  rename tests/{fsck-tests/046-ino-cache-clean => misc-tests/060-ino-cache-clean}/ino-cache-enabled.raw.xz (100%)
>  rename tests/{fsck-tests/046-ino-cache-clean => misc-tests/060-ino-cache-clean}/test.sh (97%)
> 
> diff --git a/check/main.c b/check/main.c
> index 901a7ef5ebcb..30967fd426ca 100644
> --- a/check/main.c
> +++ b/check/main.c
> @@ -9994,7 +9994,6 @@ static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
>  	int init_csum_tree = 0;
>  	int readonly = 0;
>  	int clear_space_cache = 0;
> -	int clear_ino_cache = 0;
>  	int qgroup_report = 0;
>  	int qgroups_repaired = 0;
>  	int qgroup_verify_ret;
> @@ -10118,8 +10117,8 @@ static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
>  				ctree_flags |= OPEN_CTREE_WRITES;
>  				break;
>  			case GETOPT_VAL_CLEAR_INO_CACHE:
> -				clear_ino_cache = 1;
> -				ctree_flags |= OPEN_CTREE_WRITES;
> +				error("--clear-ino-cache option is deprecated, please use \"btrfs rescue clear-ino-cache\" instead");
> +				exit(1);

This can be added independent of the rest of the series, though this
kind of change is suitable for the major release. I'll add it to devel
now but it's targeting 6.7.
diff mbox series

Patch

diff --git a/check/main.c b/check/main.c
index 901a7ef5ebcb..30967fd426ca 100644
--- a/check/main.c
+++ b/check/main.c
@@ -9994,7 +9994,6 @@  static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
 	int init_csum_tree = 0;
 	int readonly = 0;
 	int clear_space_cache = 0;
-	int clear_ino_cache = 0;
 	int qgroup_report = 0;
 	int qgroups_repaired = 0;
 	int qgroup_verify_ret;
@@ -10118,8 +10117,8 @@  static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
 				ctree_flags |= OPEN_CTREE_WRITES;
 				break;
 			case GETOPT_VAL_CLEAR_INO_CACHE:
-				clear_ino_cache = 1;
-				ctree_flags |= OPEN_CTREE_WRITES;
+				error("--clear-ino-cache option is deprecated, please use \"btrfs rescue clear-ino-cache\" instead");
+				exit(1);
 				break;
 			case GETOPT_VAL_FORCE:
 				force = 1;
@@ -10240,13 +10239,6 @@  static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
 		goto close_out;
 	}
 
-	if (clear_ino_cache) {
-		warning("--clear-ino-cache option is deprecated, please use \"btrfs rescue clear-ino-cache\" instead");
-		ret = clear_ino_cache_items(gfs_info);
-		err = ret;
-		goto close_out;
-	}
-
 	/*
 	 * repair mode will force us to commit transaction which
 	 * will make us fail to load log tree when mounting.
diff --git a/tests/fsck-tests/046-ino-cache-clean/ino-cache-enabled.raw.xz b/tests/misc-tests/060-ino-cache-clean/ino-cache-enabled.raw.xz
similarity index 100%
rename from tests/fsck-tests/046-ino-cache-clean/ino-cache-enabled.raw.xz
rename to tests/misc-tests/060-ino-cache-clean/ino-cache-enabled.raw.xz
diff --git a/tests/fsck-tests/046-ino-cache-clean/test.sh b/tests/misc-tests/060-ino-cache-clean/test.sh
similarity index 97%
rename from tests/fsck-tests/046-ino-cache-clean/test.sh
rename to tests/misc-tests/060-ino-cache-clean/test.sh
index cfbadf251d30..10b75cc5f5b0 100755
--- a/tests/fsck-tests/046-ino-cache-clean/test.sh
+++ b/tests/misc-tests/060-ino-cache-clean/test.sh
@@ -9,7 +9,7 @@  setup_root_helper
 
 image=$(extract_image "./ino-cache-enabled.raw.xz")
 
-run_check "$TOP/btrfs" check --clear-ino-cache "$image"
+run_check "$TOP/btrfs" rescue clear-ino-cache "$image"
 run_check "$TOP/btrfs" check "$image"
 
 # Check for FREE_INO items for toplevel subvol