/* When a process starts or stops watching an inode the set of events which dnotify cares about for that inode may change. This function runs the list of everything receiving dnotify events about this directory and calculates the set of all those events. After it updates what dnotify is interested in it calls the fsnotify function so it can update the set of all events relevant to this inode.  */
static void dnotify_recalc_inode_mask(struct fsnotify_mark_entry *entry)
/* When a process starts or stops watching an inode the set of events which dnotify cares about for that inode may change. This function runs the list of everything receiving dnotify events about this directory and calculates the set of all those events. After it updates what dnotify is interested in it calls the fsnotify function so it can update the set of all events relevant to this inode.  */
static void dnotify_recalc_inode_mask(struct fsnotify_mark_entry *entry)
{
	__u32 new_mask, old_mask;
	struct dnotify_struct *dn;
	struct dnotify_mark_entry *dnentry  = container_of(entry,
							   struct dnotify_mark_entry,
							   fsn_entry);
	assert_spin_locked(&entry->lock);
	old_mask = entry->mask;
	new_mask = 0;
	for (dn = dnentry->dn; dn != NULL; dn = dn->dn_next)
		new_mask |= (dn->dn_mask & ~FS_DN_MULTISHOT);
	entry->mask = new_mask;
	if (old_mask == new_mask)
		return;
	if (entry->inode)
		fsnotify_recalc_inode_mask(entry->inode);
}