public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: xinxin shu <xinxin.shu5040@gmail.com>
Cc: xfs@oss.sgi.com
Subject: Re: how to locate the file through blktrace with xfs
Date: Fri, 13 Jun 2014 07:08:16 -0400	[thread overview]
Message-ID: <20140613110816.GA55850@bfoster.bfoster> (raw)
In-Reply-To: <CAF7cUg2QOZ+_nPmdb_jiy0Bip=ggSKE5Bs_pUCT9CmOcGjnYQQ@mail.gmail.com>

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

Brian

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

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

      reply	other threads:[~2014-06-13 11:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-13  8:21 how to locate the file through blktrace with xfs xinxin shu
2014-06-13 11:08 ` Brian Foster [this message]

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=20140613110816.GA55850@bfoster.bfoster \
    --to=bfoster@redhat.com \
    --cc=xfs@oss.sgi.com \
    --cc=xinxin.shu5040@gmail.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