[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <40d1b2d8-5f17-a76d-7124-4b85ac035e80@redhat.com>
Date: Thu, 26 Sep 2019 16:40:45 +0200
From: Max Reitz <mreitz@...hat.com>
To: "Darrick J. Wong" <darrick.wong@...cle.com>
Cc: linux-xfs@...r.kernel.org, linux-kernel@...r.kernel.org,
Brian Foster <bfoster@...hat.com>
Subject: Re: [PATCH] xfs: Fix tail rounding in xfs_alloc_file_space()
On 26.09.19 16:37, Darrick J. Wong wrote:
> On Thu, Sep 26, 2019 at 04:22:38PM +0200, Max Reitz wrote:
>> To ensure that all blocks touched by the range [offset, offset + count)
>> are allocated, we need to calculate the block count from the difference
>> of the range end (rounded up) and the range start (rounded down).
>>
>> Before this patch, we just round up the byte count, which may lead to
>> unaligned ranges not being fully allocated:
>>
>> $ touch test_file
>> $ block_size=$(stat -fc '%S' test_file)
>> $ fallocate -o $((block_size / 2)) -l $block_size test_file
>> $ xfs_bmap test_file
>> test_file:
>> 0: [0..7]: 1396264..1396271
>> 1: [8..15]: hole
>>
>> There should not be a hole there. Instead, the first two blocks should
>> be fully allocated.
>>
>> With this patch applied, the result is something like this:
>>
>> $ touch test_file
>> $ block_size=$(stat -fc '%S' test_file)
>> $ fallocate -o $((block_size / 2)) -l $block_size test_file
>> $ xfs_bmap test_file
>> test_file:
>> 0: [0..15]: 11024..11039
>
> Code looks ok; by any chance do you have an xfstest we could add to the
> regresion test suite?
I’ll look into it.
Max
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists