On Thu, Jan 03, 2019 at 10:50:04AM +0200, Nikolay Borisov wrote: > In a couple of places it's required to calculate the number of pages > given a start and end offsets. Currently this is opencoded, unify the > code base by replacing all such sites with the DIV_ROUND_UP macro. Also, > current open-coded sites were buggy in that they were adding > 'PAGE_SIZE', rather than 'PAGE_SIZE - 1'.
Didn't you find it strange that it's so consistently wrong? After a closer inspection, you'd find that the end of the range is inclusive. So the math is correct and your patch introduces a bug. end - start + PAGE_SIZE = end + 1 - start + PAGE_SIZE - 1 Check eg. writepage_delalloc how it sets up page_end. The correct use in DIV_ROUND_UP needs +1 adjustment.
