fsnotify: use type id to identify connector object type
An fsnotify_mark_connector is referencing a single type of object (either inode or vfsmount). Instead of storing a type mask in connector->flags, store a single type id in connector->type to identify the type of object. When a connector object is detached from the object, its type is set to FSNOTIFY_OBJ_TYPE_DETACHED and this object is not going to be reused. The function fsnotify_clear_marks_by_group() is the only place where type mask was used, so use type flags instead of type id to this function. This change is going to be more convenient when adding a new object type (super block). Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
@@ -77,7 +77,7 @@ static void inotify_fdinfo(struct seq_file *m, struct fsnotify_mark *mark)
|
||||
struct inotify_inode_mark *inode_mark;
|
||||
struct inode *inode;
|
||||
|
||||
if (!(mark->connector->flags & FSNOTIFY_OBJ_TYPE_INODE))
|
||||
if (mark->connector->type != FSNOTIFY_OBJ_TYPE_INODE)
|
||||
return;
|
||||
|
||||
inode_mark = container_of(mark, struct inotify_inode_mark, fsn_mark);
|
||||
@@ -116,7 +116,7 @@ static void fanotify_fdinfo(struct seq_file *m, struct fsnotify_mark *mark)
|
||||
if (mark->flags & FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY)
|
||||
mflags |= FAN_MARK_IGNORED_SURV_MODIFY;
|
||||
|
||||
if (mark->connector->flags & FSNOTIFY_OBJ_TYPE_INODE) {
|
||||
if (mark->connector->type == FSNOTIFY_OBJ_TYPE_INODE) {
|
||||
inode = igrab(mark->connector->inode);
|
||||
if (!inode)
|
||||
return;
|
||||
@@ -126,7 +126,7 @@ static void fanotify_fdinfo(struct seq_file *m, struct fsnotify_mark *mark)
|
||||
show_mark_fhandle(m, inode);
|
||||
seq_putc(m, '\n');
|
||||
iput(inode);
|
||||
} else if (mark->connector->flags & FSNOTIFY_OBJ_TYPE_VFSMOUNT) {
|
||||
} else if (mark->connector->type == FSNOTIFY_OBJ_TYPE_VFSMOUNT) {
|
||||
struct mount *mnt = real_mount(mark->connector->mnt);
|
||||
|
||||
seq_printf(m, "fanotify mnt_id:%x mflags:%x mask:%x ignored_mask:%x\n",
|
||||
|
Reference in New Issue
Block a user