* [PATCH] Btrfs: optimize check for stale device
@ 2015-10-05 8:57 Anand Jain
2015-10-07 8:59 ` Anand Jain
2015-10-07 9:01 ` David Sterba
0 siblings, 2 replies; 4+ messages in thread
From: Anand Jain @ 2015-10-05 8:57 UTC (permalink / raw)
To: linux-btrfs
optimize check for stale device to only be checked when there
is device added or changed. If there is no update to the
device, there is no need to call btrfs_free_stale_device().
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
fs/btrfs/volumes.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index b8b1171..ec1fcfa 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -620,7 +620,8 @@ static noinline int device_list_add(const char *path,
* if there is new btrfs on an already registered device,
* then remove the stale device entry.
*/
- btrfs_free_stale_device(device);
+ if (ret > 0)
+ btrfs_free_stale_device(device);
*fs_devices_ret = fs_devices;
--
2.4.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Btrfs: optimize check for stale device
2015-10-05 8:57 [PATCH] Btrfs: optimize check for stale device Anand Jain
@ 2015-10-07 8:59 ` Anand Jain
2015-10-07 9:08 ` David Sterba
2015-10-07 9:01 ` David Sterba
1 sibling, 1 reply; 4+ messages in thread
From: Anand Jain @ 2015-10-07 8:59 UTC (permalink / raw)
To: linux-btrfs, dsterba
On 10/05/2015 04:57 PM, Anand Jain wrote:
> optimize check for stale device to only be checked when there
> is device added or changed. If there is no update to the
> device, there is no need to call btrfs_free_stale_device().
>
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
> fs/btrfs/volumes.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index b8b1171..ec1fcfa 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -620,7 +620,8 @@ static noinline int device_list_add(const char *path,
> * if there is new btrfs on an already registered device,
> * then remove the stale device entry.
> */
> - btrfs_free_stale_device(device);
> + if (ret > 0)
> + btrfs_free_stale_device(device);
>
> *fs_devices_ret = fs_devices;
>
>
I have to withdraw this. The ret is 0 when there is new fsid on a
previously known device that means we need to clear the stale. v.sorry.
Thanks, Anand
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Btrfs: optimize check for stale device
2015-10-05 8:57 [PATCH] Btrfs: optimize check for stale device Anand Jain
2015-10-07 8:59 ` Anand Jain
@ 2015-10-07 9:01 ` David Sterba
1 sibling, 0 replies; 4+ messages in thread
From: David Sterba @ 2015-10-07 9:01 UTC (permalink / raw)
To: Anand Jain; +Cc: linux-btrfs
On Mon, Oct 05, 2015 at 04:57:17PM +0800, Anand Jain wrote:
> optimize check for stale device to only be checked when there
> is device added or changed. If there is no update to the
> device, there is no need to call btrfs_free_stale_device().
>
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
Ok for the change, same comment to the changelog (74 chars, capitals).
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Btrfs: optimize check for stale device
2015-10-07 8:59 ` Anand Jain
@ 2015-10-07 9:08 ` David Sterba
0 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2015-10-07 9:08 UTC (permalink / raw)
To: Anand Jain; +Cc: linux-btrfs, dsterba
On Wed, Oct 07, 2015 at 04:59:35PM +0800, Anand Jain wrote:
> > @@ -620,7 +620,8 @@ static noinline int device_list_add(const char *path,
> > * if there is new btrfs on an already registered device,
> > * then remove the stale device entry.
> > */
> > - btrfs_free_stale_device(device);
> > + if (ret > 0)
> > + btrfs_free_stale_device(device);
> >
> > *fs_devices_ret = fs_devices;
>
> I have to withdraw this. The ret is 0 when there is new fsid on a
> previously known device that means we need to clear the stale. v.sorry.
Ah, right.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-10-07 9:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-05 8:57 [PATCH] Btrfs: optimize check for stale device Anand Jain
2015-10-07 8:59 ` Anand Jain
2015-10-07 9:08 ` David Sterba
2015-10-07 9:01 ` 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).