Usenet comp.unix.tru64 (2000-2013)
 help / color / mirror / Atom feed
From: Bob Harris <harris@zk3.dec.com>
Subject: Re: ADVFS fileset information
Date: Tue, 05 Feb 2002 10:18:18 -0500	[thread overview]
Message-ID: <050220021018184859%harris@zk3.dec.com> (raw)
In-Reply-To: b9019227.0202040847.2765525c@posting.google.com

In article <b9019227.0202040847.2765525c@posting.google.com>, Narasimha
<mknarasimha@hotmail.com> wrote:

X  Hi Bob,
X  
X  Thanks for the information. Regarding the showfile on each file of the
X  fileset: Can we determine the starting and ending offset on a device
X  for the fileset by doing a fileshow on the files in the fileset? My
X  intent is to get the starting offset of the fileset extents and the
X  size of the extents. ...............................................

A fileset does not have a location.  A fileset is just the name space
that you see via directory trees.  The only storage directly related to
the fileset is the very small tag directory that translates bitfile tag
ID (like an inode) to the primary mcell location for each file.

Files are what have location on the different volumes of a domain.  The
location for a file can be moved behind the file's back using the
defragment, balance, migrate, or rmvol commands.

File are associated with a fileset since the file has a name and that
name is kept in a fileset's name space.

If you are trying to build a map of where each file's storage is
located on each volume of a domain, then you can use showfile -x to get
extent information on each file.  The 'vol' column tells you which
volume of a multi-volume domain the extent is located on.  The
'volBlock' column tells you the first 512 byte sector location of the
extent.  the 'blockCnt' tells you how many contiguous 512 byte sectors
are in the extent.

If you get this information for every file in a fileset's name space,
then you will be able to build a map of what 512 byte sectors on the
disk contain file data.

If you have multiple filesets, then the files in each fileset's name
space will be intermixed in the domain.  There is not attempt to order
or place files from one fileset differently than another fileset's
files.  Files get storage allocated to them from the domain on a first
come first served basis.

X  ................................................................ My
X  intent is to get the starting offset of the fileset extents and the
X  size of the extents. Can this be accomplished by the fcntl call(with
X  F_GETMAP). ...........................................................

No, I do not think so.  fcntl(F_GETMAP) does not tell you the physical
location of a file's extents on the disk.  It just tells you what parts
of the file have storage allocated and what parts are sparse holes.  So
you would need to use something like showfile -x to get physical
locations of extents on the disk for each file. 

X  .......... The problem is that the fcntl call will not account for the
X  advfs fileset as a whole and just work for the UFS directory which is
X  the mountpoint. ......................................................

_NOTHING_ shows all the storage associated with a fileset as a whole. 
fcntl(F_GETMAP) is a per file utility. If you point it at the mount
point, then it tells you about the root directory of that mounted file
systems.  If you want fcntl(F_GETMAP) information for every file in a
file system, then you need to call fcntl(F_GETMAP) once for every file
in the file system.

But again, fcntl(F_GETMAP) does not tell you where extents are located
on the physical disk, it just tells you about what parts of a file have
storage and what parts have sparse holes.
  
X  ............... It would be great if you could clarify on the showfile
X  and vbmtpg.

Showfile -x is rather straight forward.  It shows you the allocated
storatge of a file, offset of the extent as an 8K page inside of the
file (offsets that are not covered by an extent are sparse holes), and
it shows where the extent lives in the physical domain.  Not much more
to tell.

As for the old out dated vbmtpg, it was replaced by nvbmtpg in newer
versions of Tru64 UNIX and both of them along with the other tools in
/sbin/advfs/* are non-trivial tools for analyzing the AdvFS on-disk
structures.  What public information is available on them is in the man
pages.  After that, it is a matter of either reverse engineering what
you see, or getting a source license and studying the sources. 

But if you are still looking for a magic tool that will tell you what
subset of storage is being used by all the files described by a single
fileset's name space, then you are not going to find it (it is not the
kind of information that is interesting to most people, especially
AdvFS developers), so you will need to write you own tool.

Here is a rude, crude, and slow script (which is _NOT_ very well
debugged and will most likely break) that will find the high and low
blocks used by a given fileset:

#!/bin/ksh
#
if [[ $# = 0 ]]; then
    echo 1>&2 "Usage:  fileset_lo_hi_allocation.ksh mount_point"
    exit 1
fi

find $1 -mount -exec showfile -x {} \; | awk '
    $1 == pageOff { next }
    NF == 5 {
        if ( vol < $3 )
            vol = $3
        if ( lo[$3] > $4 || lo[$3] == 0 )
            lo[$3] = $4
        n = $4 + $5 - 1
        if ( hi[$3] < n )
            hi[$3] = n
    }
    END {
        for(j=1; j <= vol; j++ ) {
            if ( j in lo ) {
                printf("vol:%d lo:%d hi:%d\n",
                    j, lo[j], hi[j])
            }
        }
    }'  # don't miss the closing single quote or not work.

This is _NOT_ what you asked for, but it does show using the showfile
-x command in a script.  You can copy the algorithm into another
language and use different tools and you can expand on the algorithm to
do what you want.  

I'm just not sure what you want makes any sense (at least not with
respect to an AdvFS domain).  Do you have an overall goal in mind.  A
"Big Picture" if you will.

                                        Bob Harris

X  Thanks,
X  Narasimha.

X  Bob Harris <harris@zk3.dec.com> wrote in message
X  news:<010220021015379536%harris@zk3.dec.com>...
X  > In article <b9019227.0201310642.c30cf91@posting.google.com>, Narasimha
X  > <mknarasimha@hotmail.com> wrote:
X  > 
X  > X  Hi,
X  > X  
X  > X  I am working on the ADVFS filesystem and was interested to know if
X  > X  there is any way to get the fileset information in terms of the
X  > X  extents/disks that the fileset spans over. ......................
X  > 
X  > Nothing that is easy.  A fileset is really nothing more than a name
X  > space.  You might as well just walk the director tree and use a
X  > showfile -x on each file in the fileset.  There are no system calls
X  > (neither public nor private) that output that information.
X  > 
X  > You could play with nvbmtpg (see the man page), but parsing the output
X  > of that would be just about as much work as parsing showfile -x option
X  > for each file, plus nvbmtpg analysis would require more reverse
X  > engineering on your part.
X  > 
X  > X  .......................................... Also there is a shared
X  > X  library of advfs system calls libmsfs.so which has a lot of advfs
X  > X  related calls. Any leads on where to find documentation or prototypes
X  > X  for these calls would be great. Thanks in advance.
X  > 
X  > The only ones that I know of which are documented are the ones
X  > mentioned in the "man 4 advfs" man page, and these are APIs to aid
X  > backup utilities.  
X  > 
X  > Plus there is fcntl(fd,F_GETMAP,arg) to fetch a file's extent map (used
X  > to properly restore sparse holes in backed up files).  I supposed you
X  > could use F_GETMAP instead of showfile to collect extent information on
X  > a fileset.
X  > 
X  >                                         Bob Harris


  reply	other threads:[~2002-02-05 15:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-31 14:42 ADVFS fileset information Narasimha
2002-02-01  9:39 ` Marre des Spameurs qui prennent les add dans les news [SauroN]
2002-02-01 14:28 ` Narasimha
2002-02-04 15:40   ` Bob Harris
2002-02-01 15:15 ` Bob Harris
2002-02-04 16:47   ` Narasimha
2002-02-05 15:18     ` Bob Harris [this message]
2002-02-05 21:12       ` Narasimha
2002-02-06 15:18         ` Bob Harris
2002-02-06 22:48           ` Narasimha
2002-02-07  3:21             ` Bob Harris
2002-02-07 13:37               ` Narasimha
2002-02-08 17:36                 ` Bob Harris
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox