linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: dsterba@suse.cz, David Sterba <dsterba@suse.com>,
	linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 05/14] btrfs: pass only eb to num_extent_pages
Date: Fri, 29 Jun 2018 18:12:31 +0300	[thread overview]
Message-ID: <81cd16b8-caf6-938f-3fa5-90ca8b147363@suse.com> (raw)
In-Reply-To: <20180629142947.GU2287@twin.jikos.cz>



On 29.06.2018 17:29, David Sterba wrote:
> On Fri, Jun 29, 2018 at 12:08:10PM +0300, Nikolay Borisov wrote:
>>>  	for (i = 0; i < num_pages; i++)
>>>  		copy_page(page_address(dst->pages[i]),
>>>  				page_address(src->pages[i]));
>>> diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
>>> index 0bfd4aeb822d..d8382a4a7f46 100644
>>> --- a/fs/btrfs/extent_io.h
>>> +++ b/fs/btrfs/extent_io.h
>>> @@ -440,10 +440,10 @@ int read_extent_buffer_pages(struct extent_io_tree *tree,
>>>  			     int mirror_num);
>>>  void wait_on_extent_buffer_writeback(struct extent_buffer *eb);
>>>  
>>> -static inline unsigned long num_extent_pages(u64 start, u64 len)
>>> +static inline unsigned long num_extent_pages(const struct extent_buffer *eb)
>>>  {
>>> -	return ((start + len + PAGE_SIZE - 1) >> PAGE_SHIFT) -
>>> -		(start >> PAGE_SHIFT);
>>> +	return ((eb->start + eb->len + PAGE_SIZE - 1) >> PAGE_SHIFT) -
>>> +		(eb->start >> PAGE_SHIFT);
>>
>> This is a good opportunity to eliminate the open-coded round_up:
>>
>> round_up(eb->start + eb->len, PAGE_SIZE)
> 
> Ok, I'll add this patch:
> 
> @@ -442,8 +442,8 @@ void wait_on_extent_buffer_writeback(struct extent_buffer *eb);
>  
>  static inline int num_extent_pages(const struct extent_buffer *eb)
>  {
> -       return ((eb->start + eb->len + PAGE_SIZE - 1) >> PAGE_SHIFT) -
> -               (eb->start >> PAGE_SHIFT);
> +       return (round_up(eb->start + eb->len, PAGE_SIZE) >> PAGE_SHIFT) -
> +              (eb->start >> PAGE_SHIFT);
>  }

LGTM
>  
>  static inline void extent_buffer_get(struct extent_buffer *eb)
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  reply	other threads:[~2018-06-29 15:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-29  8:56 [PATCH 00/14] Misc cleanups for 4.19 David Sterba
2018-06-29  8:56 ` [PATCH 01/14] btrfs: simplify some assignments of inode numbers David Sterba
2018-06-29  8:56 ` [PATCH 02/14] btrfs: simplify pointer chasing of local fs_info variables David Sterba
2018-06-29  8:56 ` [PATCH 03/14] btrfs: use copy_page for copying pages instead of memcpy David Sterba
2018-06-29  8:56 ` [PATCH 04/14] btrfs: prune unused includes David Sterba
2018-06-29  8:56 ` [PATCH 05/14] btrfs: pass only eb to num_extent_pages David Sterba
2018-06-29  9:08   ` Nikolay Borisov
2018-06-29 14:29     ` David Sterba
2018-06-29 15:12       ` Nikolay Borisov [this message]
2018-06-29  8:56 ` [PATCH 06/14] btrfs: switch types to int when counting eb pages David Sterba
2018-06-29  8:56 ` [PATCH 07/14] btrfs: open-code bio_set_op_attrs David Sterba
2018-06-29  8:56 ` [PATCH 08/14] btrfs: raid56: add new helper for starting async work David Sterba
2018-06-29  8:56 ` [PATCH 09/14] btrfs: raid56: use new helper for async_rmw_stripe David Sterba
2018-06-29  8:57 ` [PATCH 10/14] btrfs: raid56: use new helper for async_read_rebuild David Sterba
2018-06-29  8:57 ` [PATCH 11/14] btrfs: raid56: use new helper for async_scrub_parity David Sterba
2018-06-29  8:57 ` [PATCH 12/14] btrfs: raid56: merge rbio_is_full helpers David Sterba
2018-06-29  8:57 ` [PATCH 13/14] btrfs: raid56: don't lock stripe cache table when freeing David Sterba
2018-06-29 15:18   ` David Sterba
2018-06-29  8:57 ` [PATCH 14/14] btrfs: raid56: catch errors from full_stripe_write 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=81cd16b8-caf6-938f-3fa5-90ca8b147363@suse.com \
    --to=nborisov@suse.com \
    --cc=dsterba@suse.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).