All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: David Sterba <dsterba@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 04/11] btrfs: use free_device where opencoded
Date: Thu, 2 Nov 2017 19:25:10 +0800	[thread overview]
Message-ID: <7de54840-7a5a-5baa-b555-c1548d558e4e@oracle.com> (raw)
In-Reply-To: <eae0c7b1a25267d3af10f9f31155098c1bdbacaf.1509471604.git.dsterba@suse.com>



Looks good.

Reviewed-by: Anand Jain <anand.jain@oracle.com>

Thanks, Anand


On 11/01/2017 01:44 AM, David Sterba wrote:
> Signed-off-by: David Sterba <dsterba@suse.com>
> ---
>   fs/btrfs/volumes.c | 39 +++++++++++----------------------------
>   1 file changed, 11 insertions(+), 28 deletions(-)
> 
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 35c546aade83..f206e83d4f52 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -195,9 +195,7 @@ static void free_fs_devices(struct btrfs_fs_devices *fs_devices)
>   		device = list_entry(fs_devices->devices.next,
>   				    struct btrfs_device, dev_list);
>   		list_del(&device->dev_list);
> -		rcu_string_free(device->name);
> -		bio_put(device->flush_bio);
> -		kfree(device);
> +		free_device(device);
>   	}
>   	kfree(fs_devices);
>   }
> @@ -590,9 +588,7 @@ static void btrfs_free_stale_device(struct btrfs_device *cur_dev)
>   			} else {
>   				fs_devs->num_devices--;
>   				list_del(&dev->dev_list);
> -				rcu_string_free(dev->name);
> -				bio_put(dev->flush_bio);
> -				kfree(dev);
> +				free_device(dev);
>   			}
>   			break;
>   		}
> @@ -644,8 +640,7 @@ static noinline int device_list_add(const char *path,
>   
>   		name = rcu_string_strdup(path, GFP_NOFS);
>   		if (!name) {
> -			bio_put(device->flush_bio);
> -			kfree(device);
> +			free_device(device);
>   			return -ENOMEM;
>   		}
>   		rcu_assign_pointer(device->name, name);
> @@ -757,8 +752,7 @@ static struct btrfs_fs_devices *clone_fs_devices(struct btrfs_fs_devices *orig)
>   			name = rcu_string_strdup(orig_dev->name->str,
>   					GFP_KERNEL);
>   			if (!name) {
> -				bio_put(device->flush_bio);
> -				kfree(device);
> +				free_device(device);
>   				goto error;
>   			}
>   			rcu_assign_pointer(device->name, name);
> @@ -822,9 +816,7 @@ void btrfs_close_extra_devices(struct btrfs_fs_devices *fs_devices, int step)
>   		}
>   		list_del_init(&device->dev_list);
>   		fs_devices->num_devices--;
> -		rcu_string_free(device->name);
> -		bio_put(device->flush_bio);
> -		kfree(device);
> +		free_device(device);
>   	}
>   
>   	if (fs_devices->seed) {
> @@ -842,9 +834,7 @@ static void free_device_rcu(struct rcu_head *head)
>   	struct btrfs_device *device;
>   
>   	device = container_of(head, struct btrfs_device, rcu);
> -	rcu_string_free(device->name);
> -	bio_put(device->flush_bio);
> -	kfree(device);
> +	free_device(device);
>   }
>   
>   static void btrfs_close_bdev(struct btrfs_device *device)
> @@ -2354,8 +2344,7 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path
>   
>   	name = rcu_string_strdup(device_path, GFP_KERNEL);
>   	if (!name) {
> -		bio_put(device->flush_bio);
> -		kfree(device);
> +		free_device(device);
>   		ret = -ENOMEM;
>   		goto error;
>   	}
> @@ -2363,9 +2352,7 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path
>   
>   	trans = btrfs_start_transaction(root, 0);
>   	if (IS_ERR(trans)) {
> -		rcu_string_free(device->name);
> -		bio_put(device->flush_bio);
> -		kfree(device);
> +		free_device(device);
>   		ret = PTR_ERR(trans);
>   		goto error;
>   	}
> @@ -2507,9 +2494,7 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path
>   		sb->s_flags |= MS_RDONLY;
>   	if (trans)
>   		btrfs_end_transaction(trans);
> -	rcu_string_free(device->name);
> -	bio_put(device->flush_bio);
> -	kfree(device);
> +	free_device(device);
>   error:
>   	blkdev_put(bdev, FMODE_EXCL);
>   	if (seeding_dev && !unlocked) {
> @@ -2575,8 +2560,7 @@ int btrfs_init_dev_replace_tgtdev(struct btrfs_fs_info *fs_info,
>   
>   	name = rcu_string_strdup(device_path, GFP_KERNEL);
>   	if (!name) {
> -		bio_put(device->flush_bio);
> -		kfree(device);
> +		free_device(device);
>   		ret = -ENOMEM;
>   		goto error;
>   	}
> @@ -6292,8 +6276,7 @@ struct btrfs_device *btrfs_alloc_device(struct btrfs_fs_info *fs_info,
>   
>   		ret = find_next_devid(fs_info, &tmp);
>   		if (ret) {
> -			bio_put(dev->flush_bio);
> -			kfree(dev);
> +			free_device(dev);
>   			return ERR_PTR(ret);
>   		}
>   	}
> 

  reply	other threads:[~2017-11-02 11:25 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-31 17:44 [PATCH 00/11] Device fixes and cleanups David Sterba
2017-10-31 17:44 ` [PATCH 01/11] btrfs: add missing device::flush_bio puts David Sterba
2017-11-02  9:41   ` Nikolay Borisov
2017-11-06 13:24     ` David Sterba
2017-11-02 10:40   ` Anand Jain
2017-10-31 17:44 ` [PATCH 02/11] btrfs: rename device free rcu helper to free_device_rcu David Sterba
2017-10-31 17:44 ` [PATCH 03/11] btrfs: introduce free_device helper David Sterba
2017-10-31 17:44 ` [PATCH 04/11] btrfs: use free_device where opencoded David Sterba
2017-11-02 11:25   ` Anand Jain [this message]
2017-10-31 17:44 ` [PATCH 05/11] btrfs: simplify exit paths in btrfs_init_new_device David Sterba
2017-11-06  1:53   ` Anand Jain
2017-10-31 17:44 ` [PATCH 06/11] btrfs: document device locking David Sterba
2017-11-02 10:29   ` Nikolay Borisov
2017-11-06 13:51     ` David Sterba
2017-11-06 15:02       ` Nikolay Borisov
2017-11-06 15:09         ` David Sterba
2017-11-03 11:13   ` Anand Jain
2017-11-06  2:32     ` Anand Jain
2017-11-06 13:40       ` David Sterba
2017-11-06 13:36     ` David Sterba
2017-10-31 17:44 ` [PATCH 07/11] btrfs: dev_alloc_list is not protected by RCU, use normal list_del David Sterba
2017-10-31 17:44 ` [PATCH 08/11] btrfs: simplify btrfs_close_bdev David Sterba
2017-10-31 17:44 ` [PATCH 09/11] btrfs: switch to RCU for device traversal in btrfs_ioctl_dev_info David Sterba
2017-10-31 17:44 ` [PATCH 10/11] btrfs: switch to RCU for device traversal in btrfs_ioctl_fs_info David Sterba
2017-10-31 17:44 ` [PATCH 11/11] btrfs: use non-RCU list traversal in write_all_supers callees David Sterba
2017-11-02  9:49   ` Nikolay Borisov
2017-11-06 13:59     ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7de54840-7a5a-5baa-b555-c1548d558e4e@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=dsterba@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.