From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: fdmanana@gmail.com
Cc: Hugo Mills <hugo@carfax.org.uk>,
Qu Wenruo <quwenruo@cn.fujitsu.com>,
"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>,
fstests@vger.kernel.org
Subject: Re: [PATCH v2] fstests: generic: Check if a bull fallocate will change extent number
Date: Tue, 29 Sep 2015 18:48:37 +0800 [thread overview]
Message-ID: <560A6C85.2020809@gmx.com> (raw)
In-Reply-To: <CAL3q7H4+xS7OOJd-Ny0zzA0a4JVrNHbhzCKStKcTReqriYyKrw@mail.gmail.com>
在 2015年09月29日 18:24, Filipe Manana 写道:
> On Tue, Sep 29, 2015 at 11:13 AM, Qu Wenruo <quwenruo.btrfs@gmx.com> wrote:
>>
>>
>> 在 2015年09月29日 18:00, Hugo Mills 写道:
>>>
>>> On Tue, Sep 29, 2015 at 05:34:24PM +0800, Qu Wenruo wrote:
>>>>
>>>> Normally, a bull fallocate call on a fully written and synced file
>>>> should not add an extent.
>>>
>>>
>>> What's a "bull" fallocate call? Is it a typo, or simply something
>>> I'm not familiar with?
>>>
>>> Hugo.
>>
>>
>> Oh, it should be null.
>> But null still seems not appropriate here.
>>
>> I mean a fallocate call which doesn't really allocate any space...
>>
>> Any good ideas?
>
> "Test if fallocate will create uneeded extra tailing extent"
>
> change it to:
>
> "Test that calling fallocate against a range which is already
> allocated does not create new file extents".
>
> No need to categorize such case for fallocate imho (but I'm not a
> native English speaker either).
Thank you, Filipe and Huge,
Both gives quite good expression, I'll pick one of them.
Thanks,
Qu
>
>>
>> Thanks,
>> Qu
>>
>>>
>>>> But not all filesystem follows the correct behavior.
>>>>
>>>> Btrfs has a bug to always truncate the last page if the fallocate start
>>>> offset is smaller than inode size.
>>>>
>>>> So add this test case to detect such malfunction.
>>>>
>>>> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
>>>> ---
>>>> v2:
>>>> Add author info...
>>>> Fix some comment typo
>>>> ---
>>>> tests/generic/110 | 78
>>>> +++++++++++++++++++++++++++++++++++++++++++++++++++
>>>> tests/generic/110.out | 3 ++
>>>> tests/generic/group | 1 +
>>>> 3 files changed, 82 insertions(+)
>>>> create mode 100755 tests/generic/110
>>>> create mode 100644 tests/generic/110.out
>>>>
>>>> diff --git a/tests/generic/110 b/tests/generic/110
>>>> new file mode 100755
>>>> index 0000000..b2b140c
>>>> --- /dev/null
>>>> +++ b/tests/generic/110
>>>> @@ -0,0 +1,78 @@
>>>> +#! /bin/bash
>>>> +# FS QA Test 110
>>>> +#
>>>> +# Test if fallocate will create uneeded extra tailing extent
>>>> +#
>>>> +#-----------------------------------------------------------------------
>>>> +# Copyright (c) 2015 Fujitsu. All Rights Reserved.
>>>> +#
>>>> +# This program is free software; you can redistribute it and/or
>>>> +# modify it under the terms of the GNU General Public License as
>>>> +# published by the Free Software Foundation.
>>>> +#
>>>> +# This program is distributed in the hope that it would be useful,
>>>> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
>>>> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>>>> +# GNU General Public License for more details.
>>>> +#
>>>> +# You should have received a copy of the GNU General Public License
>>>> +# along with this program; if not, write the Free Software Foundation,
>>>> +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
>>>> +#-----------------------------------------------------------------------
>>>> +#
>>>> +
>>>> +seq=`basename $0`
>>>> +seqres=$RESULT_DIR/$seq
>>>> +echo "QA output created by $seq"
>>>> +
>>>> +here=`pwd`
>>>> +tmp=/tmp/$$
>>>> +status=1 # failure is the default!
>>>> +trap "_cleanup; exit \$status" 0 1 2 3 15
>>>> +
>>>> +_cleanup()
>>>> +{
>>>> + cd /
>>>> + rm -f $tmp.*
>>>> +}
>>>> +
>>>> +# get standard environment, filters and checks
>>>> +. ./common/rc
>>>> +. ./common/filter
>>>> +. ./common/defrag
>>>> +
>>>> +# remove previous $seqres.full before test
>>>> +rm -f $seqres.full
>>>> +
>>>> +# real QA test starts here
>>>> +
>>>> +_supported_fs generic
>>>> +_supported_os IRIX Linux
>>>> +_require_scratch
>>>> +_need_to_be_root
>>>> +
>>>> +# Use 64K file size to match any sectorsize
>>>> +# And with a unaligned tailing range to ensure it will be at least 2
>>>> pages
>>>> +filesize=$(( 64 * 1024 + 1024 ))
>>>> +
>>>> +_scratch_mkfs > /dev/null 2>&1
>>>> +_scratch_mount
>>>> +$XFS_IO_PROG -f -c "pwrite 0 $filesize" $SCRATCH_MNT/foo |
>>>> _filter_xfs_io
>>>> +sync
>>>> +orig_extent_nr=`_extent_count $SCRATCH_MNT/foo`
>>>> +
>>>> +# As all space are allocated and even written to disk, this falloc
>>>> +# should do nothing with extent modification.
>>>> +$XFS_IO_PROG -f -c "falloc 0 $filesize" $SCRATCH_MNT/foo
>>>> +sync
>>>> +new_extent_nr=`_extent_count $SCRATCH_MNT/foo`
>>>> +
>>>> +echo "orig: $orig_extent_nr, new: $new_extent_nr" >> $seqres.full
>>>> +
>>>> +if [ "x$orig_extent_nr" != "x$new_extent_nr" ]; then
>>>> + echo "number of extents mis-match after bull fallocate"
>>>> +fi
>>>> +
>>>> +# success, all done
>>>> +status=0
>>>> +exit
>>>> diff --git a/tests/generic/110.out b/tests/generic/110.out
>>>> new file mode 100644
>>>> index 0000000..64049da
>>>> --- /dev/null
>>>> +++ b/tests/generic/110.out
>>>> @@ -0,0 +1,3 @@
>>>> +QA output created by 110
>>>> +wrote 66560/66560 bytes at offset 0
>>>> +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>>>> diff --git a/tests/generic/group b/tests/generic/group
>>>> index 4ae256f..428f3e3 100644
>>>> --- a/tests/generic/group
>>>> +++ b/tests/generic/group
>>>> @@ -112,6 +112,7 @@
>>>> 107 auto quick metadata
>>>> 108 auto quick rw
>>>> 109 auto metadata dir
>>>> +110 auto quick prealloc
>>>> 112 rw aio auto quick
>>>> 113 rw aio auto quick
>>>> 117 attr auto quick
>>>
>>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe fstests" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
>
next prev parent reply other threads:[~2015-09-29 10:48 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-29 9:34 [PATCH v2] fstests: generic: Check if a bull fallocate will change extent number Qu Wenruo
2015-09-29 9:55 ` Eryu Guan
2015-09-29 10:16 ` Qu Wenruo
2015-09-29 10:33 ` Eryu Guan
2015-09-29 10:46 ` Qu Wenruo
2015-09-29 10:00 ` Hugo Mills
2015-09-29 10:13 ` Qu Wenruo
2015-09-29 10:24 ` Filipe Manana
2015-09-29 10:48 ` Qu Wenruo [this message]
2015-09-30 6:42 ` Duncan
2015-09-29 10:24 ` Hugo Mills
2015-09-29 21:51 ` Dave Chinner
2015-09-30 1:05 ` Qu Wenruo
2015-09-30 1:45 ` Tsutomu Itoh
2015-09-30 1:49 ` Qu Wenruo
2015-09-30 4:20 ` Dave Chinner
2015-09-30 5:48 ` Qu Wenruo
2015-10-02 8:35 ` Qu Wenruo
2015-10-06 1:31 ` Dave Chinner
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=560A6C85.2020809@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=fdmanana@gmail.com \
--cc=fstests@vger.kernel.org \
--cc=hugo@carfax.org.uk \
--cc=linux-btrfs@vger.kernel.org \
--cc=quwenruo@cn.fujitsu.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).