Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: Su Yue <l@damenly.su>
Subject: [PATCH v2 1/3] btrfs-progs: image: remove the dead stat() call
Date: Thu, 29 Apr 2021 17:06:56 +0800	[thread overview]
Message-ID: <20210429090658.245238-2-wqu@suse.com> (raw)
In-Reply-To: <20210429090658.245238-1-wqu@suse.com>

In restore_metadump(), we call stat() but never uses the result get.

This call site is left by some code refactor, as the stat() call is now
moved into fixup_device_size().

So we can safely remove the call.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Su Yue <l@damenly.su>
---
 image/main.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/image/main.c b/image/main.c
index 48070e52c21f..24393188e5e3 100644
--- a/image/main.c
+++ b/image/main.c
@@ -2690,7 +2690,6 @@ static int restore_metadump(const char *input, FILE *out, int old_restore,
 	if (!ret && !multi_devices && !old_restore &&
 	    btrfs_super_num_devices(mdrestore.original_super) != 1) {
 		struct btrfs_root *root;
-		struct stat st;
 
 		root = open_ctree_fd(fileno(out), target, 0,
 					  OPEN_CTREE_PARTIAL |
@@ -2703,13 +2702,6 @@ static int restore_metadump(const char *input, FILE *out, int old_restore,
 		}
 		info = root->fs_info;
 
-		if (stat(target, &st)) {
-			error("stat %s failed: %m", target);
-			close_ctree(info->chunk_root);
-			free(cluster);
-			return 1;
-		}
-
 		ret = fixup_chunks_and_devices(info, &mdrestore, fileno(out));
 		close_ctree(info->chunk_root);
 		if (ret)
-- 
2.31.1


  reply	other threads:[~2021-04-29  9:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-29  9:06 [PATCH v2 0/3] btrfs-progs: image: make restored image file to be properly enlarged Qu Wenruo
2021-04-29  9:06 ` Qu Wenruo [this message]
2021-04-29  9:06 ` [PATCH v2 2/3] btrfs-progs: image: enlarge the output file if no tree modification is needed for restore Qu Wenruo
2021-04-29  9:06 ` [PATCH v2 3/3] btrfs-progs: misc-tests: add test to ensure the restored image can be mounted Qu Wenruo
2021-04-29 19:56   ` David Sterba
2021-04-29 19:54 ` [PATCH v2 0/3] btrfs-progs: image: make restored image file to be properly enlarged David Sterba

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=20210429090658.245238-2-wqu@suse.com \
    --to=wqu@suse.com \
    --cc=l@damenly.su \
    --cc=linux-btrfs@vger.kernel.org \
    /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