linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>
To: Ira Weiny <ira.weiny@intel.com>
Cc: Evgeniy Dushistov <dushistov@mail.ru>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] fs/ufs: Replace kmap() with kmap_local_page()
Date: Mon, 16 May 2022 12:07:14 +0200	[thread overview]
Message-ID: <13020190.uLZWGnKmhe@leap> (raw)
In-Reply-To: <YoGSjZlucCKjSxVX@iweiny-desk3>

On lunedì 16 maggio 2022 01:53:49 CEST Ira Weiny wrote:
> On Mon, May 09, 2022 at 09:12:07AM +0200, Fabio M. De Francesco wrote:
> > The use of kmap() is being deprecated in favor of kmap_local_page(). 
With
> > kmap_local_page(), the mapping is thread-local, CPU-local and not 
globally
> > visible.
> > 
> > The usage of kmap_local_page() in fs/ufs is thread-local, therefore 
replace
> > kmap() / kunmap() calls with kmap_local_page() / kunmap_local().
> > 
> > kunmap_local() requires the mapping address, so return that address 
from
> > ufs_get_page() to be used in ufs_put_page().
> > 
> > These changes are essentially ported from fs/ext2 and relie largely on
> > commit 782b76d7abdf ("fs/ext2: Replace kmap() with kmap_local_page()").
> > 
> > Suggested-by: Ira Weiny <ira.weiny@intel.com>
> > Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
> > ---
> > 
> > v1 -> v2: Correct some style's issues reported by checkpatch.pl.
> > 	  Remove "inline" compiler directive from fs/ufs/ufs.h,
> > 	  Reported-by: kernel test robot <lkp@intel.com>
> > 
> >  fs/ufs/dir.c   | 116 +++++++++++++++++++++++++++++++------------------
> >  fs/ufs/namei.c |  38 ++++++++--------
> >  fs/ufs/ufs.h   |  12 +++--
> >  3 files changed, 102 insertions(+), 64 deletions(-)
> > 
> >
> > [snip]
> >   
> > @@ -250,27 +251,31 @@ static int ufs_rename(struct user_namespace 
*mnt_userns, struct inode *old_dir,
> >  	struct inode *old_inode = d_inode(old_dentry);
> >  	struct inode *new_inode = d_inode(new_dentry);
> >  	struct page *dir_page = NULL;
> > +	void *dir_page_addr;
> >  	struct ufs_dir_entry * dir_de = NULL;
> >  	struct page *old_page;
> > +	void *old_page_addr;
> >  	struct ufs_dir_entry *old_de;
> >  	int err = -ENOENT;
> >  
> >  	if (flags & ~RENAME_NOREPLACE)
> >  		return -EINVAL;
> >  
> > -	old_de = ufs_find_entry(old_dir, &old_dentry->d_name, &old_page);
> > +	old_de = ufs_find_entry(old_dir, &old_dentry->d_name, &old_page,
> > +				&old_page_addr);
> >  	if (!old_de)
> >  		goto out;
> >  
> >  	if (S_ISDIR(old_inode->i_mode)) {
> >  		err = -EIO;
> > -		dir_de = ufs_dotdot(old_inode, &dir_page);
> > +		dir_de = ufs_dotdot(old_inode, &dir_page, 
&dir_page_addr);
> >  		if (!dir_de)
> >  			goto out_old;
> >  	}
> >  
> >  	if (new_inode) {
> >  		struct page *new_page;
> > +		void *page_addr;
> 
> Nit:
> 
> It might be good to make this new_page_addr to keep it straight with the 
other
> pages mapped in this function.
> 

Yes, it should be "new_page_addr" for consistency. I'm going to rename this 
variable and send v3.

>
> Regardless:
> 
> Reviewed-by: Ira Weiny <ira.weiny@intel.com>
> 

Thanks!

Fabio

> >  		struct ufs_dir_entry *new_de;
> >  
> >  		err = -ENOTEMPTY;
> > @@ -278,10 +283,11 @@ static int ufs_rename(struct user_namespace 
*mnt_userns, struct inode *old_dir,
> >  			goto out_dir;
> >  
> >  		err = -ENOENT;
> > -		new_de = ufs_find_entry(new_dir, &new_dentry->d_name, 
&new_page);
> > +		new_de = ufs_find_entry(new_dir, &new_dentry->d_name, 
&new_page,
> > +					&page_addr);
> >  		if (!new_de)
> >  			goto out_dir;
> > -		ufs_set_link(new_dir, new_de, new_page, old_inode, 1);
> > +		ufs_set_link(new_dir, new_de, new_page, page_addr, 
old_inode, 1);
> >  		new_inode->i_ctime = current_time(new_inode);
> >  		if (dir_de)
> >  			drop_nlink(new_inode);
> > @@ -300,29 +306,25 @@ static int ufs_rename(struct user_namespace 
*mnt_userns, struct inode *old_dir,
> >  	 */
> >  	old_inode->i_ctime = current_time(old_inode);
> >  
> > -	ufs_delete_entry(old_dir, old_de, old_page);
> > +	ufs_delete_entry(old_dir, old_de, old_page, old_page_addr);
> >  	mark_inode_dirty(old_inode);
> >  
> >  	if (dir_de) {
> >  		if (old_dir != new_dir)
> > -			ufs_set_link(old_inode, dir_de, dir_page, 
new_dir, 0);
> > -		else {
> > -			kunmap(dir_page);
> > -			put_page(dir_page);
> > -		}
> > +			ufs_set_link(old_inode, dir_de, dir_page,
> > +				     dir_page_addr, new_dir, 0);
> > +		else
> > +			ufs_put_page(dir_page, dir_page_addr);
> >  		inode_dec_link_count(old_dir);
> >  	}
> >  	return 0;
> >  
> >  
> >  out_dir:
> > -	if (dir_de) {
> > -		kunmap(dir_page);
> > -		put_page(dir_page);
> > -	}
> > +	if (dir_de)
> > +		ufs_put_page(dir_page, dir_page_addr);
> >  out_old:
> > -	kunmap(old_page);
> > -	put_page(old_page);
> > +	ufs_put_page(old_page, old_page_addr);
> >  out:
> >  	return err;
> >  }
> >
> > [snip]
> >



      reply	other threads:[~2022-05-16 10:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-09  7:12 [PATCH v2] fs/ufs: Replace kmap() with kmap_local_page() Fabio M. De Francesco
2022-05-15 23:53 ` Ira Weiny
2022-05-16 10:07   ` Fabio M. De Francesco [this message]

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=13020190.uLZWGnKmhe@leap \
    --to=fmdefrancesco@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).