Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Message-Id: <20240317184154.1200192-4-amir73il@gmail.com>

authored by

Amir Goldstein and committed by
Jan Kara
230d97d3 f115815d

+14 -7
+2 -2
fs/nfsd/filecache.c
··· 159 159 160 160 do { 161 161 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); 164 164 if (mark) { 165 165 nfm = nfsd_file_mark_get(container_of(mark, 166 166 struct nfsd_file_mark,
+2 -2
fs/notify/dnotify/dnotify.c
··· 162 162 if (!S_ISDIR(inode->i_mode)) 163 163 return; 164 164 165 - fsn_mark = fsnotify_find_mark(&inode->i_fsnotify_marks, dnotify_group); 165 + fsn_mark = fsnotify_find_inode_mark(inode, dnotify_group); 166 166 if (!fsn_mark) 167 167 return; 168 168 dn_mark = container_of(fsn_mark, struct dnotify_mark, fsn_mark); ··· 326 326 fsnotify_group_lock(dnotify_group); 327 327 328 328 /* 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); 330 330 if (fsn_mark) { 331 331 dn_mark = container_of(fsn_mark, struct dnotify_mark, fsn_mark); 332 332 spin_lock(&fsn_mark->lock);
+1 -1
fs/notify/inotify/inotify_user.c
··· 544 544 int create = (arg & IN_MASK_CREATE); 545 545 int ret; 546 546 547 - fsn_mark = fsnotify_find_mark(&inode->i_fsnotify_marks, group); 547 + fsn_mark = fsnotify_find_inode_mark(inode, group); 548 548 if (!fsn_mark) 549 549 return -ENOENT; 550 550 else if (create) {
+7
include/linux/fsnotify_backend.h
··· 789 789 FSNOTIFY_OBJ_TYPE_INODE, add_flags); 790 790 } 791 791 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 + 792 799 /* given a group and a mark, flag mark to be freed when all references are dropped */ 793 800 extern void fsnotify_destroy_mark(struct fsnotify_mark *mark, 794 801 struct fsnotify_group *group);
+1 -1
kernel/audit_tree.c
··· 463 463 int n; 464 464 465 465 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); 467 467 if (!mark) 468 468 return create_chunk(inode, tree); 469 469
+1 -1
kernel/audit_watch.c
··· 90 90 struct audit_parent *parent = NULL; 91 91 struct fsnotify_mark *entry; 92 92 93 - entry = fsnotify_find_mark(&inode->i_fsnotify_marks, audit_watch_group); 93 + entry = fsnotify_find_inode_mark(inode, audit_watch_group); 94 94 if (entry) 95 95 parent = container_of(entry, struct audit_parent, mark); 96 96