diff options
author | David Sterba <dsterba@suse.com> | 2018-10-25 14:10:54 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-10-31 18:24:14 +0100 |
commit | e578b59bf612178d7727c303102049e62676c308 (patch) | |
tree | a6d6edd7fb6f34f4ce753aa9a1d787198a0e1ddf /volumes.c | |
parent | d59e19ca0786be2b415ca342b0fab5f222ecb702 (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 'volumes.c')
-rw-r--r-- | volumes.c | 25 |
1 files changed, 13 insertions, 12 deletions
@@ -1926,8 +1926,9 @@ static int read_one_chunk(struct btrfs_fs_info *fs_info, struct btrfs_key *key, } ret = insert_cache_extent(&map_tree->cache_tree, &map->ce); if (ret < 0) { - error("failed to add chunk map start=%llu len=%llu: %d (%s)", - map->ce.start, map->ce.size, ret, strerror(-ret)); + errno = -ret; + error("failed to add chunk map start=%llu len=%llu: %d (%m)", + map->ce.start, map->ce.size, ret); } return ret; @@ -2448,8 +2449,8 @@ int btrfs_fix_device_size(struct btrfs_fs_info *fs_info, trans = btrfs_start_transaction(chunk_root, 1); if (IS_ERR(trans)) { ret = PTR_ERR(trans); - error("error starting transaction: %d (%s)", - ret, strerror(-ret)); + errno = -ret; + error("error starting transaction: %d (%m)", ret); return ret; } @@ -2461,8 +2462,8 @@ int btrfs_fix_device_size(struct btrfs_fs_info *fs_info, goto err; } if (ret < 0) { - error("failed to search chunk root: %d (%s)", - ret, strerror(-ret)); + errno = -ret; + error("failed to search chunk root: %d (%m)", ret); goto err; } di = btrfs_item_ptr(path.nodes[0], path.slots[0], struct btrfs_dev_item); @@ -2470,8 +2471,8 @@ int btrfs_fix_device_size(struct btrfs_fs_info *fs_info, btrfs_mark_buffer_dirty(path.nodes[0]); ret = btrfs_commit_transaction(trans, chunk_root); if (ret < 0) { - error("failed to commit current transaction: %d (%s)", - ret, strerror(-ret)); + errno = -ret; + error("failed to commit current transaction: %d (%m)", ret); btrfs_release_path(&path); return ret; } @@ -2524,14 +2525,14 @@ int btrfs_fix_super_size(struct btrfs_fs_info *fs_info) trans = btrfs_start_transaction(fs_info->tree_root, 1); if (IS_ERR(trans)) { ret = PTR_ERR(trans); - error("error starting transaction: %d (%s)", - ret, strerror(-ret)); + errno = -ret; + error("error starting transaction: %d (%m)", ret); return ret; } ret = btrfs_commit_transaction(trans, fs_info->tree_root); if (ret < 0) { - error("failed to commit current transaction: %d (%s)", - ret, strerror(-ret)); + errno = -ret; + error("failed to commit current transaction: %d (%m)", ret); return ret; } printf("Fixed super total bytes, old size: %llu new size: %llu\n", |