diff options
author | David Sterba <dsterba@suse.cz> | 2011-04-19 12:00:01 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2011-05-02 07:57:20 -0400 |
commit | c704005d886cf0bc9bc3974eb009b22fe0da32c7 (patch) | |
tree | b9effb8d686af95ca92782697b75a70bf34a3964 /fs/btrfs | |
parent | 4891aca2dac612a2f21a3278d9906ade13b55788 (diff) |
btrfs: unify checking of IS_ERR and null
use IS_ERR_OR_NULL when possible, done by this coccinelle script:
@ match @
identifier id;
@@
(
- BUG_ON(IS_ERR(id) || !id);
+ BUG_ON(IS_ERR_OR_NULL(id));
|
- IS_ERR(id) || !id
+ IS_ERR_OR_NULL(id)
|
- !id || IS_ERR(id)
+ IS_ERR_OR_NULL(id)
)
Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/acl.c | 2 | ||||
-rw-r--r-- | fs/btrfs/extent_io.c | 12 | ||||
-rw-r--r-- | fs/btrfs/file.c | 2 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 12 | ||||
-rw-r--r-- | fs/btrfs/relocation.c | 2 | ||||
-rw-r--r-- | fs/btrfs/tree-log.c | 4 |
6 files changed, 17 insertions, 17 deletions
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c index 5d505aaa72fb..1a21c99a91b8 100644 --- a/fs/btrfs/acl.c +++ b/fs/btrfs/acl.c | |||
@@ -287,7 +287,7 @@ int btrfs_acl_chmod(struct inode *inode) | |||
287 | return 0; | 287 | return 0; |
288 | 288 | ||
289 | acl = btrfs_get_acl(inode, ACL_TYPE_ACCESS); | 289 | acl = btrfs_get_acl(inode, ACL_TYPE_ACCESS); |
290 | if (IS_ERR(acl) || !acl) | 290 | if (IS_ERR_OR_NULL(acl)) |
291 | return PTR_ERR(acl); | 291 | return PTR_ERR(acl); |
292 | 292 | ||
293 | clone = posix_acl_clone(acl, GFP_KERNEL); | 293 | clone = posix_acl_clone(acl, GFP_KERNEL); |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index b730c12fa958..3c92712e9763 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -2056,7 +2056,7 @@ static int __extent_read_full_page(struct extent_io_tree *tree, | |||
2056 | } | 2056 | } |
2057 | em = get_extent(inode, page, pg_offset, cur, | 2057 | em = get_extent(inode, page, pg_offset, cur, |
2058 | end - cur + 1, 0); | 2058 | end - cur + 1, 0); |
2059 | if (IS_ERR(em) || !em) { | 2059 | if (IS_ERR_OR_NULL(em)) { |
2060 | SetPageError(page); | 2060 | SetPageError(page); |
2061 | unlock_extent(tree, cur, end, GFP_NOFS); | 2061 | unlock_extent(tree, cur, end, GFP_NOFS); |
2062 | break; | 2062 | break; |
@@ -2341,7 +2341,7 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc, | |||
2341 | } | 2341 | } |
2342 | em = epd->get_extent(inode, page, pg_offset, cur, | 2342 | em = epd->get_extent(inode, page, pg_offset, cur, |
2343 | end - cur + 1, 1); | 2343 | end - cur + 1, 1); |
2344 | if (IS_ERR(em) || !em) { | 2344 | if (IS_ERR_OR_NULL(em)) { |
2345 | SetPageError(page); | 2345 | SetPageError(page); |
2346 | break; | 2346 | break; |
2347 | } | 2347 | } |
@@ -2769,7 +2769,7 @@ int extent_prepare_write(struct extent_io_tree *tree, | |||
2769 | while (block_start <= block_end) { | 2769 | while (block_start <= block_end) { |
2770 | em = get_extent(inode, page, pg_offset, block_start, | 2770 | em = get_extent(inode, page, pg_offset, block_start, |
2771 | block_end - block_start + 1, 1); | 2771 | block_end - block_start + 1, 1); |
2772 | if (IS_ERR(em) || !em) | 2772 | if (IS_ERR_OR_NULL(em)) |
2773 | goto err; | 2773 | goto err; |
2774 | 2774 | ||
2775 | cur_end = min(block_end, extent_map_end(em) - 1); | 2775 | cur_end = min(block_end, extent_map_end(em) - 1); |
@@ -2899,7 +2899,7 @@ int try_release_extent_mapping(struct extent_map_tree *map, | |||
2899 | len = end - start + 1; | 2899 | len = end - start + 1; |
2900 | write_lock(&map->lock); | 2900 | write_lock(&map->lock); |
2901 | em = lookup_extent_mapping(map, start, len); | 2901 | em = lookup_extent_mapping(map, start, len); |
2902 | if (!em || IS_ERR(em)) { | 2902 | if (IS_ERR_OR_NULL(em)) { |
2903 | write_unlock(&map->lock); | 2903 | write_unlock(&map->lock); |
2904 | break; | 2904 | break; |
2905 | } | 2905 | } |
@@ -2942,7 +2942,7 @@ sector_t extent_bmap(struct address_space *mapping, sector_t iblock, | |||
2942 | em = get_extent(inode, NULL, 0, start, blksize, 0); | 2942 | em = get_extent(inode, NULL, 0, start, blksize, 0); |
2943 | unlock_extent_cached(&BTRFS_I(inode)->io_tree, start, | 2943 | unlock_extent_cached(&BTRFS_I(inode)->io_tree, start, |
2944 | start + blksize - 1, &cached_state, GFP_NOFS); | 2944 | start + blksize - 1, &cached_state, GFP_NOFS); |
2945 | if (!em || IS_ERR(em)) | 2945 | if (IS_ERR_OR_NULL(em)) |
2946 | return 0; | 2946 | return 0; |
2947 | 2947 | ||
2948 | if (em->block_start > EXTENT_MAP_LAST_BYTE) | 2948 | if (em->block_start > EXTENT_MAP_LAST_BYTE) |
@@ -2976,7 +2976,7 @@ static struct extent_map *get_extent_skip_holes(struct inode *inode, | |||
2976 | break; | 2976 | break; |
2977 | len = (len + sectorsize - 1) & ~(sectorsize - 1); | 2977 | len = (len + sectorsize - 1) & ~(sectorsize - 1); |
2978 | em = get_extent(inode, NULL, 0, offset, len, 0); | 2978 | em = get_extent(inode, NULL, 0, offset, len, 0); |
2979 | if (!em || IS_ERR(em)) | 2979 | if (IS_ERR_OR_NULL(em)) |
2980 | return em; | 2980 | return em; |
2981 | 2981 | ||
2982 | /* if this isn't a hole return it */ | 2982 | /* if this isn't a hole return it */ |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 75899a01dded..83abd274370b 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -1375,7 +1375,7 @@ static long btrfs_fallocate(struct file *file, int mode, | |||
1375 | while (1) { | 1375 | while (1) { |
1376 | em = btrfs_get_extent(inode, NULL, 0, cur_offset, | 1376 | em = btrfs_get_extent(inode, NULL, 0, cur_offset, |
1377 | alloc_end - cur_offset, 0); | 1377 | alloc_end - cur_offset, 0); |
1378 | BUG_ON(IS_ERR(em) || !em); | 1378 | BUG_ON(IS_ERR_OR_NULL(em)); |
1379 | last_byte = min(extent_map_end(em), alloc_end); | 1379 | last_byte = min(extent_map_end(em), alloc_end); |
1380 | last_byte = (last_byte + mask) & ~mask; | 1380 | last_byte = (last_byte + mask) & ~mask; |
1381 | if (em->block_start == EXTENT_MAP_HOLE || | 1381 | if (em->block_start == EXTENT_MAP_HOLE || |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index fc966472e3ad..ba760c3ced28 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -1855,7 +1855,7 @@ static int btrfs_io_failed_hook(struct bio *failed_bio, | |||
1855 | } | 1855 | } |
1856 | read_unlock(&em_tree->lock); | 1856 | read_unlock(&em_tree->lock); |
1857 | 1857 | ||
1858 | if (!em || IS_ERR(em)) { | 1858 | if (IS_ERR_OR_NULL(em)) { |
1859 | kfree(failrec); | 1859 | kfree(failrec); |
1860 | return -EIO; | 1860 | return -EIO; |
1861 | } | 1861 | } |
@@ -3006,7 +3006,7 @@ int btrfs_unlink_subvol(struct btrfs_trans_handle *trans, | |||
3006 | 3006 | ||
3007 | di = btrfs_lookup_dir_item(trans, root, path, dir->i_ino, | 3007 | di = btrfs_lookup_dir_item(trans, root, path, dir->i_ino, |
3008 | name, name_len, -1); | 3008 | name, name_len, -1); |
3009 | BUG_ON(!di || IS_ERR(di)); | 3009 | BUG_ON(IS_ERR_OR_NULL(di)); |
3010 | 3010 | ||
3011 | leaf = path->nodes[0]; | 3011 | leaf = path->nodes[0]; |
3012 | btrfs_dir_item_key_to_cpu(leaf, di, &key); | 3012 | btrfs_dir_item_key_to_cpu(leaf, di, &key); |
@@ -3022,7 +3022,7 @@ int btrfs_unlink_subvol(struct btrfs_trans_handle *trans, | |||
3022 | BUG_ON(ret != -ENOENT); | 3022 | BUG_ON(ret != -ENOENT); |
3023 | di = btrfs_search_dir_index_item(root, path, dir->i_ino, | 3023 | di = btrfs_search_dir_index_item(root, path, dir->i_ino, |
3024 | name, name_len); | 3024 | name, name_len); |
3025 | BUG_ON(!di || IS_ERR(di)); | 3025 | BUG_ON(IS_ERR_OR_NULL(di)); |
3026 | 3026 | ||
3027 | leaf = path->nodes[0]; | 3027 | leaf = path->nodes[0]; |
3028 | btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); | 3028 | btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); |
@@ -3032,7 +3032,7 @@ int btrfs_unlink_subvol(struct btrfs_trans_handle *trans, | |||
3032 | 3032 | ||
3033 | di = btrfs_lookup_dir_index_item(trans, root, path, dir->i_ino, | 3033 | di = btrfs_lookup_dir_index_item(trans, root, path, dir->i_ino, |
3034 | index, name, name_len, -1); | 3034 | index, name, name_len, -1); |
3035 | BUG_ON(!di || IS_ERR(di)); | 3035 | BUG_ON(IS_ERR_OR_NULL(di)); |
3036 | 3036 | ||
3037 | leaf = path->nodes[0]; | 3037 | leaf = path->nodes[0]; |
3038 | btrfs_dir_item_key_to_cpu(leaf, di, &key); | 3038 | btrfs_dir_item_key_to_cpu(leaf, di, &key); |
@@ -3635,7 +3635,7 @@ int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size) | |||
3635 | while (1) { | 3635 | while (1) { |
3636 | em = btrfs_get_extent(inode, NULL, 0, cur_offset, | 3636 | em = btrfs_get_extent(inode, NULL, 0, cur_offset, |
3637 | block_end - cur_offset, 0); | 3637 | block_end - cur_offset, 0); |
3638 | BUG_ON(IS_ERR(em) || !em); | 3638 | BUG_ON(IS_ERR_OR_NULL(em)); |
3639 | last_byte = min(extent_map_end(em), block_end); | 3639 | last_byte = min(extent_map_end(em), block_end); |
3640 | last_byte = (last_byte + mask) & ~mask; | 3640 | last_byte = (last_byte + mask) & ~mask; |
3641 | if (!test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) { | 3641 | if (!test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) { |
@@ -3841,7 +3841,7 @@ static int btrfs_inode_by_name(struct inode *dir, struct dentry *dentry, | |||
3841 | if (IS_ERR(di)) | 3841 | if (IS_ERR(di)) |
3842 | ret = PTR_ERR(di); | 3842 | ret = PTR_ERR(di); |
3843 | 3843 | ||
3844 | if (!di || IS_ERR(di)) | 3844 | if (IS_ERR_OR_NULL(di)) |
3845 | goto out_err; | 3845 | goto out_err; |
3846 | 3846 | ||
3847 | btrfs_dir_item_key_to_cpu(path->nodes[0], di, location); | 3847 | btrfs_dir_item_key_to_cpu(path->nodes[0], di, location); |
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 199a80134312..fed0aaec0753 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
@@ -3220,7 +3220,7 @@ static int delete_block_group_cache(struct btrfs_fs_info *fs_info, | |||
3220 | key.offset = 0; | 3220 | key.offset = 0; |
3221 | 3221 | ||
3222 | inode = btrfs_iget(fs_info->sb, &key, root, NULL); | 3222 | inode = btrfs_iget(fs_info->sb, &key, root, NULL); |
3223 | if (!inode || IS_ERR(inode) || is_bad_inode(inode)) { | 3223 | if (IS_ERR_OR_NULL(inode) || is_bad_inode(inode)) { |
3224 | if (inode && !IS_ERR(inode)) | 3224 | if (inode && !IS_ERR(inode)) |
3225 | iput(inode); | 3225 | iput(inode); |
3226 | return -ENOENT; | 3226 | return -ENOENT; |
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index f997ec0c1ba4..d5313d63f967 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -1205,7 +1205,7 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans, | |||
1205 | } else { | 1205 | } else { |
1206 | BUG(); | 1206 | BUG(); |
1207 | } | 1207 | } |
1208 | if (!dst_di || IS_ERR(dst_di)) { | 1208 | if (IS_ERR_OR_NULL(dst_di)) { |
1209 | /* we need a sequence number to insert, so we only | 1209 | /* we need a sequence number to insert, so we only |
1210 | * do inserts for the BTRFS_DIR_INDEX_KEY types | 1210 | * do inserts for the BTRFS_DIR_INDEX_KEY types |
1211 | */ | 1211 | */ |
@@ -1426,7 +1426,7 @@ again: | |||
1426 | dir_key->offset, | 1426 | dir_key->offset, |
1427 | name, name_len, 0); | 1427 | name, name_len, 0); |
1428 | } | 1428 | } |
1429 | if (!log_di || IS_ERR(log_di)) { | 1429 | if (IS_ERR_OR_NULL(log_di)) { |
1430 | btrfs_dir_item_key_to_cpu(eb, di, &location); | 1430 | btrfs_dir_item_key_to_cpu(eb, di, &location); |
1431 | btrfs_release_path(root, path); | 1431 | btrfs_release_path(root, path); |
1432 | btrfs_release_path(log, log_path); | 1432 | btrfs_release_path(log, log_path); |