btrfs-progs: use better name for nodiscard variable and flip the logic

Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
This commit is contained in:
David Sterba 2013-09-17 16:54:00 +02:00 committed by Chris Mason
parent f3ba662634
commit 15ac848f8a
3 changed files with 7 additions and 7 deletions

8
mkfs.c
View File

@ -1324,7 +1324,7 @@ int main(int ac, char **av)
int mixed = 0; int mixed = 0;
int data_profile_opt = 0; int data_profile_opt = 0;
int metadata_profile_opt = 0; int metadata_profile_opt = 0;
int nodiscard = 0; int discard = 1;
int ssd = 0; int ssd = 0;
int force_overwrite = 0; int force_overwrite = 0;
@ -1409,7 +1409,7 @@ int main(int ac, char **av)
source_dir_set = 1; source_dir_set = 1;
break; break;
case 'K': case 'K':
nodiscard=1; discard = 0;
break; break;
default: default:
print_usage(); print_usage();
@ -1507,7 +1507,7 @@ int main(int ac, char **av)
} }
first_file = file; first_file = file;
ret = btrfs_prepare_device(fd, file, zero_end, &dev_block_count, ret = btrfs_prepare_device(fd, file, zero_end, &dev_block_count,
block_count, &mixed, nodiscard); block_count, &mixed, discard);
if (block_count && block_count > dev_block_count) { if (block_count && block_count > dev_block_count) {
fprintf(stderr, "%s is smaller than requested size\n", file); fprintf(stderr, "%s is smaller than requested size\n", file);
exit(1); exit(1);
@ -1614,7 +1614,7 @@ int main(int ac, char **av)
continue; continue;
} }
ret = btrfs_prepare_device(fd, file, zero_end, &dev_block_count, ret = btrfs_prepare_device(fd, file, zero_end, &dev_block_count,
block_count, &mixed, nodiscard); block_count, &mixed, discard);
mixed = old_mixed; mixed = old_mixed;
BUG_ON(ret); BUG_ON(ret);

View File

@ -569,7 +569,7 @@ int btrfs_add_to_fsid(struct btrfs_trans_handle *trans,
} }
int btrfs_prepare_device(int fd, char *file, int zero_end, u64 *block_count_ret, int btrfs_prepare_device(int fd, char *file, int zero_end, u64 *block_count_ret,
u64 max_block_count, int *mixed, int nodiscard) u64 max_block_count, int *mixed, int discard)
{ {
u64 block_count; u64 block_count;
u64 bytenr; u64 bytenr;
@ -596,7 +596,7 @@ int btrfs_prepare_device(int fd, char *file, int zero_end, u64 *block_count_ret,
*mixed = 1; *mixed = 1;
} }
if (!nodiscard) { if (discard) {
/* /*
* We intentionally ignore errors from the discard ioctl. It is * We intentionally ignore errors from the discard ioctl. It is
* not necessary for the mkfs functionality but just an optimization. * not necessary for the mkfs functionality but just an optimization.

View File

@ -34,7 +34,7 @@ int make_btrfs(int fd, const char *device, const char *label,
int btrfs_make_root_dir(struct btrfs_trans_handle *trans, int btrfs_make_root_dir(struct btrfs_trans_handle *trans,
struct btrfs_root *root, u64 objectid); struct btrfs_root *root, u64 objectid);
int btrfs_prepare_device(int fd, char *file, int zero_end, u64 *block_count_ret, int btrfs_prepare_device(int fd, char *file, int zero_end, u64 *block_count_ret,
u64 max_block_count, int *mixed, int nodiscard); u64 max_block_count, int *mixed, int discard);
int btrfs_add_to_fsid(struct btrfs_trans_handle *trans, int btrfs_add_to_fsid(struct btrfs_trans_handle *trans,
struct btrfs_root *root, int fd, char *path, struct btrfs_root *root, int fd, char *path,
u64 block_count, u32 io_width, u32 io_align, u64 block_count, u32 io_width, u32 io_align,