Re: [PATCH 11/13] fs: remove d_real_inode()
From: Amir Goldstein
Date: Sun Nov 15 2026 - 09:49:00 EST
On Sun, Nov 15, 2026 at 3:02 PM Christian Brauner <brauner@xxxxxxxxxx> wrote:
>
> All callers have been converted to d_real_data_inode() or
> d_real_metadata_inode(). Remove d_real_inode() so that any user we
> missed, or one that gets added in another tree, fails to build instead
> of passing an ERR_PTR() from d_real() to d_inode().
>
> Add a porting.rst entry.
>
> Signed-off-by: Christian Brauner (Amutable) <brauner@xxxxxxxxxx>
Reviewed-by: Amir Goldstein <amir73il@xxxxxxxxx>
> ---
> Documentation/filesystems/porting.rst | 10 ++++++++++
> include/linux/dcache.h | 13 -------------
> 2 files changed, 10 insertions(+), 13 deletions(-)
>
> diff --git a/Documentation/filesystems/porting.rst b/Documentation/filesystems/porting.rst
> index c38f5df755bb5..28a24b702f2a6 100644
> --- a/Documentation/filesystems/porting.rst
> +++ b/Documentation/filesystems/porting.rst
> @@ -1422,3 +1422,13 @@ helpers take a const struct mnt_idmap *. mnt_idmap() and file_mnt_idmap()
> return one. The idmapping is immutable so nothing should have modified it
> anyway. References are taken and dropped via mnt_idmap_get() and
> mnt_idmap_put() as before, both accept a const pointer.
> +
> +---
> +
> +**mandatory**
> +
> +d_real_inode() is gone. d_real() can fail for D_REAL_DATA now and returns an
> +ERR_PTR() then, e.g., when overlayfs can't look up the data of a metacopy file
> +in a data-only layer. Use d_real_data_inode(), which returns the inode hosting
> +the data or an ERR_PTR(), and handle the error. Use d_real_metadata_inode() for
> +the inode hosting the metadata. That one never fails.
> diff --git a/include/linux/dcache.h b/include/linux/dcache.h
> index 5b3b34d271bd0..2b15179e9baf9 100644
> --- a/include/linux/dcache.h
> +++ b/include/linux/dcache.h
> @@ -654,19 +654,6 @@ static inline struct dentry *d_real(struct dentry *dentry, enum d_real_type type
> return dentry;
> }
>
> -/**
> - * d_real_inode - Return the real inode hosting the data
> - * @dentry: The dentry to query
> - *
> - * If dentry is on a union/overlay, then return the underlying, real inode.
> - * Otherwise return d_inode().
> - */
> -static inline struct inode *d_real_inode(const struct dentry *dentry)
> -{
> - /* This usage of d_real() results in const dentry */
> - return d_inode(d_real((struct dentry *) dentry, D_REAL_DATA));
> -}
> -
> /**
> * d_real_data_inode - Return the real inode hosting the data
> * @dentry: The dentry to query
>
> --
> 2.53.0
>