2024-03-19 16:04:46

by Wen Yang

[permalink] [raw]
Subject: [RESEND PATCH v2 8/9] fs: inotify: delete these unnecessary static variables it_zero and it_int_max

From: Wen Yang <[email protected]>

Delete unnecessary static variables (it_zero and it_int_max)
and encode them directly in the table entry.

Signed-off-by: Wen Yang <[email protected]>
Cc: Eric W. Biederman <[email protected]>
Cc: Luis Chamberlain <[email protected]>
Cc: Kees Cook <[email protected]>
Cc: Joel Granados <[email protected]>
Cc: Christian Brauner <[email protected]>
Cc: Jan Kara <[email protected]>
Cc: "Darrick J. Wong" <[email protected]>
Cc: [email protected]
---
fs/notify/inotify/inotify_user.c | 49 +++++++++++++-------------------
1 file changed, 20 insertions(+), 29 deletions(-)

diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index 85d8fdd55329..b346d61179ea 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -55,36 +55,27 @@ struct kmem_cache *inotify_inode_mark_cachep __ro_after_init;

#include <linux/sysctl.h>

-static long it_zero = 0;
-static long it_int_max = INT_MAX;
-
static struct ctl_table inotify_table[] = {
- {
- .procname = "max_user_instances",
- .data = &init_user_ns.ucount_max[UCOUNT_INOTIFY_INSTANCES],
- .maxlen = sizeof(long),
- .mode = 0644,
- .proc_handler = proc_doulongvec_minmax,
- .extra1 = &it_zero,
- .extra2 = &it_int_max,
- },
- {
- .procname = "max_user_watches",
- .data = &init_user_ns.ucount_max[UCOUNT_INOTIFY_WATCHES],
- .maxlen = sizeof(long),
- .mode = 0644,
- .proc_handler = proc_doulongvec_minmax,
- .extra1 = &it_zero,
- .extra2 = &it_int_max,
- },
- {
- .procname = "max_queued_events",
- .data = &inotify_max_queued_events,
- .maxlen = sizeof(int),
- .mode = 0644,
- .proc_handler = proc_dointvec_minmax,
- .extra1 = SYSCTL_ZERO
- },
+ CTL_TABLE_ENTRY_MINMAX("max_user_instances",
+ &init_user_ns.ucount_max[UCOUNT_INOTIFY_INSTANCES],
+ sizeof(long),
+ 0644,
+ proc_doulongvec_minmax,
+ SYSCTL_NUMERIC_ZERO,
+ SYSCTL_NUMERIC_INT_MAX),
+ CTL_TABLE_ENTRY_MINMAX("max_user_watches",
+ &init_user_ns.ucount_max[UCOUNT_INOTIFY_WATCHES],
+ sizeof(long),
+ 0644,
+ proc_doulongvec_minmax,
+ SYSCTL_NUMERIC_ZERO,
+ SYSCTL_NUMERIC_INT_MAX),
+ CTL_TABLE_ENTRY_MIN("max_queued_events",
+ &inotify_max_queued_events,
+ sizeof(int),
+ 0644,
+ proc_dointvec_minmax,
+ SYSCTL_NUMERIC_ZERO),
};

static void __init inotify_sysctls_init(void)
--
2.25.1



2024-03-20 10:36:16

by Jan Kara

[permalink] [raw]
Subject: Re: [RESEND PATCH v2 8/9] fs: inotify: delete these unnecessary static variables it_zero and it_int_max

On Tue 19-03-24 23:57:49, [email protected] wrote:
> From: Wen Yang <[email protected]>
>
> Delete unnecessary static variables (it_zero and it_int_max)
> and encode them directly in the table entry.
>
> Signed-off-by: Wen Yang <[email protected]>
> Cc: Eric W. Biederman <[email protected]>
> Cc: Luis Chamberlain <[email protected]>
> Cc: Kees Cook <[email protected]>
> Cc: Joel Granados <[email protected]>
> Cc: Christian Brauner <[email protected]>
> Cc: Jan Kara <[email protected]>
> Cc: "Darrick J. Wong" <[email protected]>
> Cc: [email protected]

This looks as a sensible cleanup but I don't see the first patch in the
series (and neither it is archived at lore.kernel.org) so I cannot really
verify whether your conversion is correct...

Honza

> ---
> fs/notify/inotify/inotify_user.c | 49 +++++++++++++-------------------
> 1 file changed, 20 insertions(+), 29 deletions(-)
>
> diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
> index 85d8fdd55329..b346d61179ea 100644
> --- a/fs/notify/inotify/inotify_user.c
> +++ b/fs/notify/inotify/inotify_user.c
> @@ -55,36 +55,27 @@ struct kmem_cache *inotify_inode_mark_cachep __ro_after_init;
>
> #include <linux/sysctl.h>
>
> -static long it_zero = 0;
> -static long it_int_max = INT_MAX;
> -
> static struct ctl_table inotify_table[] = {
> - {
> - .procname = "max_user_instances",
> - .data = &init_user_ns.ucount_max[UCOUNT_INOTIFY_INSTANCES],
> - .maxlen = sizeof(long),
> - .mode = 0644,
> - .proc_handler = proc_doulongvec_minmax,
> - .extra1 = &it_zero,
> - .extra2 = &it_int_max,
> - },
> - {
> - .procname = "max_user_watches",
> - .data = &init_user_ns.ucount_max[UCOUNT_INOTIFY_WATCHES],
> - .maxlen = sizeof(long),
> - .mode = 0644,
> - .proc_handler = proc_doulongvec_minmax,
> - .extra1 = &it_zero,
> - .extra2 = &it_int_max,
> - },
> - {
> - .procname = "max_queued_events",
> - .data = &inotify_max_queued_events,
> - .maxlen = sizeof(int),
> - .mode = 0644,
> - .proc_handler = proc_dointvec_minmax,
> - .extra1 = SYSCTL_ZERO
> - },
> + CTL_TABLE_ENTRY_MINMAX("max_user_instances",
> + &init_user_ns.ucount_max[UCOUNT_INOTIFY_INSTANCES],
> + sizeof(long),
> + 0644,
> + proc_doulongvec_minmax,
> + SYSCTL_NUMERIC_ZERO,
> + SYSCTL_NUMERIC_INT_MAX),
> + CTL_TABLE_ENTRY_MINMAX("max_user_watches",
> + &init_user_ns.ucount_max[UCOUNT_INOTIFY_WATCHES],
> + sizeof(long),
> + 0644,
> + proc_doulongvec_minmax,
> + SYSCTL_NUMERIC_ZERO,
> + SYSCTL_NUMERIC_INT_MAX),
> + CTL_TABLE_ENTRY_MIN("max_queued_events",
> + &inotify_max_queued_events,
> + sizeof(int),
> + 0644,
> + proc_dointvec_minmax,
> + SYSCTL_NUMERIC_ZERO),
> };
>
> static void __init inotify_sysctls_init(void)
> --
> 2.25.1
>
--
Jan Kara <[email protected]>
SUSE Labs, CR

2024-03-21 10:56:41

by Joel Granados

[permalink] [raw]
Subject: Re: [RESEND PATCH v2 8/9] fs: inotify: delete these unnecessary static variables it_zero and it_int_max

On Wed, Mar 20, 2024 at 11:36:03AM +0100, Jan Kara wrote:
> On Tue 19-03-24 23:57:49, [email protected] wrote:
> > From: Wen Yang <[email protected]>
> >
> > Delete unnecessary static variables (it_zero and it_int_max)
> > and encode them directly in the table entry.
> >
> > Signed-off-by: Wen Yang <[email protected]>
> > Cc: Eric W. Biederman <[email protected]>
> > Cc: Luis Chamberlain <[email protected]>
> > Cc: Kees Cook <[email protected]>
> > Cc: Joel Granados <[email protected]>
> > Cc: Christian Brauner <[email protected]>
> > Cc: Jan Kara <[email protected]>
> > Cc: "Darrick J. Wong" <[email protected]>
> > Cc: [email protected]
>
> This looks as a sensible cleanup but I don't see the first patch in the
> series (and neither it is archived at lore.kernel.org) so I cannot really
> verify whether your conversion is correct...
This was my original comment. If you want to see the cover letter
look for this mail ID [email protected]

Not sure why it separates the cover letter from the rest of the patches.

Best
>
> Honza
>

--

Joel Granados


Attachments:
(No filename) (1.16 kB)
signature.asc (673.00 B)
Download all attachments

2024-03-21 11:39:15

by Jan Kara

[permalink] [raw]
Subject: Re: [RESEND PATCH v2 8/9] fs: inotify: delete these unnecessary static variables it_zero and it_int_max

On Thu 21-03-24 11:55:55, Joel Granados wrote:
> On Wed, Mar 20, 2024 at 11:36:03AM +0100, Jan Kara wrote:
> > On Tue 19-03-24 23:57:49, [email protected] wrote:
> > > From: Wen Yang <[email protected]>
> > >
> > > Delete unnecessary static variables (it_zero and it_int_max)
> > > and encode them directly in the table entry.
> > >
> > > Signed-off-by: Wen Yang <[email protected]>
> > > Cc: Eric W. Biederman <[email protected]>
> > > Cc: Luis Chamberlain <[email protected]>
> > > Cc: Kees Cook <[email protected]>
> > > Cc: Joel Granados <[email protected]>
> > > Cc: Christian Brauner <[email protected]>
> > > Cc: Jan Kara <[email protected]>
> > > Cc: "Darrick J. Wong" <[email protected]>
> > > Cc: [email protected]
> >
> > This looks as a sensible cleanup but I don't see the first patch in the
> > series (and neither it is archived at lore.kernel.org) so I cannot really
> > verify whether your conversion is correct...
> This was my original comment. If you want to see the cover letter
> look for this mail ID [email protected]
>
> Not sure why it separates the cover letter from the rest of the patches.

No, that is actually a different email :) Based on lore the message ID
should be:
26c450f6467b4cbaf94cdb10f047abc6ab0c2a5d.1710863674.git.wenyang.linux@foxmail.com

but the email is not in the archive...

Honza
--
Jan Kara <[email protected]>
SUSE Labs, CR

2024-03-21 15:03:08

by Wen Yang

[permalink] [raw]
Subject: Re: [RESEND PATCH v2 8/9] fs: inotify: delete these unnecessary static variables it_zero and it_int_max



On 2024/3/21 19:38, Jan Kara wrote:
> On Thu 21-03-24 11:55:55, Joel Granados wrote:
>> On Wed, Mar 20, 2024 at 11:36:03AM +0100, Jan Kara wrote:
>>> On Tue 19-03-24 23:57:49, [email protected] wrote:
>>>> From: Wen Yang <[email protected]>
>>>>
>>>> Delete unnecessary static variables (it_zero and it_int_max)
>>>> and encode them directly in the table entry.
>>>>
>>>> Signed-off-by: Wen Yang <[email protected]>
>>>> Cc: Eric W. Biederman <[email protected]>
>>>> Cc: Luis Chamberlain <[email protected]>
>>>> Cc: Kees Cook <[email protected]>
>>>> Cc: Joel Granados <[email protected]>
>>>> Cc: Christian Brauner <[email protected]>
>>>> Cc: Jan Kara <[email protected]>
>>>> Cc: "Darrick J. Wong" <[email protected]>
>>>> Cc: [email protected]
>>>
>>> This looks as a sensible cleanup but I don't see the first patch in the
>>> series (and neither it is archived at lore.kernel.org) so I cannot really
>>> verify whether your conversion is correct...
>> This was my original comment. If you want to see the cover letter
>> look for this mail ID [email protected]
>>
>> Not sure why it separates the cover letter from the rest of the patches.
>
> No, that is actually a different email :) Based on lore the message ID
> should be:
> 26c450f6467b4cbaf94cdb10f047abc6ab0c2a5d.1710863674.git.wenyang.linux@foxmail.com
>
> but the email is not in the archive...
>
> Honza

Sorry, my email box changed the message ID when sending, but it can be
found in lcore:


or
https://lore.kernel.org/all/[email protected]/


If it causes any inconvenience to you, I can resend it. After some
experiments, I have finally found a way to send them in a thread.

--
Best wishes,
Wen






2024-03-21 16:48:11

by Joel Granados

[permalink] [raw]
Subject: Re: [RESEND PATCH v2 8/9] fs: inotify: delete these unnecessary static variables it_zero and it_int_max

On Thu, Mar 21, 2024 at 10:41:26PM +0800, Wen Yang wrote:
>
>
> On 2024/3/21 19:38, Jan Kara wrote:
> > On Thu 21-03-24 11:55:55, Joel Granados wrote:
> >> On Wed, Mar 20, 2024 at 11:36:03AM +0100, Jan Kara wrote:
> >>> On Tue 19-03-24 23:57:49, [email protected] wrote:
> >>>> From: Wen Yang <[email protected]>
> >>>>
> >>>> Delete unnecessary static variables (it_zero and it_int_max)
> >>>> and encode them directly in the table entry.
> >>>>
> >>>> Signed-off-by: Wen Yang <[email protected]>
> >>>> Cc: Eric W. Biederman <[email protected]>
> >>>> Cc: Luis Chamberlain <[email protected]>
> >>>> Cc: Kees Cook <[email protected]>
> >>>> Cc: Joel Granados <[email protected]>
> >>>> Cc: Christian Brauner <[email protected]>
> >>>> Cc: Jan Kara <[email protected]>
> >>>> Cc: "Darrick J. Wong" <[email protected]>
> >>>> Cc: [email protected]
> >>>
> >>> This looks as a sensible cleanup but I don't see the first patch in the
> >>> series (and neither it is archived at lore.kernel.org) so I cannot really
> >>> verify whether your conversion is correct...
> >> This was my original comment. If you want to see the cover letter
> >> look for this mail ID [email protected]
> >>
> >> Not sure why it separates the cover letter from the rest of the patches.
> >
> > No, that is actually a different email :) Based on lore the message ID
> > should be:
> > 26c450f6467b4cbaf94cdb10f047abc6ab0c2a5d.1710863674.git.wenyang.linux@foxmail.com
> >
> > but the email is not in the archive...
> >
> > Honza
>
> Sorry, my email box changed the message ID when sending, but it can be
> found in lcore:
>
>
> or
> https://lore.kernel.org/all/[email protected]/
>
>
> If it causes any inconvenience to you, I can resend it. After some
> experiments, I have finally found a way to send them in a thread.
Before resending it, please read my comments to your original patchset.

--

Joel Granados


Attachments:
(No filename) (2.02 kB)
signature.asc (673.00 B)
Download all attachments

2024-03-21 17:00:06

by Joel Granados

[permalink] [raw]
Subject: Re: [RESEND PATCH v2 8/9] fs: inotify: delete these unnecessary static variables it_zero and it_int_max

On Thu, Mar 21, 2024 at 12:38:49PM +0100, Jan Kara wrote:
> On Thu 21-03-24 11:55:55, Joel Granados wrote:
> > On Wed, Mar 20, 2024 at 11:36:03AM +0100, Jan Kara wrote:
> > > On Tue 19-03-24 23:57:49, [email protected] wrote:
> > > > From: Wen Yang <[email protected]>
> > > >
> > > > Delete unnecessary static variables (it_zero and it_int_max)
> > > > and encode them directly in the table entry.
> > > >
> > > > Signed-off-by: Wen Yang <[email protected]>
> > > > Cc: Eric W. Biederman <[email protected]>
> > > > Cc: Luis Chamberlain <[email protected]>
> > > > Cc: Kees Cook <[email protected]>
> > > > Cc: Joel Granados <[email protected]>
> > > > Cc: Christian Brauner <[email protected]>
> > > > Cc: Jan Kara <[email protected]>
> > > > Cc: "Darrick J. Wong" <[email protected]>
> > > > Cc: [email protected]
> > >
> > > This looks as a sensible cleanup but I don't see the first patch in the
> > > series (and neither it is archived at lore.kernel.org) so I cannot really
> > > verify whether your conversion is correct...
> > This was my original comment. If you want to see the cover letter
> > look for this mail ID [email protected]
> >
> > Not sure why it separates the cover letter from the rest of the patches.
>
> No, that is actually a different email :) Based on lore the message ID
Indeed. I have no idea where I got that ID from. I went back and found
the one I wanted: https://lore.kernel.org/all/[email protected]/
that one is the original V2. This one is just a resend AFAIK.

> should be:
> 26c450f6467b4cbaf94cdb10f047abc6ab0c2a5d.1710863674.git.wenyang.linux@foxmail.com
>
> but the email is not in the archive...
>
> Honza
> --
> Jan Kara <[email protected]>
> SUSE Labs, CR

--

Joel Granados


Attachments:
(No filename) (1.85 kB)
signature.asc (673.00 B)
Download all attachments