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); } 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 majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html