From: Eric Paris <eparis@parisplace.org>
To: Eric Paris <eparis@redhat.com>
Cc: linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk
Subject: Re: [PATCH 2/5] inotify: use ZERO_PAGE instead of private static declaration
Date: Mon, 10 Aug 2009 10:12:55 -0400 [thread overview]
Message-ID: <7e0fb38c0908100712h4dbd6c98y3807af36824ade41@mail.gmail.com> (raw)
In-Reply-To: <20090809215941.26204.52486.stgit@paris.rdu.redhat.com>
On Sun, Aug 9, 2009 at 5:59 PM, Eric Paris<eparis@redhat.com> wrote:
> inotify needs to pad filenames to an inotify event length. Currently this
> is done by copying 0s from an event declared globally. This patch doesn't
> waste global address space just to have some 0s and instead uses
> clear_user()
>
> Signed-off-by: Eric Paris <eparis@redhat.com>
Crap, the subject of this message is wrong. I'll fix the subject when
I commit, the summary and patch are correct.
-Eric
> ---
>
> fs/notify/inotify/inotify_user.c | 9 +++------
> 1 files changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
> index c17d5a3..c3086b0 100644
> --- a/fs/notify/inotify/inotify_user.c
> +++ b/fs/notify/inotify/inotify_user.c
> @@ -47,9 +47,6 @@
>
> static struct vfsmount *inotify_mnt __read_mostly;
>
> -/* this just sits here and wastes global memory. used to just pad userspace messages with zeros */
> -static struct inotify_event nul_inotify_event;
> -
> /* these are configurable via /proc/sys/fs/inotify/ */
> static int inotify_max_user_instances __read_mostly;
> static int inotify_max_queued_events __read_mostly;
> @@ -215,7 +212,7 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group,
> /*
> * fsnotify only stores the pathname, so here we have to send the pathname
> * and then pad that pathname out to a multiple of sizeof(inotify_event)
> - * with zeros. I get my zeros from the nul_inotify_event.
> + * with zeros.
> */
> if (name_len) {
> unsigned int len_to_zero = name_len - event->name_len;
> @@ -224,8 +221,8 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group,
> return -EFAULT;
> buf += event->name_len;
>
> - /* fill userspace with 0's from nul_inotify_event */
> - if (copy_to_user(buf, &nul_inotify_event, len_to_zero))
> + /* fill userspace with 0's */
> + if (clear_user(buf, len_to_zero))
> return -EFAULT;
> buf += len_to_zero;
> event_size += name_len;
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
next prev parent reply other threads:[~2009-08-10 14:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-09 21:59 [PATCH 1/5] fsnotify: use fsnotify_create_event to allocate the q_overflow event Eric Paris
2009-08-09 21:59 ` [PATCH 2/5] inotify: use ZERO_PAGE instead of private static declaration Eric Paris
2009-08-10 14:12 ` Eric Paris [this message]
2009-08-09 21:59 ` [PATCH 3/5] inotify: use container_of instead of casting Eric Paris
2009-08-09 21:59 ` [PATCH 4/5] fsnotify: kzalloc fsnotify groups Eric Paris
2009-08-09 21:59 ` [PATCH 5/5] fsnotify: use kmem_cache_zalloc to simplify event initialization Eric Paris
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=7e0fb38c0908100712h4dbd6c98y3807af36824ade41@mail.gmail.com \
--to=eparis@parisplace.org \
--cc=eparis@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®