[Top] [All Lists]

Re: how to locate the file through blktrace with xfs

To: xinxin shu <xinxin.shu5040@xxxxxxxxx>
Subject: Re: how to locate the file through blktrace with xfs
From: Brian Foster <bfoster@xxxxxxxxxx>
Date: Fri, 13 Jun 2014 07:08:16 -0400
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <CAF7cUg2QOZ+_nPmdb_jiy0Bip=ggSKE5Bs_pUCT9CmOcGjnYQQ@xxxxxxxxxxxxxx>
References: <CAF7cUg2QOZ+_nPmdb_jiy0Bip=ggSKE5Bs_pUCT9CmOcGjnYQQ@xxxxxxxxxxxxxx>
User-agent: Mutt/1.5.23 (2014-03-12)
On Fri, Jun 13, 2014 at 04:21:09PM +0800, xinxin shu wrote:
> Hi all,
> Recently , I collect blktrace data for xfs ,  I want to find the
> corresponding file/directory through the offset ,  is there any way to do
> this ? any tips will appreciate. thx

There isn't any easy way that I'm aware of to take a raw block number
and map it back to the owner. The global space trees account for free
space only and all allocated space is tracked in the block maps of
individual inodes.

You can obtain the extent mappings for a file via xfs_bmap, but that
alone isn't useful if you don't know what file you're looking for. You
could run a find/xfs_bmap through the entire fs and sift through the
output. If that's a lot of data and this is something you need to do
repeatedly, a supporting script might be a good idea. For example, you
could probably create a program that creates a sorted index of every
allocated extent mapped to inode number. Alternatively, a script that
takes a block number parameter and searches through the extents for a
range that includes it might be more simple.

You'll also want to be cognizant of various metadata blocks (i.e., inode
xattr blocks, btree blocks, internal md for ag's, log blocks if
internal, etc.).


> _______________________________________________
> xfs mailing list
> xfs@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs

<Prev in Thread] Current Thread [Next in Thread>