Commit 230d97d3 authored by Amir Goldstein's avatar Amir Goldstein Committed by Jan Kara
Browse files

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: default avatarAmir Goldstein <amir73il@gmail.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Message-Id: <20240317184154.1200192-4-amir73il@gmail.com>
parent f115815d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -159,7 +159,7 @@ nfsd_file_mark_find_or_create(struct nfsd_file *nf, struct inode *inode)

	do {
		fsnotify_group_lock(nfsd_file_fsnotify_group);
		mark = fsnotify_find_mark(&inode->i_fsnotify_marks,
		mark = fsnotify_find_inode_mark(inode,
						nfsd_file_fsnotify_group);
		if (mark) {
			nfm = nfsd_file_mark_get(container_of(mark,
+2 −2
Original line number Diff line number Diff line
@@ -162,7 +162,7 @@ void dnotify_flush(struct file *filp, fl_owner_t id)
	if (!S_ISDIR(inode->i_mode))
		return;

	fsn_mark = fsnotify_find_mark(&inode->i_fsnotify_marks, dnotify_group);
	fsn_mark = fsnotify_find_inode_mark(inode, dnotify_group);
	if (!fsn_mark)
		return;
	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)
	fsnotify_group_lock(dnotify_group);

	/* add the new_fsn_mark or find an old one. */
	fsn_mark = fsnotify_find_mark(&inode->i_fsnotify_marks, dnotify_group);
	fsn_mark = fsnotify_find_inode_mark(inode, dnotify_group);
	if (fsn_mark) {
		dn_mark = container_of(fsn_mark, struct dnotify_mark, fsn_mark);
		spin_lock(&fsn_mark->lock);
+1 −1
Original line number Diff line number Diff line
@@ -544,7 +544,7 @@ static int inotify_update_existing_watch(struct fsnotify_group *group,
	int create = (arg & IN_MASK_CREATE);
	int ret;

	fsn_mark = fsnotify_find_mark(&inode->i_fsnotify_marks, group);
	fsn_mark = fsnotify_find_inode_mark(inode, group);
	if (!fsn_mark)
		return -ENOENT;
	else if (create) {
+7 −0
Original line number Diff line number Diff line
@@ -789,6 +789,13 @@ static inline int fsnotify_add_inode_mark_locked(struct fsnotify_mark *mark,
					FSNOTIFY_OBJ_TYPE_INODE, add_flags);
}

static inline struct fsnotify_mark *fsnotify_find_inode_mark(
						struct inode *inode,
						struct fsnotify_group *group)
{
	return fsnotify_find_mark(&inode->i_fsnotify_marks, group);
}

/* given a group and a mark, flag mark to be freed when all references are dropped */
extern void fsnotify_destroy_mark(struct fsnotify_mark *mark,
				  struct fsnotify_group *group);
+1 −1
Original line number Diff line number Diff line
@@ -463,7 +463,7 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
	int n;

	fsnotify_group_lock(audit_tree_group);
	mark = fsnotify_find_mark(&inode->i_fsnotify_marks, audit_tree_group);
	mark = fsnotify_find_inode_mark(inode, audit_tree_group);
	if (!mark)
		return create_chunk(inode, tree);

Loading