public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: Evgeniy Dushistov <dushistov@mail.ru>,
	Ira Weiny <ira.weiny@intel.com>,
	linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 2/3] fs/ufs: Change the signature of ufs_get_page()
Date: Mon, 12 Dec 2022 00:56:10 +0100	[thread overview]
Message-ID: <2397878.jE0xQCEvom@suse> (raw)
In-Reply-To: <Y5ZZy23FFAnQDR3C@ZenIV>

On domenica 11 dicembre 2022 23:29:31 CET Al Viro wrote:
> On Sun, Dec 11, 2022 at 10:31:10PM +0100, Fabio M. De Francesco wrote:
> > -static struct page *ufs_get_page(struct inode *dir, unsigned long n)
> > +static void *ufs_get_page(struct inode *dir, unsigned long n, struct page
> > **page)> 
> >  {
> >  
> >  	struct address_space *mapping = dir->i_mapping;
> > 
> > -	struct page *page = read_mapping_page(mapping, n, NULL);
> > -	if (!IS_ERR(page)) {
> > -		kmap(page);
> > -		if (unlikely(!PageChecked(page))) {
> > -			if (!ufs_check_page(page))
> > +	*page = read_mapping_page(mapping, n, NULL);
> > +	if (!IS_ERR(*page)) {
> > +		kmap(*page);
> > +		if (unlikely(!PageChecked(*page))) {
> > +			if (!ufs_check_page(*page))
> > 
> >  				goto fail;
> >  		
> >  		}
> >  	
> >  	}
> >  	return page;
> 
> 	return page_address(page), surely?
> 
Yes, I'm sorry for these kinds of silly mistakes because while I was expecting 
to err on much more difficult topics I overlooked what I know pretty well  :-(

Shouldn't it be "return page_address(*page)" because of "page" being a pointer 
to pointer to "struct page"? Am I overlooking something?

However, the greater mistake was about doing the decomposition into three 
patches starting from the old single thing. I think that I had to start from 
scratch. I made the process the other way round. 
>
> >  fail:
> > -	ufs_put_page(page);
> > +	ufs_put_page(*page);
> > 
> >  	return ERR_PTR(-EIO);
> >  
> >  }
> > 
> > @@ -227,15 +227,12 @@ ufs_next_entry(struct super_block *sb, struct
> > ufs_dir_entry *p)> 
> >  struct ufs_dir_entry *ufs_dotdot(struct inode *dir, struct page **p)
> >  {
> > 
> > -	struct page *page = ufs_get_page(dir, 0);
> > -	struct ufs_dir_entry *de = NULL;
> > +	struct ufs_dir_entry *de = ufs_get_page(dir, 0, p);
> 
> ... considering e.g. this.  The caller expects the pointer to beginning of
> page, not pointer to struct page itself.  Other callers are also like 
that...
>
I'll send next version within tomorrow (before or after work time) because 
here it is 00.40 CET.

Thank you very much for your immediate reply.

Fabio




  reply	other threads:[~2022-12-11 23:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-11 21:31 [PATCH 0/3] fs/ufs: replace kmap() with kmap_local_page() Fabio M. De Francesco
2022-12-11 21:31 ` [PATCH 1/3] fs/ufs: Use the offset_in_page() helper Fabio M. De Francesco
2022-12-11 21:31 ` [PATCH 2/3] fs/ufs: Change the signature of ufs_get_page() Fabio M. De Francesco
2022-12-11 22:29   ` Al Viro
2022-12-11 23:56     ` Fabio M. De Francesco [this message]
2022-12-11 22:42   ` Al Viro
2022-12-12 20:08     ` Fabio M. De Francesco
2022-12-11 21:31 ` [PATCH 3/3] fs/ufs: Replace kmap() with kmap_local_page() Fabio M. De Francesco
2022-12-11 22:39   ` Al Viro
2022-12-12  0:14     ` Fabio M. De Francesco
2022-12-12  0:52   ` kernel test robot
2022-12-12  1:07     ` Al Viro

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=2397878.jE0xQCEvom@suse \
    --to=fmdefrancesco@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=dushistov@mail.ru \
    --cc=ira.weiny@intel.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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