Re: [PATCH v2 2/4] fs/sysv: Change the signature of dir_get_page()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On mercoledì 11 gennaio 2023 03:34:47 CET Al Viro wrote:
> 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...

I totally agree with you...

1) This comment is a good way to explain why we return "de + 1".
2) "*p = page" is redundant, so it's not necessary because we assign the out 
argument in dir_get_page() if and only if read_mapping_page() doesn't fail.

I will send v3 asap.

Thanks for your suggestions.

Fabio







[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux