Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ff2fde99 authored by Al Viro's avatar Al Viro
Browse files

expand dentry_kill(dentry, 0) in shrink_dentry_list()



Result will be massaged to saner shape in the next commits.  It is
ugly, no questions - the point of that one is to be a provably
equivalent transformation (and it might be worth splitting a bit
more).

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent e55fd011
Loading
Loading
Loading
Loading
+17 −13
Original line number Original line Diff line number Diff line
@@ -801,6 +801,7 @@ static void shrink_dentry_list(struct list_head *list)
	struct dentry *dentry, *parent;
	struct dentry *dentry, *parent;


	while (!list_empty(list)) {
	while (!list_empty(list)) {
		struct inode *inode;
		dentry = list_entry(list->prev, struct dentry, d_lru);
		dentry = list_entry(list->prev, struct dentry, d_lru);
		spin_lock(&dentry->d_lock);
		spin_lock(&dentry->d_lock);
		/*
		/*
@@ -828,23 +829,26 @@ static void shrink_dentry_list(struct list_head *list)
			continue;
			continue;
		}
		}


		parent = dentry_kill(dentry, 0);
		inode = dentry->d_inode;
		/*
		if (inode && unlikely(!spin_trylock(&inode->i_lock))) {
		 * If dentry_kill returns NULL, we have nothing more to do.
			d_shrink_add(dentry, list);
		 */
			spin_unlock(&dentry->d_lock);
		if (!parent)
			continue;
			continue;
		}


		if (unlikely(parent == dentry)) {
		parent = NULL;
			/*
		if (!IS_ROOT(dentry)) {
			 * trylocks have failed and d_lock has been held the
			parent = dentry->d_parent;
			 * whole time, so it could not have been added to any
			if (unlikely(!spin_trylock(&parent->d_lock))) {
			 * other lists. Just add it back to the shrink list.
				if (inode)
			 */
					spin_unlock(&inode->i_lock);
				d_shrink_add(dentry, list);
				d_shrink_add(dentry, list);
				spin_unlock(&dentry->d_lock);
				spin_unlock(&dentry->d_lock);
				continue;
				continue;
			}
			}
		}

		__dentry_kill(dentry);
		/*
		/*
		 * We need to prune ancestors too. This is necessary to prevent
		 * We need to prune ancestors too. This is necessary to prevent
		 * quadratic behavior of shrink_dcache_parent(), but is also
		 * quadratic behavior of shrink_dcache_parent(), but is also