Skip to content

Commit 230d97d

Browse files
amir73iljankara
authored andcommitted
fsnotify: create a wrapper fsnotify_find_inode_mark()
In preparation to passing an object pointer to fsnotify_find_mark(), add a wrapper fsnotify_find_inode_mark() and use it where possible. Signed-off-by: Amir Goldstein <[email protected]> Signed-off-by: Jan Kara <[email protected]> Message-Id: <[email protected]>
1 parent f115815 commit 230d97d

File tree

6 files changed

+14
-7
lines changed

6 files changed

+14
-7
lines changed

fs/nfsd/filecache.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ nfsd_file_mark_find_or_create(struct nfsd_file *nf, struct inode *inode)
159159

160160
do {
161161
fsnotify_group_lock(nfsd_file_fsnotify_group);
162-
mark = fsnotify_find_mark(&inode->i_fsnotify_marks,
163-
nfsd_file_fsnotify_group);
162+
mark = fsnotify_find_inode_mark(inode,
163+
nfsd_file_fsnotify_group);
164164
if (mark) {
165165
nfm = nfsd_file_mark_get(container_of(mark,
166166
struct nfsd_file_mark,

fs/notify/dnotify/dnotify.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ void dnotify_flush(struct file *filp, fl_owner_t id)
162162
if (!S_ISDIR(inode->i_mode))
163163
return;
164164

165-
fsn_mark = fsnotify_find_mark(&inode->i_fsnotify_marks, dnotify_group);
165+
fsn_mark = fsnotify_find_inode_mark(inode, dnotify_group);
166166
if (!fsn_mark)
167167
return;
168168
dn_mark = container_of(fsn_mark, struct dnotify_mark, fsn_mark);
@@ -326,7 +326,7 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned int arg)
326326
fsnotify_group_lock(dnotify_group);
327327

328328
/* add the new_fsn_mark or find an old one. */
329-
fsn_mark = fsnotify_find_mark(&inode->i_fsnotify_marks, dnotify_group);
329+
fsn_mark = fsnotify_find_inode_mark(inode, dnotify_group);
330330
if (fsn_mark) {
331331
dn_mark = container_of(fsn_mark, struct dnotify_mark, fsn_mark);
332332
spin_lock(&fsn_mark->lock);

fs/notify/inotify/inotify_user.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ static int inotify_update_existing_watch(struct fsnotify_group *group,
544544
int create = (arg & IN_MASK_CREATE);
545545
int ret;
546546

547-
fsn_mark = fsnotify_find_mark(&inode->i_fsnotify_marks, group);
547+
fsn_mark = fsnotify_find_inode_mark(inode, group);
548548
if (!fsn_mark)
549549
return -ENOENT;
550550
else if (create) {

include/linux/fsnotify_backend.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,13 @@ static inline int fsnotify_add_inode_mark_locked(struct fsnotify_mark *mark,
789789
FSNOTIFY_OBJ_TYPE_INODE, add_flags);
790790
}
791791

792+
static inline struct fsnotify_mark *fsnotify_find_inode_mark(
793+
struct inode *inode,
794+
struct fsnotify_group *group)
795+
{
796+
return fsnotify_find_mark(&inode->i_fsnotify_marks, group);
797+
}
798+
792799
/* given a group and a mark, flag mark to be freed when all references are dropped */
793800
extern void fsnotify_destroy_mark(struct fsnotify_mark *mark,
794801
struct fsnotify_group *group);

kernel/audit_tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
463463
int n;
464464

465465
fsnotify_group_lock(audit_tree_group);
466-
mark = fsnotify_find_mark(&inode->i_fsnotify_marks, audit_tree_group);
466+
mark = fsnotify_find_inode_mark(inode, audit_tree_group);
467467
if (!mark)
468468
return create_chunk(inode, tree);
469469

kernel/audit_watch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static inline struct audit_parent *audit_find_parent(struct inode *inode)
9090
struct audit_parent *parent = NULL;
9191
struct fsnotify_mark *entry;
9292

93-
entry = fsnotify_find_mark(&inode->i_fsnotify_marks, audit_watch_group);
93+
entry = fsnotify_find_inode_mark(inode, audit_watch_group);
9494
if (entry)
9595
parent = container_of(entry, struct audit_parent, mark);
9696

0 commit comments

Comments
 (0)