diff options
author | Tejun Heo <tj@kernel.org> | 2014-04-09 11:07:31 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-04-25 11:43:31 -0700 |
commit | d911d98748018f7c8facc035ba39c30f5cce6f9c (patch) | |
tree | 01bd2fd6dac3eddc47f6c0d119c2ffdcaa6b5fef /fs/btrfs/xattr.h | |
parent | 7d568a8383bbb9c1f5167781075906acb2bb1550 (diff) | |
download | op-kernel-dev-d911d98748018f7c8facc035ba39c30f5cce6f9c.zip op-kernel-dev-d911d98748018f7c8facc035ba39c30f5cce6f9c.tar.gz |
kernfs: make kernfs_notify() trigger inotify events too
kernfs_notify() is used to indicate either new data is available or
the content of a file has changed. It currently only triggers poll
which may not be the most convenient to monitor especially when there
are a lot to monitor. Let's hook it up to fsnotify too so that the
events can be monitored via inotify too.
fsnotify_modify() requires file * but kernfs_notify() doesn't have any
specific file associated; however, we can walk all super_blocks
associated with a kernfs_root and as kernfs always associate one ino
with inode and one dentry with an inode, it's trivial to look up the
dentry associated with a given kernfs_node. As any active monitor
would pin dentry, just looking up existing dentry is enough. This
patch looks up the dentry associated with the specified kernfs_node
and generates events equivalent to fsnotify_modify().
Note that as fsnotify doesn't provide fsnotify_modify() equivalent
which can be called with dentry, kernfs_notify() directly calls
fsnotify_parent() and fsnotify(). It might be better to add a wrapper
in fsnotify.h instead.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: John McCutchan <john@johnmccutchan.com>
Cc: Robert Love <rlove@rlove.org>
Cc: Eric Paris <eparis@parisplace.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/btrfs/xattr.h')
0 files changed, 0 insertions, 0 deletions