Linux filesystem development
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Christian Brauner <brauner@kernel.org>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v2 1/6] fat: add fat_new_inode()
Date: Sat, 05 Dec 2026 16:43:19 +0900	[thread overview]
Message-ID: <87ecbw2mw8.fsf@mail.parknet.co.jp> (raw)
In-Reply-To: <20261130-work-fat-tmpfile-v2-1-99af97d95683@kernel.org>

Christian Brauner <brauner@kernel.org> writes:

> Move allocating and filling in the inode out of fat_build_inode() into
> fat_new_inode(). The O_TMPFILE support in the following patches needs
> an inode built the same way but without attaching it.
>
> No functional changes.
>
> Suggested-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
> Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>

Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

Thanks.

> ---
>  fs/fat/inode.c | 35 ++++++++++++++++++++++-------------
>  1 file changed, 22 insertions(+), 13 deletions(-)
>
> diff --git a/fs/fat/inode.c b/fs/fat/inode.c
> index 642e690632d83..25b9d8e3bb7de 100644
> --- a/fs/fat/inode.c
> +++ b/fs/fat/inode.c
> @@ -582,6 +582,26 @@ int fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de)
>  	return 0;
>  }
>  
> +/* Build an inode from @de without attaching or hashing it. */
> +static struct inode *fat_new_inode(struct super_block *sb,
> +				   struct msdos_dir_entry *de)
> +{
> +	struct inode *inode;
> +	int err;
> +
> +	inode = new_inode(sb);
> +	if (!inode)
> +		return ERR_PTR(-ENOMEM);
> +	inode->i_ino = iunique(sb, MSDOS_ROOT_INO);
> +	inode_set_iversion(inode, 1);
> +	err = fat_fill_inode(inode, de);
> +	if (err) {
> +		iput(inode);
> +		return ERR_PTR(err);
> +	}
> +	return inode;
> +}
> +
>  static inline void fat_lock_build_inode(struct msdos_sb_info *sbi)
>  {
>  	if (sbi->options.nfs == FAT_NFS_NOSTALE_RO)
> @@ -598,25 +618,14 @@ struct inode *fat_build_inode(struct super_block *sb,
>  			struct msdos_dir_entry *de, loff_t i_pos)
>  {
>  	struct inode *inode;
> -	int err;
>  
>  	fat_lock_build_inode(MSDOS_SB(sb));
>  	inode = fat_iget(sb, i_pos);
>  	if (inode)
>  		goto out;
> -	inode = new_inode(sb);
> -	if (!inode) {
> -		inode = ERR_PTR(-ENOMEM);
> -		goto out;
> -	}
> -	inode->i_ino = iunique(sb, MSDOS_ROOT_INO);
> -	inode_set_iversion(inode, 1);
> -	err = fat_fill_inode(inode, de);
> -	if (err) {
> -		iput(inode);
> -		inode = ERR_PTR(err);
> +	inode = fat_new_inode(sb, de);
> +	if (IS_ERR(inode))
>  		goto out;
> -	}
>  	fat_attach(inode, i_pos);
>  	insert_inode_hash(inode);
>  out:

-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

  reply	other threads:[~2026-12-05  7:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  8:57 [PATCH v2 0/6] fat: support O_TMPFILE Christian Brauner
2026-11-30  8:57 ` [PATCH v2 1/6] fat: add fat_new_inode() Christian Brauner
2026-12-05  7:43   ` OGAWA Hirofumi [this message]
2026-11-30  8:57 ` [PATCH v2 2/6] fat: add msdos_format_new_name() Christian Brauner
2026-12-05  7:43   ` OGAWA Hirofumi
2026-11-30  8:57 ` [PATCH v2 3/6] fat: add fat_tmpfile() Christian Brauner
2026-12-05  7:43   ` OGAWA Hirofumi
2026-11-30  8:57 ` [PATCH v2 4/6] fat: support O_TMPFILE on vfat Christian Brauner
2026-12-05  7:44   ` OGAWA Hirofumi
2026-11-30  8:57 ` [PATCH v2 5/6] fat: support O_TMPFILE on msdos Christian Brauner
2026-12-05  7:44   ` OGAWA Hirofumi
2026-11-30  8:57 ` [PATCH v2 6/6] selftests/filesystems: add FAT O_TMPFILE tests Christian Brauner
2026-12-05  7:44   ` OGAWA Hirofumi

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=87ecbw2mw8.fsf@mail.parknet.co.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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