projects
/
platform
/
upstream
/
btrfs-progs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
btrfs-progs: tests: 029-super-recovery: cleanup the test
[platform/upstream/btrfs-progs.git]
/
cmds-filesystem.c
diff --git
a/cmds-filesystem.c
b/cmds-filesystem.c
index
0f8e6cd
..
25d3c0c
100644
(file)
--- a/
cmds-filesystem.c
+++ b/
cmds-filesystem.c
@@
-150,7
+150,7
@@
static int cmd_filesystem_df(int argc, char **argv)
return !!ret;
}
return !!ret;
}
-static int match_search_item_kernel(
__
u8 *fsid, char *mnt, char *label,
+static int match_search_item_kernel(u8 *fsid, char *mnt, char *label,
char *search)
{
char uuidbuf[BTRFS_UUID_UNPARSED_SIZE];
char *search)
{
char uuidbuf[BTRFS_UUID_UNPARSED_SIZE];
@@
-173,7
+173,6
@@
static int match_search_item_kernel(__u8 *fsid, char *mnt, char *label,
static int uuid_search(struct btrfs_fs_devices *fs_devices, const char *search)
{
char uuidbuf[BTRFS_UUID_UNPARSED_SIZE];
static int uuid_search(struct btrfs_fs_devices *fs_devices, const char *search)
{
char uuidbuf[BTRFS_UUID_UNPARSED_SIZE];
- struct list_head *cur;
struct btrfs_device *device;
int search_len = strlen(search);
struct btrfs_device *device;
int search_len = strlen(search);
@@
-182,8
+181,7
@@
static int uuid_search(struct btrfs_fs_devices *fs_devices, const char *search)
if (!strncmp(uuidbuf, search, search_len))
return 1;
if (!strncmp(uuidbuf, search, search_len))
return 1;
- list_for_each(cur, &fs_devices->devices) {
- device = list_entry(cur, struct btrfs_device, dev_list);
+ list_for_each_entry(device, &fs_devices->devices, dev_list) {
if ((device->label && strcmp(device->label, search) == 0) ||
strcmp(device->name, search) == 0)
return 1;
if ((device->label && strcmp(device->label, search) == 0) ||
strcmp(device->name, search) == 0)
return 1;
@@
-678,7
+676,7
@@
static int cmd_filesystem_show(int argc, char **argv)
int type = 0;
char mp[PATH_MAX];
char path[PATH_MAX];
int type = 0;
char mp[PATH_MAX];
char path[PATH_MAX];
-
__
u8 fsid[BTRFS_FSID_SIZE];
+ u8 fsid[BTRFS_FSID_SIZE];
char uuid_buf[BTRFS_UUID_UNPARSED_SIZE];
unsigned unit_mode;
int found = 0;
char uuid_buf[BTRFS_UUID_UNPARSED_SIZE];
unsigned unit_mode;
int found = 0;
@@
-1029,23
+1027,22
@@
static int cmd_filesystem_defrag(int argc, char **argv)
if (fd < 0) {
error("cannot open %s: %s", argv[i],
strerror(errno));
if (fd < 0) {
error("cannot open %s: %s", argv[i],
strerror(errno));
- defrag_global_errors++;
- close_file_or_dir(fd, dirstream);
- continue;
+ ret = -errno;
+ goto next;
}
}
- if (fstat(fd, &st)) {
+
+ ret = fstat(fd, &st);
+ if (ret) {
error("failed to stat %s: %s",
argv[i], strerror(errno));
error("failed to stat %s: %s",
argv[i], strerror(errno));
- defrag_global_errors++;
- close_file_or_dir(fd, dirstream);
- continue;
+ ret = -errno;
+ goto next;
}
if (!(S_ISDIR(st.st_mode) || S_ISREG(st.st_mode))) {
error("%s is not a directory or a regular file",
argv[i]);
}
if (!(S_ISDIR(st.st_mode) || S_ISREG(st.st_mode))) {
error("%s is not a directory or a regular file",
argv[i]);
- defrag_global_errors++;
- close_file_or_dir(fd, dirstream);
- continue;
+ ret = -EINVAL;
+ goto next;
}
if (recursive && S_ISDIR(st.st_mode)) {
ret = nftw(argv[i], defrag_callback, 10,
}
if (recursive && S_ISDIR(st.st_mode)) {
ret = nftw(argv[i], defrag_callback, 10,
@@
-1060,20
+1057,25
@@
static int cmd_filesystem_defrag(int argc, char **argv)
ret = ioctl(fd, BTRFS_IOC_DEFRAG_RANGE,
&defrag_global_range);
defrag_err = errno;
ret = ioctl(fd, BTRFS_IOC_DEFRAG_RANGE,
&defrag_global_range);
defrag_err = errno;
- }
- close_file_or_dir(fd, dirstream);
- if (ret && defrag_err == ENOTTY) {
- error(
+ if (ret && defrag_err == ENOTTY) {
+ error(
"defrag range ioctl not supported in this kernel version, 2.6.33 and newer is required");
"defrag range ioctl not supported in this kernel version, 2.6.33 and newer is required");
- defrag_global_errors++;
- break;
+ defrag_global_errors++;
+ close_file_or_dir(fd, dirstream);
+ break;
+ }
+ if (ret) {
+ error("defrag failed on %s: %s", argv[i],
+ strerror(defrag_err));
+ goto next;
+ }
}
}
- if (ret) {
- error("defrag failed on %s: %s", argv[i],
- strerror(defrag_err));
+next:
+ if (ret)
defrag_global_errors++;
defrag_global_errors++;
- }
+ close_file_or_dir(fd, dirstream);
}
}
+
if (defrag_global_errors)
fprintf(stderr, "total %d failures\n", defrag_global_errors);
if (defrag_global_errors)
fprintf(stderr, "total %d failures\n", defrag_global_errors);