Re: [PATCH 2/3] fs/ufs: Change the signature of ufs_get_page()

From: Fabio M. De Francesco
Date: Sun Dec 11 2022 - 18:56:59 EST


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