summaryrefslogtreecommitdiff
path: root/mkfs/rootdir.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2018-10-25 14:10:54 +0200
committerDavid Sterba <dsterba@suse.com>2018-10-31 18:24:14 +0100
commite578b59bf612178d7727c303102049e62676c308 (patch)
treea6d6edd7fb6f34f4ce753aa9a1d787198a0e1ddf /mkfs/rootdir.c
parentd59e19ca0786be2b415ca342b0fab5f222ecb702 (diff)
btrfs-progs: convert strerror to implicit %m
Similar to the changes where strerror(errno) was converted, continue with the remaining cases where the argument was stored in another variable. The savings in object size are about 4500 bytes: $ size btrfs.old btrfs.new text data bss dec hex filename 805055 24248 19748 849051 cf49b btrfs.old 804527 24248 19748 848523 cf28b btrfs.new Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'mkfs/rootdir.c')
-rw-r--r--mkfs/rootdir.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/mkfs/rootdir.c b/mkfs/rootdir.c
index 74c46241..8384a151 100644
--- a/mkfs/rootdir.c
+++ b/mkfs/rootdir.c
@@ -261,8 +261,9 @@ static int add_xattr_item(struct btrfs_trans_handle *trans,
cur_name_len, cur_value,
ret, objectid);
if (ret) {
- error("inserting a xattr item failed for %s: %s",
- file_name, strerror(-ret));
+ errno = -ret;
+ error("inserting a xattr item failed for %s: %m",
+ file_name);
}
cur_name = strtok(next_location, &delimiter);
@@ -858,8 +859,8 @@ static int set_device_size(struct btrfs_fs_info *fs_info,
trans = btrfs_start_transaction(chunk_root, 1);
if (IS_ERR(trans)) {
ret = PTR_ERR(trans);
- error("failed to start transaction: %d (%s)", ret,
- strerror(-ret));
+ errno = -ret;
+ error("failed to start transaction: %d (%m)", ret);
return ret;
}
key.objectid = BTRFS_DEV_ITEMS_OBJECTID;
@@ -887,9 +888,10 @@ static int set_device_size(struct btrfs_fs_info *fs_info,
* super->dev_item
*/
ret = btrfs_commit_transaction(trans, chunk_root);
- if (ret < 0)
- error("failed to commit current transaction: %d (%s)",
- ret, strerror(-ret));
+ if (ret < 0) {
+ errno = -ret;
+ error("failed to commit current transaction: %d (%m)", ret);
+ }
btrfs_release_path(&path);
return ret;
@@ -924,8 +926,8 @@ int btrfs_mkfs_shrink_fs(struct btrfs_fs_info *fs_info, u64 *new_size_ret,
ret = get_device_extent_end(fs_info, 1, &new_size);
if (ret < 0) {
- error("failed to get minimal device size: %d (%s)",
- ret, strerror(-ret));
+ errno = -ret;
+ error("failed to get minimal device size: %d (%m)", ret);
return ret;
}