All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Blunck <jblunck@suse.de>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: [RFC PATCH] mountinfo: show only reachable mounts
Date: Fri, 14 Mar 2008 16:17:53 +0100	[thread overview]
Message-ID: <20080314151753.GB27730@T61> (raw)
In-Reply-To: <E1JZoUG-0000q7-TV@pomaz-ex.szeredi.hu>

On Thu, Mar 13, Miklos Szeredi wrote:

> But I'm an idiot.  This is a much simpler and faster implementation
> that uses is_subdir(), which essentially does what you suggested:
> 
> /*
>  * Return true if 'path' is reachable from 'root'
>  */
> static bool is_path_reachable(const struct path *path, const struct path *root)
> {
> 	struct dentry *dentry = path->dentry;
> 	struct vfsmount *mnt = path->mnt;
> 	bool res = false;
> 
> 	spin_lock(&vfsmount_lock);
> 	while (mnt != root->mnt && mnt->mnt_parent != mnt) {
> 		dentry = mnt->mnt_mountpoint;
> 		mnt = mnt->mnt_parent;
> 	}
> 	if (mnt == root->mnt && is_subdir(dentry, root->dentry))
> 		res = true;
> 	spin_unlock(&vfsmount_lock);
> 
> 	return res;
> }

Very well.

BTW, I have a patch rotting in my quilt stack to remove
lives_below_in_same_fs() since is_subdir() provides the same
functionality.

Cheers,
Jan

  reply	other threads:[~2008-03-14 15:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-11 16:17 [RFC PATCH] mountinfo: show only reachable mounts Miklos Szeredi
2008-03-12 13:20 ` Jan Blunck
2008-03-12 18:11   ` Miklos Szeredi
2008-03-13 14:32     ` Miklos Szeredi
2008-03-14 15:17       ` Jan Blunck [this message]
2008-03-12 18:31 ` Ram Pai
2008-03-12 18:44   ` Miklos Szeredi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080314151753.GB27730@T61 \
    --to=jblunck@suse.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.