* [PATCH] Btrfs: unify error handling of btrfs_lookup_dir_item
@ 2018-09-11 22:06 Liu Bo
2018-09-12 7:09 ` Nikolay Borisov
2018-09-12 12:42 ` David Sterba
0 siblings, 2 replies; 3+ messages in thread
From: Liu Bo @ 2018-09-11 22:06 UTC (permalink / raw)
To: linux-btrfs
Unify the error handling part with IS_ERR_OR_NULL.
No functional changes.
Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
---
fs/btrfs/inode.c | 21 +++++----------------
fs/btrfs/send.c | 8 ++------
2 files changed, 7 insertions(+), 22 deletions(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index fd64d7ac76f9..99ab0203b701 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3925,12 +3925,8 @@ static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans,
path->leave_spinning = 1;
di = btrfs_lookup_dir_item(trans, root, path, dir_ino,
name, name_len, -1);
- if (IS_ERR(di)) {
- ret = PTR_ERR(di);
- goto err;
- }
- if (!di) {
- ret = -ENOENT;
+ if (IS_ERR_OR_NULL(di)) {
+ ret = di ? PTR_ERR(di) : -ENOENT;
goto err;
}
ret = btrfs_delete_one_dir_name(trans, root, path, di);
@@ -4088,10 +4084,7 @@ static int btrfs_unlink_subvol(struct btrfs_trans_handle *trans,
di = btrfs_lookup_dir_item(trans, root, path, dir_ino,
name, name_len, -1);
if (IS_ERR_OR_NULL(di)) {
- if (!di)
- ret = -ENOENT;
- else
- ret = PTR_ERR(di);
+ ret = di ? PTR_ERR(di) : -ENOENT;
goto out;
}
@@ -5481,12 +5474,8 @@ static int btrfs_inode_by_name(struct inode *dir, struct dentry *dentry,
di = btrfs_lookup_dir_item(NULL, root, path, btrfs_ino(BTRFS_I(dir)),
name, namelen, 0);
- if (!di) {
- ret = -ENOENT;
- goto out;
- }
- if (IS_ERR(di)) {
- ret = PTR_ERR(di);
+ if (IS_ERR_OR_NULL(di)) {
+ ret = di ? PTR_ERR(di) : -ENOENT;
goto out;
}
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index ba8950bfd9c7..b8c83778f0f7 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -1693,12 +1693,8 @@ static int lookup_dir_item_inode(struct btrfs_root *root,
di = btrfs_lookup_dir_item(NULL, root, path,
dir, name, name_len, 0);
- if (!di) {
- ret = -ENOENT;
- goto out;
- }
- if (IS_ERR(di)) {
- ret = PTR_ERR(di);
+ if (IS_ERR_OR_NULL(di)) {
+ ret = di ? PTR_ERR(di) : -ENOENT;
goto out;
}
btrfs_dir_item_key_to_cpu(path->nodes[0], di, &key);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Btrfs: unify error handling of btrfs_lookup_dir_item
2018-09-11 22:06 [PATCH] Btrfs: unify error handling of btrfs_lookup_dir_item Liu Bo
@ 2018-09-12 7:09 ` Nikolay Borisov
2018-09-12 12:42 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: Nikolay Borisov @ 2018-09-12 7:09 UTC (permalink / raw)
To: Liu Bo, linux-btrfs
On 12.09.2018 01:06, Liu Bo wrote:
> Unify the error handling part with IS_ERR_OR_NULL.
>
> No functional changes.
>
> Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
> ---
> fs/btrfs/inode.c | 21 +++++----------------
> fs/btrfs/send.c | 8 ++------
> 2 files changed, 7 insertions(+), 22 deletions(-)
>
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index fd64d7ac76f9..99ab0203b701 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -3925,12 +3925,8 @@ static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans,
> path->leave_spinning = 1;
> di = btrfs_lookup_dir_item(trans, root, path, dir_ino,
> name, name_len, -1);
> - if (IS_ERR(di)) {
> - ret = PTR_ERR(di);
> - goto err;
> - }
> - if (!di) {
> - ret = -ENOENT;
> + if (IS_ERR_OR_NULL(di)) {
> + ret = di ? PTR_ERR(di) : -ENOENT;
> goto err;
> }
> ret = btrfs_delete_one_dir_name(trans, root, path, di);
> @@ -4088,10 +4084,7 @@ static int btrfs_unlink_subvol(struct btrfs_trans_handle *trans,
> di = btrfs_lookup_dir_item(trans, root, path, dir_ino,
> name, name_len, -1);
> if (IS_ERR_OR_NULL(di)) {
> - if (!di)
> - ret = -ENOENT;
> - else
> - ret = PTR_ERR(di);
> + ret = di ? PTR_ERR(di) : -ENOENT;
> goto out;
> }
>
> @@ -5481,12 +5474,8 @@ static int btrfs_inode_by_name(struct inode *dir, struct dentry *dentry,
>
> di = btrfs_lookup_dir_item(NULL, root, path, btrfs_ino(BTRFS_I(dir)),
> name, namelen, 0);
> - if (!di) {
> - ret = -ENOENT;
> - goto out;
> - }
> - if (IS_ERR(di)) {
> - ret = PTR_ERR(di);
> + if (IS_ERR_OR_NULL(di)) {
> + ret = di ? PTR_ERR(di) : -ENOENT;
> goto out;
> }
>
> diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
> index ba8950bfd9c7..b8c83778f0f7 100644
> --- a/fs/btrfs/send.c
> +++ b/fs/btrfs/send.c
> @@ -1693,12 +1693,8 @@ static int lookup_dir_item_inode(struct btrfs_root *root,
>
> di = btrfs_lookup_dir_item(NULL, root, path,
> dir, name, name_len, 0);
> - if (!di) {
> - ret = -ENOENT;
> - goto out;
> - }
> - if (IS_ERR(di)) {
> - ret = PTR_ERR(di);
> + if (IS_ERR_OR_NULL(di)) {
> + ret = di ? PTR_ERR(di) : -ENOENT;
> goto out;
> }
> btrfs_dir_item_key_to_cpu(path->nodes[0], di, &key);
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Btrfs: unify error handling of btrfs_lookup_dir_item
2018-09-11 22:06 [PATCH] Btrfs: unify error handling of btrfs_lookup_dir_item Liu Bo
2018-09-12 7:09 ` Nikolay Borisov
@ 2018-09-12 12:42 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2018-09-12 12:42 UTC (permalink / raw)
To: Liu Bo; +Cc: linux-btrfs
On Wed, Sep 12, 2018 at 06:06:26AM +0800, Liu Bo wrote:
> Unify the error handling part with IS_ERR_OR_NULL.
>
> No functional changes.
>
> Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
Reviewed-by: David Sterba <dsterba@suse.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-09-12 17:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-11 22:06 [PATCH] Btrfs: unify error handling of btrfs_lookup_dir_item Liu Bo
2018-09-12 7:09 ` Nikolay Borisov
2018-09-12 12:42 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).