public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>
Cc: Christoph Hellwig <hch@infradead.org>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Ira Weiny <ira.weiny@intel.com>,
	Dan Carpenter <error27@gmail.com>
Subject: Re: [PATCH v2 2/4] fs/sysv: Change the signature of dir_get_page()
Date: Wed, 11 Jan 2023 02:34:47 +0000	[thread overview]
Message-ID: <Y74gRx6jLf2RHgdq@ZenIV> (raw)
In-Reply-To: <20230109170639.19757-3-fmdefrancesco@gmail.com>

On Mon, Jan 09, 2023 at 06:06:37PM +0100, Fabio M. De Francesco wrote:
>  
> -struct sysv_dir_entry * sysv_dotdot (struct inode *dir, struct page **p)
> +struct sysv_dir_entry *sysv_dotdot(struct inode *dir, struct page **p)
>  {
> -	struct page *page = dir_get_page(dir, 0);
> -	struct sysv_dir_entry *de = NULL;
> +	struct page *page = NULL;
> +	struct sysv_dir_entry *de = dir_get_page(dir, 0, &page);
>  
> -	if (!IS_ERR(page)) {
> -		de = (struct sysv_dir_entry*) page_address(page) + 1;
> +	if (!IS_ERR(de)) {
>  		*p = page;
> +		return (struct sysv_dir_entry *)page_address(page) + 1;
>  	}
> -	return de;
> +	return NULL;
>  }

Would be better off with 

	struct sysv_dir_entry *de = dir_get_page(dir, 0, p);

	if (!IS_ERR(de))
		return de + 1;	// ".." is the second directory entry
	return NULL;

IMO...

  reply	other threads:[~2023-01-11  2:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-09 17:06 [PATCH v2 0/4] fs/sysv: Replace kmap() with kmap_local_page() Fabio M. De Francesco
2023-01-09 17:06 ` [PATCH v2 1/4] fs/sysv: Use the offset_in_page() helper Fabio M. De Francesco
2023-01-09 17:06 ` [PATCH v2 2/4] fs/sysv: Change the signature of dir_get_page() Fabio M. De Francesco
2023-01-11  2:34   ` Al Viro [this message]
2023-01-12 20:15     ` Fabio M. De Francesco
2023-01-09 17:06 ` [PATCH v2 3/4] fs/sysv: Use dir_put_page() in sysv_rename() Fabio M. De Francesco
2023-01-09 17:06 ` [PATCH v2 4/4] fs/sysv: Replace kmap() with kmap_local_page() Fabio M. De Francesco

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=Y74gRx6jLf2RHgdq@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=error27@gmail.com \
    --cc=fmdefrancesco@gmail.com \
    --cc=hch@infradead.org \
    --cc=ira.weiny@intel.com \
    --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