All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: linux-xfs@vger.kernel.org,
	"Darrick J . Wong" <darrick.wong@oracle.com>,
	Brian Foster <bfoster@redhat.com>
Subject: Re: [PATCH] xfs: Fix tail rounding in xfs_alloc_file_space()
Date: Thu, 26 Sep 2019 17:28:13 +0200	[thread overview]
Message-ID: <ead01fc2-045e-dc18-1b98-25bf285c19c3@redhat.com> (raw)
In-Reply-To: <20190926144730.zf6kwjy2b7hraa2p@pegasus.maiolino.io>


[-- Attachment #1.1: Type: text/plain, Size: 1445 bytes --]

On 26.09.19 16:47, Carlos Maiolino 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
>>
>> Signed-off-by: Max Reitz <mreitz@redhat.com>
> 
> For the patch:
> 
> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
> 
> 
> +1 for a test in xfstests
> 
> 
> P.S.
> 
> You usually don't need to Cc: LKML for xfs-only patches, linux-xfs is enough.

OK, thanks.  I wasn’t sure because get_maintainer.pl just emits it by
default.

Max


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2019-09-26 15:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-26 14:22 [PATCH] xfs: Fix tail rounding in xfs_alloc_file_space() Max Reitz
2019-09-26 14:37 ` Darrick J. Wong
2019-09-26 14:40   ` Max Reitz
2019-09-26 14:47 ` Carlos Maiolino
2019-09-26 15:28   ` Max Reitz [this message]
2019-09-30  7:48 ` Christoph Hellwig
2019-09-30 18:25 ` Darrick J. Wong

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=ead01fc2-045e-dc18-1b98-25bf285c19c3@redhat.com \
    --to=mreitz@redhat.com \
    --cc=bfoster@redhat.com \
    --cc=darrick.wong@oracle.com \
    --cc=linux-xfs@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.