linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 2/2] xfstests,btrfs/004: use FILEFRAG_PROG macro
  2014-10-08 10:35 ` [PATCH 2/2] xfstests,btrfs/004: use FILEFRAG_PROG macro Wang Shilong
@ 2014-10-08  4:20   ` Dave Chinner
       [not found]     ` <773629AA-9F58-4A1A-A5D0-6CC0B5121233@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread
From: Dave Chinner @ 2014-10-08  4:20 UTC (permalink / raw)
  To: Wang Shilong; +Cc: fstests, linux-btrfs

On Wed, Oct 08, 2014 at 06:35:22AM -0400, Wang Shilong wrote:
> Signed-off-by: Wang Shilong <wangshilong1991@gmail.com>
> ---
> i didn't find a way to remove filefrag here, but let us
> use macro firstly...

YOu shoul dbe able to use fiemap to calculate the same output.
i.e. _check_file_extents() outputs a strings of the format 
#physical#length#logical#flags and this is then cut up later
later by the test. fiemap outputs the same information,
it just requires slightly different processing via the
_filter_extents function to munge it into the same format...

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] xfstests,btrfs/004: use FILEFRAG_PROG macro
       [not found]     ` <773629AA-9F58-4A1A-A5D0-6CC0B5121233@gmail.com>
@ 2014-10-08  5:31       ` Wang Shilong
  2014-10-08  5:54         ` Dave Chinner
  0 siblings, 1 reply; 5+ messages in thread
From: Wang Shilong @ 2014-10-08  5:31 UTC (permalink / raw)
  To: linux-btrfs, fstests

Cc list

> On Wed, Oct 08, 2014 at 06:35:22AM -0400, Wang Shilong wrote:
>>> Signed-off-by: Wang Shilong <wangshilong1991@gmail.com>
>>> ---
>>> i didn't find a way to remove filefrag here, but let us
>>> use macro firstly...
>> 
>> YOu shoul dbe able to use fiemap to calculate the same output.
>> i.e. _check_file_extents() outputs a strings of the format 
>> #physical#length#logical#flags and this is then cut up later
>> later by the test. fiemap outputs the same information,
>> it just requires slightly different processing via the
>> _filter_extents function to munge it into the same format…
> 
> I supposed there are some differences between fiemap and filefrag:
> 
> [root@vm01 mnt]# filefrag -v data 
> Filesystem type is: 9123683e
> File size of data is 1024 (1 block of 4096 bytes)
> ext:     logical_offset:        physical_offset: length:   expected: flags:
>   0:        0..    4095:          0..      4095:   4096:             not_aligned,inline,eof
> data: 1 extent found
> 
> [root@vm01 mnt]# xfs_io -c fiemap data 
> data:
> 	0: [0..7]: 0..7
> 
> Hm….
> 
> 
>> 
>> Cheers,
>> 
>> Dave.
>> -- 
>> Dave Chinner
>> david@fromorbit.com
> 
> Best Regards,
> Wang Shilong
> 

Best Regards,
Wang Shilong


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] xfstests,btrfs/004: use FILEFRAG_PROG macro
  2014-10-08  5:31       ` Wang Shilong
@ 2014-10-08  5:54         ` Dave Chinner
  0 siblings, 0 replies; 5+ messages in thread
From: Dave Chinner @ 2014-10-08  5:54 UTC (permalink / raw)
  To: Wang Shilong; +Cc: linux-btrfs, fstests

On Wed, Oct 08, 2014 at 01:31:24PM +0800, Wang Shilong wrote:
> Cc list
> 
> > On Wed, Oct 08, 2014 at 06:35:22AM -0400, Wang Shilong wrote:
> >>> Signed-off-by: Wang Shilong <wangshilong1991@gmail.com>
> >>> ---
> >>> i didn't find a way to remove filefrag here, but let us
> >>> use macro firstly...
> >> 
> >> YOu shoul dbe able to use fiemap to calculate the same output.
> >> i.e. _check_file_extents() outputs a strings of the format 
> >> #physical#length#logical#flags and this is then cut up later
> >> later by the test. fiemap outputs the same information,
> >> it just requires slightly different processing via the
> >> _filter_extents function to munge it into the same format…
> > 
> > I supposed there are some differences between fiemap and filefrag:
> > 
> > [root@vm01 mnt]# filefrag -v data 
> > Filesystem type is: 9123683e
> > File size of data is 1024 (1 block of 4096 bytes)
> > ext:     logical_offset:        physical_offset: length:   expected: flags:
> >   0:        0..    4095:          0..      4095:   4096:             not_aligned,inline,eof
> > data: 1 extent found
> > 
> > [root@vm01 mnt]# xfs_io -c fiemap data 
> > data:
> > 	0: [0..7]: 0..7

Of course. Units, for one: the output of filefrag is in bytes, while
fiemap is in 512 byte blocks. And fiemap needs the  "-v" option to
output the flag state. Same information, different presentation.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] xfstests,btrfs/010: use _extent_count() helper
@ 2014-10-08 10:35 Wang Shilong
  2014-10-08 10:35 ` [PATCH 2/2] xfstests,btrfs/004: use FILEFRAG_PROG macro Wang Shilong
  0 siblings, 1 reply; 5+ messages in thread
From: Wang Shilong @ 2014-10-08 10:35 UTC (permalink / raw)
  To: fstests; +Cc: david, linux-btrfs

cleanup to swith _extent_count(), this way we remove a
dependence on filefrag.

Signed-off-by: Wang Shilong <wangshilong1991@gmail.com>
---
 tests/btrfs/010 | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
 mode change 100755 => 100644 tests/btrfs/010

diff --git a/tests/btrfs/010 b/tests/btrfs/010
old mode 100755
new mode 100644
index 371f1b8..6cfc561
--- a/tests/btrfs/010
+++ b/tests/btrfs/010
@@ -40,6 +40,7 @@ _cleanup()
 # get standard environment, filters and checks
 . ./common/rc
 . ./common/filter
+. ./common/defrag
 
 # real QA test starts here
 
@@ -47,7 +48,6 @@ _cleanup()
 _supported_fs btrfs
 _supported_os Linux
 _require_scratch
-_require_command "/usr/sbin/filefrag"
 
 rm -f $seqres.full
 
@@ -71,9 +71,9 @@ done
 
 $BTRFS_UTIL_PROG filesystem defrag $subvol/foobar && sync
 
-num_extent_orig=`filefrag $subvol/foobar | awk -F ' ' '{print $2}'`
-num_extent_snap1=`filefrag $SCRATCH_MNT/snap-1/foobar | awk -F ' ' '{print $2}'`
-num_extent_snap2=`filefrag $SCRATCH_MNT/snap-2/foobar | awk -F ' ' '{print $2}'`
+num_extent_orig=`_extent_count $subvol/foobar`
+num_extent_snap1=`_extent_count $SCRATCH_MNT/snap-1/foobar`
+num_extent_snap2=`_extent_count $SCRATCH_MNT/snap-2/foobar`
 
 echo "$num_extent_orig $num_extent_snap1 $num_extent_snap2" >> $seqres.full
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] xfstests,btrfs/004: use FILEFRAG_PROG macro
  2014-10-08 10:35 [PATCH 1/2] xfstests,btrfs/010: use _extent_count() helper Wang Shilong
@ 2014-10-08 10:35 ` Wang Shilong
  2014-10-08  4:20   ` Dave Chinner
  0 siblings, 1 reply; 5+ messages in thread
From: Wang Shilong @ 2014-10-08 10:35 UTC (permalink / raw)
  To: fstests; +Cc: david, linux-btrfs

Signed-off-by: Wang Shilong <wangshilong1991@gmail.com>
---
i didn't find a way to remove filefrag here, but let us
use macro firstly...
---
 tests/btrfs/004 | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tests/btrfs/004 b/tests/btrfs/004
index 1d5b816..1f59963 100755
--- a/tests/btrfs/004
+++ b/tests/btrfs/004
@@ -53,7 +53,6 @@ _supported_os Linux
 _require_scratch
 _require_no_large_scratch_dev
 _require_btrfs inspect-internal
-_require_command "/usr/sbin/filefrag"
 
 rm -f $seqres.full
 
@@ -82,7 +81,7 @@ _filter_extents()
 
 _check_file_extents()
 {
-	cmd="filefrag -v $1"
+	cmd="$FILEFRAG_PROG -v $1"
 	echo "# $cmd" >> $seqres.full
 	out=`$cmd | _filter_extents`
 	if [ -z "$out" ]; then
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-10-08  5:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-08 10:35 [PATCH 1/2] xfstests,btrfs/010: use _extent_count() helper Wang Shilong
2014-10-08 10:35 ` [PATCH 2/2] xfstests,btrfs/004: use FILEFRAG_PROG macro Wang Shilong
2014-10-08  4:20   ` Dave Chinner
     [not found]     ` <773629AA-9F58-4A1A-A5D0-6CC0B5121233@gmail.com>
2014-10-08  5:31       ` Wang Shilong
2014-10-08  5:54         ` Dave Chinner

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).