From: Vivek Goyal <vgoyal@redhat.com>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>, zhangyi <yi.zhang@huawei.com>,
linux-unionfs@vger.kernel.org
Subject: Re: [PATCH v2 03/23] ovl: store layer index in ovl_layer
Date: Thu, 4 Jan 2018 16:00:18 -0500 [thread overview]
Message-ID: <20180104210018.GB2808@redhat.com> (raw)
In-Reply-To: <1515084018-25134-4-git-send-email-amir73il@gmail.com>
On Thu, Jan 04, 2018 at 06:39:58PM +0200, Amir Goldstein wrote:
> Store the fs root layer index inside ovl_layer struct, so we can
> get the root fs layer index from merge dir lower layer instead of
> find it with ovl_find_layer() helper.
>
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> ---
> fs/overlayfs/namei.c | 17 +----------------
> fs/overlayfs/ovl_entry.h | 2 ++
> fs/overlayfs/super.c | 1 +
> 3 files changed, 4 insertions(+), 16 deletions(-)
>
> diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
> index 71db9a966d88..a48ee02c4524 100644
> --- a/fs/overlayfs/namei.c
> +++ b/fs/overlayfs/namei.c
> @@ -572,18 +572,6 @@ int ovl_path_next(int idx, struct dentry *dentry, struct path *path)
> return (idx < oe->numlower) ? idx + 1 : -1;
> }
>
> -static int ovl_find_layer(struct ovl_fs *ofs, struct ovl_path *path)
> -{
> - int i;
> -
> - for (i = 0; i < ofs->numlower; i++) {
> - if (ofs->lower_layers[i].mnt == path->layer->mnt)
> - break;
> - }
> -
> - return i;
> -}
> -
> /* Fix missing 'origin' xattr */
> static int ovl_fix_origin(struct dentry *dentry, struct dentry *lower,
> struct dentry *upper)
> @@ -733,11 +721,8 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
>
> if (d.redirect && d.redirect[0] == '/' && poe != roe) {
> poe = roe;
> -
> /* Find the current layer on the root dentry */
> - i = ovl_find_layer(ofs, &lower);
> - if (WARN_ON(i == ofs->numlower))
> - break;
> + i = lower.layer->idx - 1;
> }
> }
>
> diff --git a/fs/overlayfs/ovl_entry.h b/fs/overlayfs/ovl_entry.h
> index 9d0bc03bf6e4..608e48755070 100644
> --- a/fs/overlayfs/ovl_entry.h
> +++ b/fs/overlayfs/ovl_entry.h
> @@ -22,6 +22,8 @@ struct ovl_config {
> struct ovl_layer {
> struct vfsmount *mnt;
> dev_t pseudo_dev;
> + /* Index of this layer in fs root (upper == 0) */
> + int idx;
Just curious. If we are stroing idx, then do we have to store ovl_layer
and every ovl_entry. Just idx can give us the position and we should
be able to then access mnt and pseudo_dev directly from
ofs->lower_layers[idx]. If yes, we can avoid storing vfsmount and
pseudo_dev per dentry.
Vivek
> };
>
> struct ovl_path {
> diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
> index 7e33c83c5a07..2b58620eedf0 100644
> --- a/fs/overlayfs/super.c
> +++ b/fs/overlayfs/super.c
> @@ -1111,6 +1111,7 @@ static int ovl_get_lower_layers(struct ovl_fs *ofs, struct path *stack,
>
> ofs->lower_layers[ofs->numlower].mnt = mnt;
> ofs->lower_layers[ofs->numlower].pseudo_dev = dev;
> + ofs->lower_layers[ofs->numlower].idx = i + 1;
> ofs->numlower++;
>
> /* Check if all lower layers are on same sb */
> --
> 2.7.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-unionfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2018-01-04 21:00 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-04 16:39 [PATCH v2 00/23] Overlayfs consistency verification with full index Amir Goldstein
2018-01-04 16:39 ` [PATCH v2 01/23] ovl: disable index when no xattr support Amir Goldstein
2018-01-04 16:39 ` [PATCH v2 02/23] ovl: ignore index mount option when no upper layer Amir Goldstein
2018-01-04 18:42 ` Vivek Goyal
2018-01-04 19:39 ` Amir Goldstein
2018-01-04 20:05 ` Vivek Goyal
2018-01-04 16:39 ` [PATCH v2 03/23] ovl: store layer index in ovl_layer Amir Goldstein
2018-01-04 21:00 ` Vivek Goyal [this message]
2018-01-05 5:05 ` Amir Goldstein
2018-01-05 11:22 ` Amir Goldstein
2018-01-05 15:00 ` Vivek Goyal
2018-01-05 17:51 ` Amir Goldstein
2018-01-09 8:36 ` Miklos Szeredi
2018-01-05 14:57 ` Vivek Goyal
2018-01-04 16:39 ` [PATCH v2 04/23] ovl: factor out ovl_check_origin_fh() Amir Goldstein
2018-01-04 16:40 ` [PATCH v2 05/23] ovl: pass ovl_layer array to ovl_check_origin_fh() Amir Goldstein
2018-01-04 22:35 ` Vivek Goyal
2018-01-05 5:26 ` Amir Goldstein
2018-01-04 16:40 ` [PATCH v2 06/23] ovl: add support for "verify" feature Amir Goldstein
2018-01-05 15:43 ` Vivek Goyal
2018-01-05 15:47 ` Amir Goldstein
2018-01-05 15:48 ` Amir Goldstein
2018-01-05 16:39 ` Vivek Goyal
2018-01-05 17:07 ` Amir Goldstein
2018-01-05 19:07 ` Vivek Goyal
2018-01-05 20:20 ` Amir Goldstein
2018-01-05 20:37 ` Amir Goldstein
2018-01-09 9:16 ` Miklos Szeredi
2018-01-09 9:54 ` Amir Goldstein
2018-01-09 10:07 ` Miklos Szeredi
2018-01-09 10:44 ` Amir Goldstein
2018-01-09 10:50 ` Miklos Szeredi
2018-01-04 16:40 ` [PATCH v2 07/23] ovl: verify stored origin fh matches lower dir Amir Goldstein
2018-01-05 16:04 ` Vivek Goyal
2018-01-05 16:26 ` Amir Goldstein
2018-01-05 16:35 ` Vivek Goyal
2018-01-05 16:42 ` Amir Goldstein
2018-01-05 18:33 ` Vivek Goyal
2018-01-05 19:00 ` Amir Goldstein
2018-01-09 9:52 ` Miklos Szeredi
2018-01-09 10:04 ` Amir Goldstein
2018-01-09 10:17 ` Miklos Szeredi
2018-01-04 16:40 ` [PATCH v2 08/23] ovl: unbless lower st_ino of files under unverified redirected dir Amir Goldstein
2018-01-09 13:31 ` Miklos Szeredi
2018-01-09 14:24 ` Amir Goldstein
2018-01-09 14:28 ` Miklos Szeredi
2018-01-04 16:40 ` [PATCH v2 09/23] ovl: lookup index for directories Amir Goldstein
2018-01-09 14:49 ` Miklos Szeredi
2018-01-09 16:07 ` Amir Goldstein
2018-01-04 16:40 ` [PATCH v2 10/23] ovl: verify whiteout index entries on mount Amir Goldstein
2018-01-04 16:40 ` [PATCH v2 11/23] ovl: verify directory " Amir Goldstein
2018-01-04 16:40 ` [PATCH v2 12/23] ovl: cleanup temp index entries Amir Goldstein
2018-01-09 15:25 ` Miklos Szeredi
2018-01-09 16:08 ` Amir Goldstein
2018-01-04 16:40 ` [PATCH v2 13/23] ovl: create ovl_need_index() helper Amir Goldstein
2018-01-04 16:40 ` [PATCH v2 14/23] ovl: index all files on copy up with 'verify=on' Amir Goldstein
2018-01-09 16:45 ` Vivek Goyal
2018-01-09 16:50 ` Amir Goldstein
2018-01-04 16:40 ` [PATCH v2 15/23] ovl: index directories " Amir Goldstein
2018-01-09 16:08 ` Miklos Szeredi
2018-01-09 16:31 ` Amir Goldstein
2018-01-09 16:35 ` Miklos Szeredi
2018-01-09 16:48 ` Amir Goldstein
2018-01-04 16:40 ` [PATCH v2 16/23] ovl: cleanup dir index when dir nlink drops to zero Amir Goldstein
2018-01-04 16:40 ` [PATCH v2 17/23] ovl: whiteout index when union " Amir Goldstein
2018-01-09 16:28 ` Miklos Szeredi
2018-01-09 16:41 ` Amir Goldstein
2018-01-04 16:40 ` [PATCH v2 18/23] ovl: whiteout orphan index entries on mount Amir Goldstein
2018-01-04 16:40 ` [PATCH v2 19/23] ovl: factor out ovl_get_index_fh() helper Amir Goldstein
2018-01-04 16:40 ` [PATCH v2 20/23] ovl: do not pass overlay dentry to ovl_get_inode() Amir Goldstein
2018-01-04 16:40 ` [PATCH v2 21/23] ovl: grab i_count reference of lower inode Amir Goldstein
2018-01-04 16:40 ` [PATCH v2 22/23] ovl: use d_splice_alias() in place of d_add() in lookup Amir Goldstein
2018-01-04 16:40 ` [PATCH v2 23/23] ovl: copy up of disconnected dentries Amir Goldstein
2018-01-11 14:47 ` Miklos Szeredi
2018-01-11 15:28 ` Amir Goldstein
2018-01-11 16:55 ` [PATCH v2 00/23] Overlayfs consistency verification with full index Amir Goldstein
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=20180104210018.GB2808@redhat.com \
--to=vgoyal@redhat.com \
--cc=amir73il@gmail.com \
--cc=linux-unionfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=yi.zhang@huawei.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox