Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1361525 > unrolled thread
| Started by | Al Viro <viro@ZenIV.linux.org.uk> |
|---|---|
| First post | 2016-03-21 06:30 +0100 |
| Last post | 2016-03-21 09:20 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH 1/4] vfs: add file_dentry() Al Viro <viro@ZenIV.linux.org.uk> - 2016-03-21 06:30 +0100
Re: [PATCH 1/4] vfs: add file_dentry() Miklos Szeredi <miklos@szeredi.hu> - 2016-03-21 09:20 +0100
| From | Al Viro <viro@ZenIV.linux.org.uk> |
|---|---|
| Date | 2016-03-21 06:30 +0100 |
| Subject | Re: [PATCH 1/4] vfs: add file_dentry() |
| Message-ID | <rf0zD-15e-3@gated-at.bofh.it> |
On Thu, Mar 17, 2016 at 10:02:00AM +0100, Miklos Szeredi wrote: > Add a new helper, file_dentry() [*], to get the filesystem's own dentry > from the file. This simply compares file_inode(file->f_path.dentry) to > file_inode(file) and if they are equal returns file->f_path.dentry (this is > the common, non-overlayfs case). > > In the uncommon case (regular file on overlayfs) it will call into > overlayfs's ->d_native_dentry() to get the underlying dentry matching > file_inode(file). What's wrong with making ovl_dentry_real() an instance of optional ->d_real() method and having a flag (DCACHE_OP_REAL) controlling its calls? With d_real(dentry) returning either that or dentry itself, and file_dentry(file) being simply d_real(file->f_path.dentry)... Why do we need to look at the inode at all? d_set_d_op() dereferences ->d_op anyway, as well as setting ->d_flags, so there's no extra cost there, and "test bit in ->d_flags + branch not taken" is all it would cost in normal case...
[toc] | [next] | [standalone]
| From | Miklos Szeredi <miklos@szeredi.hu> |
|---|---|
| Date | 2016-03-21 09:20 +0100 |
| Message-ID | <rf3ea-2Ra-29@gated-at.bofh.it> |
| In reply to | #1361525 |
On Mon, Mar 21, 2016 at 6:28 AM, Al Viro <viro@zeniv.linux.org.uk> wrote: > On Thu, Mar 17, 2016 at 10:02:00AM +0100, Miklos Szeredi wrote: >> Add a new helper, file_dentry() [*], to get the filesystem's own dentry >> from the file. This simply compares file_inode(file->f_path.dentry) to >> file_inode(file) and if they are equal returns file->f_path.dentry (this is >> the common, non-overlayfs case). >> >> In the uncommon case (regular file on overlayfs) it will call into >> overlayfs's ->d_native_dentry() to get the underlying dentry matching >> file_inode(file). > > What's wrong with making ovl_dentry_real() an instance of optional > ->d_real() method and having a flag (DCACHE_OP_REAL) controlling its > calls? With d_real(dentry) returning either that or dentry itself, > and file_dentry(file) being simply d_real(file->f_path.dentry)... > > Why do we need to look at the inode at all? d_set_d_op() dereferences > ->d_op anyway, as well as setting ->d_flags, so there's no extra cost > there, and "test bit in ->d_flags + branch not taken" is all it would > cost in normal case... Checking DCACHE_OP_REAL insted of inode would be fine. But d_real() needs inode as well. Consider the case where 1) file opened on lower layer 2) copied up 3) file_dentry() called d_real(file->f_path.dentry) would return the upper dentry but that's not what we want. Thanks, Miklos
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web