2015-11-06 17:18:17

by Shivani Bhardwaj

[permalink] [raw]
Subject: [PATCH 0/3] Remove wrapper function and clean up the code

This patchset removes a wrapper function, its prototype and replace its calls
in different files with a standard function.
After applying this patch, code becomes cleaner.

Shivani Bhardwaj (3):
Staging: lustre: module: Replace function calls
Staging: lustre: tracefile: Remove wrapper function
Staging: lustre: tracefile: Remove function prototype

drivers/staging/lustre/lustre/libcfs/module.c | 4 ++--
drivers/staging/lustre/lustre/libcfs/tracefile.c | 9 ++-------
drivers/staging/lustre/lustre/libcfs/tracefile.h | 1 -
3 files changed, 4 insertions(+), 10 deletions(-)

--
2.1.0


2015-11-06 17:18:56

by Shivani Bhardwaj

[permalink] [raw]
Subject: [PATCH 1/3] Staging: lustre: module: Replace function calls

Replace the calls of function cfs_trace_free_string_buffer() with
kfree() as the former function is not required.

Signed-off-by: Shivani Bhardwaj <[email protected]>
---
drivers/staging/lustre/lustre/libcfs/module.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c
index 50e8fd2..516a9e7 100644
--- a/drivers/staging/lustre/lustre/libcfs/module.c
+++ b/drivers/staging/lustre/lustre/libcfs/module.c
@@ -392,7 +392,7 @@ static int __proc_dobitmasks(void *data, int write,
} else {
rc = cfs_trace_copyin_string(tmpstr, tmpstrlen, buffer, nob);
if (rc < 0) {
- cfs_trace_free_string_buffer(tmpstr, tmpstrlen);
+ kfree(tmpstr);
return rc;
}

@@ -402,7 +402,7 @@ static int __proc_dobitmasks(void *data, int write,
*mask |= D_EMERG;
}

- cfs_trace_free_string_buffer(tmpstr, tmpstrlen);
+ kfree(tmpstr);
return rc;
}

--
2.1.0

2015-11-06 17:19:34

by Shivani Bhardwaj

[permalink] [raw]
Subject: [PATCH 2/3] Staging: lustre: tracefile: Remove wrapper function

Remove the function cfs_trace_free_string_buffer() as it can be replaced
with the standard function kfree().

Signed-off-by: Shivani Bhardwaj <[email protected]>
---
drivers/staging/lustre/lustre/libcfs/tracefile.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.c b/drivers/staging/lustre/lustre/libcfs/tracefile.c
index d55dda8..211047f 100644
--- a/drivers/staging/lustre/lustre/libcfs/tracefile.c
+++ b/drivers/staging/lustre/lustre/libcfs/tracefile.c
@@ -817,11 +817,6 @@ int cfs_trace_allocate_string_buffer(char **str, int nob)
return 0;
}

-void cfs_trace_free_string_buffer(char *str, int nob)
-{
- kfree(str);
-}
-
int cfs_trace_dump_debug_buffer_usrstr(void __user *usr_str, int usr_str_nob)
{
char *str;
@@ -842,7 +837,7 @@ int cfs_trace_dump_debug_buffer_usrstr(void __user *usr_str, int usr_str_nob)
}
rc = cfs_tracefile_dump_all_pages(str);
out:
- cfs_trace_free_string_buffer(str, usr_str_nob + 1);
+ kfree(str);
return rc;
}

@@ -898,7 +893,7 @@ int cfs_trace_daemon_command_usrstr(void __user *usr_str, int usr_str_nob)
if (rc == 0)
rc = cfs_trace_daemon_command(str);

- cfs_trace_free_string_buffer(str, usr_str_nob + 1);
+ kfree(str);
return rc;
}

--
2.1.0

2015-11-06 17:20:38

by Shivani Bhardwaj

[permalink] [raw]
Subject: [PATCH 3/3] Staging: lustre: tracefile: Remove function prototype

Remove the prototype of function cfs_trace_free_string_buffer() as it is
no longer needed.

Signed-off-by: Shivani Bhardwaj <[email protected]>
---
drivers/staging/lustre/lustre/libcfs/tracefile.h | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.h b/drivers/staging/lustre/lustre/libcfs/tracefile.h
index 73d60e0..ba62005 100644
--- a/drivers/staging/lustre/lustre/libcfs/tracefile.h
+++ b/drivers/staging/lustre/lustre/libcfs/tracefile.h
@@ -70,7 +70,6 @@ int cfs_trace_copyin_string(char *knl_buffer, int knl_buffer_nob,
int cfs_trace_copyout_string(char __user *usr_buffer, int usr_buffer_nob,
const char *knl_str, char *append);
int cfs_trace_allocate_string_buffer(char **str, int nob);
-void cfs_trace_free_string_buffer(char *str, int nob);
int cfs_trace_dump_debug_buffer_usrstr(void __user *usr_str, int usr_str_nob);
int cfs_trace_daemon_command(char *str);
int cfs_trace_daemon_command_usrstr(void __user *usr_str, int usr_str_nob);
--
2.1.0

2015-11-06 22:03:31

by Simmons, James A.

[permalink] [raw]
Subject: RE: [PATCH 2/3] Staging: lustre: tracefile: Remove wrapper function

>-----Original Message-----
>From: devel [mailto:[email protected]] On Behalf Of Shivani Bhardwaj
>Sent: Friday, November 06, 2015 12:19 PM
>To: [email protected]
>Cc: [email protected]; [email protected]; [email protected]; [email protected]
>Subject: [PATCH 2/3] Staging: lustre: tracefile: Remove wrapper function
>
>Remove the function cfs_trace_free_string_buffer() as it can be replaced
>with the standard function kfree().
>
>Signed-off-by: Shivani Bhardwaj <[email protected]>
>---
> drivers/staging/lustre/lustre/libcfs/tracefile.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)

Acked-by: James Simmons <[email protected]>

diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.c b/drivers/staging/lustre/lustre/libcfs/tracefile.c
index d55dda8..211047f 100644
--- a/drivers/staging/lustre/lustre/libcfs/tracefile.c
+++ b/drivers/staging/lustre/lustre/libcfs/tracefile.c
@@ -817,11 +817,6 @@ int cfs_trace_allocate_string_buffer(char **str, int nob)
return 0;
}

-void cfs_trace_free_string_buffer(char *str, int nob)
-{
- kfree(str);
-}
-
int cfs_trace_dump_debug_buffer_usrstr(void __user *usr_str, int usr_str_nob)
{
char *str;
@@ -842,7 +837,7 @@ int cfs_trace_dump_debug_buffer_usrstr(void __user *usr_str, int usr_str_nob)
}
rc = cfs_tracefile_dump_all_pages(str);
out:
- cfs_trace_free_string_buffer(str, usr_str_nob + 1);
+ kfree(str);
return rc;
}

@@ -898,7 +893,7 @@ int cfs_trace_daemon_command_usrstr(void __user *usr_str, int usr_str_nob)
if (rc == 0)
rc = cfs_trace_daemon_command(str);

- cfs_trace_free_string_buffer(str, usr_str_nob + 1);
+ kfree(str);
return rc;
}

--
2.1.0

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

2015-11-06 22:04:44

by Simmons, James A.

[permalink] [raw]
Subject: RE: [PATCH 1/3] Staging: lustre: module: Replace function calls

>From: devel [mailto:[email protected]] On Behalf Of Shivani Bhardwaj
>Sent: Friday, November 06, 2015 12:18 PM
>To: [email protected]
>Cc: [email protected]; [email protected]; [email protected]; [email protected]
>Subject: [PATCH 1/3] Staging: lustre: module: Replace function calls
>
>Replace the calls of function cfs_trace_free_string_buffer() with
>kfree() as the former function is not required.
>
>Signed-off-by: Shivani Bhardwaj <[email protected]>
>---
> drivers/staging/lustre/lustre/libcfs/module.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)

Acked-by: James Simmons <[email protected]>

diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c
index 50e8fd2..516a9e7 100644
--- a/drivers/staging/lustre/lustre/libcfs/module.c
+++ b/drivers/staging/lustre/lustre/libcfs/module.c
@@ -392,7 +392,7 @@ static int __proc_dobitmasks(void *data, int write,
} else {
rc = cfs_trace_copyin_string(tmpstr, tmpstrlen, buffer, nob);
if (rc < 0) {
- cfs_trace_free_string_buffer(tmpstr, tmpstrlen);
+ kfree(tmpstr);
return rc;
}

@@ -402,7 +402,7 @@ static int __proc_dobitmasks(void *data, int write,
*mask |= D_EMERG;
}

- cfs_trace_free_string_buffer(tmpstr, tmpstrlen);
+ kfree(tmpstr);
return rc;
}

--
2.1.0

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

2015-11-07 07:32:18

by Dilger, Andreas

[permalink] [raw]
Subject: Re: [PATCH 3/3] Staging: lustre: tracefile: Remove function prototype

On 2015/11/06, 10:19, "Shivani Bhardwaj" <[email protected]> wrote:

>Remove the prototype of function cfs_trace_free_string_buffer() as it is
>no longer needed.

These patches would be a lot more useful if the summary contained the name
of the function being removed, rather than "remove function prototype" and
variations of that. Something like:

staging: lustre: remove cfs_trace_free_string_buffer prototype
staging: lustre: remove ldlm_pool_set_limit wrapper
staging: lustre: remove ldlm_pool_get_limit wrapper

Not sure if that is grounds for rejection of this patch series (I'll leave
that up to Dan and Greg), but definitely something for future patches.

Cheers, Andreas

>Signed-off-by: Shivani Bhardwaj <[email protected]>
>---
> drivers/staging/lustre/lustre/libcfs/tracefile.h | 1 -
> 1 file changed, 1 deletion(-)
>
>diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.h
>b/drivers/staging/lustre/lustre/libcfs/tracefile.h
>index 73d60e0..ba62005 100644
>--- a/drivers/staging/lustre/lustre/libcfs/tracefile.h
>+++ b/drivers/staging/lustre/lustre/libcfs/tracefile.h
>@@ -70,7 +70,6 @@ int cfs_trace_copyin_string(char *knl_buffer, int
>knl_buffer_nob,
> int cfs_trace_copyout_string(char __user *usr_buffer, int usr_buffer_nob,
> const char *knl_str, char *append);
> int cfs_trace_allocate_string_buffer(char **str, int nob);
>-void cfs_trace_free_string_buffer(char *str, int nob);
> int cfs_trace_dump_debug_buffer_usrstr(void __user *usr_str, int
>usr_str_nob);
> int cfs_trace_daemon_command(char *str);
> int cfs_trace_daemon_command_usrstr(void __user *usr_str, int
>usr_str_nob);
>--
>2.1.0
>
>


Cheers, Andreas
--
Andreas Dilger

Lustre Software Architect
Intel High Performance Data Division

2015-11-07 07:50:28

by Shivani Bhardwaj

[permalink] [raw]
Subject: Re: [PATCH 3/3] Staging: lustre: tracefile: Remove function prototype

On Sat, Nov 7, 2015 at 1:02 PM, Dilger, Andreas
<[email protected]> wrote:
> On 2015/11/06, 10:19, "Shivani Bhardwaj" <[email protected]> wrote:
>
>>Remove the prototype of function cfs_trace_free_string_buffer() as it is
>>no longer needed.
>
> These patches would be a lot more useful if the summary contained the name
> of the function being removed, rather than "remove function prototype" and
> variations of that. Something like:
>
> staging: lustre: remove cfs_trace_free_string_buffer prototype
> staging: lustre: remove ldlm_pool_set_limit wrapper
> staging: lustre: remove ldlm_pool_get_limit wrapper
>
> Not sure if that is grounds for rejection of this patch series (I'll leave
> that up to Dan and Greg), but definitely something for future patches.
>
> Cheers, Andreas
>

I'll definitely take care of this for future patches that I submit.

Thank you
Shivani

>>Signed-off-by: Shivani Bhardwaj <[email protected]>
>>---
>> drivers/staging/lustre/lustre/libcfs/tracefile.h | 1 -
>> 1 file changed, 1 deletion(-)
>>
>>diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.h
>>b/drivers/staging/lustre/lustre/libcfs/tracefile.h
>>index 73d60e0..ba62005 100644
>>--- a/drivers/staging/lustre/lustre/libcfs/tracefile.h
>>+++ b/drivers/staging/lustre/lustre/libcfs/tracefile.h
>>@@ -70,7 +70,6 @@ int cfs_trace_copyin_string(char *knl_buffer, int
>>knl_buffer_nob,
>> int cfs_trace_copyout_string(char __user *usr_buffer, int usr_buffer_nob,
>> const char *knl_str, char *append);
>> int cfs_trace_allocate_string_buffer(char **str, int nob);
>>-void cfs_trace_free_string_buffer(char *str, int nob);
>> int cfs_trace_dump_debug_buffer_usrstr(void __user *usr_str, int
>>usr_str_nob);
>> int cfs_trace_daemon_command(char *str);
>> int cfs_trace_daemon_command_usrstr(void __user *usr_str, int
>>usr_str_nob);
>>--
>>2.1.0
>>
>>
>
>
> Cheers, Andreas
> --
> Andreas Dilger
>
> Lustre Software Architect
> Intel High Performance Data Division
>
>

2015-11-07 11:15:52

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH 1/3] Staging: lustre: module: Replace function calls

On Fri, Nov 06, 2015 at 10:04:41PM +0000, Simmons, James A. wrote:
> >From: devel [mailto:[email protected]] On Behalf Of Shivani Bhardwaj
> >Sent: Friday, November 06, 2015 12:18 PM
> >To: [email protected]
> >Cc: [email protected]; [email protected]; [email protected]; [email protected]
> >Subject: [PATCH 1/3] Staging: lustre: module: Replace function calls
> >
> >Replace the calls of function cfs_trace_free_string_buffer() with
> >kfree() as the former function is not required.
> >
> >Signed-off-by: Shivani Bhardwaj <[email protected]>
> >---
> > drivers/staging/lustre/lustre/libcfs/module.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
>
> Acked-by: James Simmons <[email protected]>
>
> diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c
> index 50e8fd2..516a9e7 100644
> --- a/drivers/staging/lustre/lustre/libcfs/module.c
> +++ b/drivers/staging/lustre/lustre/libcfs/module.c
> @@ -392,7 +392,7 @@ static int __proc_dobitmasks(void *data, int write,
> } else {

Why do your acks include the original diff without the "> " prefix? How
are you even managing that trick?

regards,
dan carpenter

2015-11-07 19:27:20

by Dilger, Andreas

[permalink] [raw]
Subject: Re: [PATCH 1/3] Staging: lustre: module: Replace function calls

On Nov 7, 2015, at 04:15, Dan Carpenter <[email protected]> wrote:
>
> On Fri, Nov 06, 2015 at 10:04:41PM +0000, Simmons, James A. wrote:
>>> From: devel [mailto:[email protected]] On Behalf Of Shivani Bhardwaj
>>> Sent: Friday, November 06, 2015 12:18 PM
>>> To: [email protected]
>>> Cc: [email protected]; [email protected]; [email protected]; [email protected]
>>> Subject: [PATCH 1/3] Staging: lustre: module: Replace function calls
>>>
>>> Replace the calls of function cfs_trace_free_string_buffer() with
>>> kfree() as the former function is not required.
>>>
>>> Signed-off-by: Shivani Bhardwaj <[email protected]>
>>> ---
>>> drivers/staging/lustre/lustre/libcfs/module.c | 4 ++--
>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> Acked-by: James Simmons <[email protected]>
>>
>> diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c
>> index 50e8fd2..516a9e7 100644
>> --- a/drivers/staging/lustre/lustre/libcfs/module.c
>> +++ b/drivers/staging/lustre/lustre/libcfs/module.c
>> @@ -392,7 +392,7 @@ static int __proc_dobitmasks(void *data, int write,
>> } else {
>
> Why do your acks include the original diff without the "> " prefix? How
> are you even managing that trick?

I was wondering the same, though it does look nicer.

Cheers, Andreas-