[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20130207154042.92430aed.akpm@linux-foundation.org>
Date: Thu, 7 Feb 2013 15:40:42 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Lukas Czerner <lczerner@...hat.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-ext4@...r.kernel.org,
Hugh Dickins <hughd@...gle.com>
Subject: Re: [PATCH v2 10/18] mm: teach truncate_inode_pages_range() to
handle non page aligned ranges
On Tue, 5 Feb 2013 10:12:03 +0100
Lukas Czerner <lczerner@...hat.com> wrote:
> This commit changes truncate_inode_pages_range() so it can handle non
> page aligned regions of the truncate. Currently we can hit BUG_ON when
> the end of the range is not page aligned, but we can handle unaligned
> start of the range.
>
> Being able to handle non page aligned regions of the page can help file
> system punch_hole implementations and save some work, because once we're
> holding the page we might as well deal with it right away.
>
> In previous commits we've changed ->invalidatepage() prototype to accept
> 'length' argument to be able to specify range to invalidate. No we can
> use that new ability in truncate_inode_pages_range().
>
> ...
>
> + /*
> + * 'start' and 'end' always covers the range of pages to be fully
> + * truncated. Partial pages are covered with 'partial_start' at the
> + * start of the range and 'partial_end' at the end of the range.
> + * Note that 'end' is exclusive while 'lend' is inclusive.
> + */
That helped ;) So the bytes to be truncated are
(start*PAGE_SIZE + partial_start) -> (end*PAGE_SIZE + partial_end) - 1
yes?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists