On 2014/12/18 5:14, Goffredo Baroncelli wrote: > Add verbose option to btrfs_add_to_fsid() in order to avoid to print > the information to console when not needed. > The same information is print in the summary of the mkfs.btrfs command. > > Signed-off-by: Goffredo Baroncelli <[email protected]>
Reviewed-by: Satoru Takeuchi <[email protected]> > --- > mkfs.c | 3 ++- > utils.c | 7 ++++--- > utils.h | 2 +- > 3 files changed, 7 insertions(+), 5 deletions(-) > > diff --git a/mkfs.c b/mkfs.c > index a5f19cc..042d12e 100644 > --- a/mkfs.c > +++ b/mkfs.c > @@ -1638,7 +1638,8 @@ int main(int ac, char **av) > mixed = old_mixed; > > ret = btrfs_add_to_fsid(trans, root, fd, file, dev_block_count, > - sectorsize, sectorsize, sectorsize); > + sectorsize, sectorsize, sectorsize, > + verbose); > BUG_ON(ret); > btrfs_register_one_device(file); > } > diff --git a/utils.c b/utils.c > index 19049bb..dcb4f74 100644 > --- a/utils.c > +++ b/utils.c > @@ -610,7 +610,7 @@ static int zero_dev_clamped(int fd, off_t start, ssize_t > len, u64 dev_size) > int btrfs_add_to_fsid(struct btrfs_trans_handle *trans, > struct btrfs_root *root, int fd, char *path, > u64 block_count, u32 io_width, u32 io_align, > - u32 sectorsize) > + u32 sectorsize, int verbose) > { > struct btrfs_super_block *disk_super; > struct btrfs_super_block *super = root->fs_info->super_copy; > @@ -659,8 +659,9 @@ int btrfs_add_to_fsid(struct btrfs_trans_handle *trans, > > memcpy(disk_super, super, sizeof(*disk_super)); > > - printf("adding device %s id %llu\n", path, > - (unsigned long long)device->devid); > + if (verbose) > + printf("adding device %s id %llu\n", path, > + (unsigned long long)device->devid); > > btrfs_set_super_bytenr(disk_super, BTRFS_SUPER_INFO_OFFSET); > btrfs_set_stack_device_id(dev_item, device->devid); > diff --git a/utils.h b/utils.h > index bb8a449..9218199 100644 > --- a/utils.h > +++ b/utils.h > @@ -79,7 +79,7 @@ int btrfs_prepare_device(int fd, char *file, int zero_end, > u64 *block_count_ret, > int btrfs_add_to_fsid(struct btrfs_trans_handle *trans, > struct btrfs_root *root, int fd, char *path, > u64 block_count, u32 io_width, u32 io_align, > - u32 sectorsize); > + u32 sectorsize, int verbose); > int btrfs_scan_for_fsid(int run_ioctls); > int btrfs_register_one_device(const char *fname); > int btrfs_register_all_devices(void); > -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
