linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Liu Bo <bo.li.liu@oracle.com>
To: dsterba@suse.cz
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] Btrfs: remove duplicated find_get_pages_contig
Date: Thu, 2 Feb 2017 11:11:15 -0800	[thread overview]
Message-ID: <20170202191115.GE6550@localhost.localdomain> (raw)
In-Reply-To: <20170202184243.GE16723@twin.jikos.cz>

On Thu, Feb 02, 2017 at 07:42:43PM +0100, David Sterba wrote:
> On Mon, Jan 30, 2017 at 12:26:30PM -0800, Liu Bo wrote:
> > This creates a helper to manipulate page bits to avoid duplicate uses.
> 
> This seems too short for what the patch does. It adds a new page ops bit
> that would deserve a separate patch. Please try to split it to smaller
> parts.

Hmm..the newly added 'PAGE_LOCK' is only used in lock_delalloc_pages in
order to make the helper lock pages.

I could firstly introduce the helper from extent_clear_unlock_delalloc()
, then introduce the new 'PAGE_LOCK' and make lock_delalloc_pages and
__unlock_for_delalloc to use the helper, does it sound better to review
and bisect?

> 
> > +static noinline void __unlock_for_delalloc(struct inode *inode,
> > +					   struct page *locked_page,
> > +					   u64 start, u64 end)
> > +{
> > +	unsigned long page_ops = PAGE_UNLOCK;
> 
> Used only once, not necessary IMO.

OK.

> 
> > +
> > +	ASSERT(locked_page);
> > +	__process_pages_contig(inode->i_mapping, locked_page,
> > +			       start >> PAGE_SHIFT, end >> PAGE_SHIFT,
> > +			       page_ops, NULL);
> > +}
> > +
> > +static noinline int lock_delalloc_pages(struct inode *inode,
> > +					struct page *locked_page,
> > +					u64 delalloc_start,
> > +					u64 delalloc_end)
> > +{
> > +	pgoff_t index = delalloc_start >> PAGE_SHIFT;
> > +	pgoff_t start_index = index;
> > +	pgoff_t end_index = delalloc_end >> PAGE_SHIFT;
> > +	unsigned long page_ops = PAGE_LOCK;
> 
> Same here.
> 

OK.

Thanks,

-liubo
> > +	int ret = 0;
> > +
> > +	ASSERT(locked_page);
> > +
> > +	ret = __process_pages_contig(inode->i_mapping, locked_page, start_index,
> > +			       end_index, page_ops, &index);
> > +	if (ret == -EAGAIN) {
> > +		__unlock_for_delalloc(inode, locked_page, delalloc_start,
> > +				      ((u64)index) << PAGE_SHIFT);
> >  	}
> > +
> >  	return ret;
> >  }

  reply	other threads:[~2017-02-02 19:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-30 20:26 [PATCH] Btrfs: remove duplicated find_get_pages_contig Liu Bo
2017-02-02 18:42 ` David Sterba
2017-02-02 19:11   ` Liu Bo [this message]
2017-02-02 19:43     ` David Sterba

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=20170202191115.GE6550@localhost.localdomain \
    --to=bo.li.liu@oracle.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@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;
as well as URLs for NNTP newsgroup(s).