xfs
[Top] [All Lists]

Re: Journal Free Space

To: Steve Lord <lord@xxxxxxx>
Subject: Re: Journal Free Space
From: Curtis Anderson <curtis@xxxxxxxxxx>
Date: Fri, 04 Oct 2002 12:44:32 -0700
Cc: joebacom@xxxxxxxxxxxx, linux-xfs@xxxxxxxxxxx
References: <200210041458.g94Ewlp22815@xxxxxxxxxxxxxxxxxxxxx> <1033750143.6896.26.camel@xxxxxxxxxxxxxxxxxxxx> <200210041822.g94IMTU04260@xxxxxxxxxxxxxxxxxxxxx> <1033758939.6896.44.camel@xxxxxxxxxxxxxxxxxxxx>
Sender: linux-xfs-bounce@xxxxxxxxxxx
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0
Steve Lord wrote:
On Fri, 2002-10-04 at 13:21, Joe Bacom wrote:
> As I said in my earlier message, I make extensive use of extended attributes > and I need to monitor how much metadata I have stored on disk.
[snip]
> Basically: how much metadata (in bytes, kb, or mb) do I have sitting on the > disk.

Here's two more approaches, they are slow in that they are per-file operations, 
but
they will give you the data I think you're looking for.  If you want filesystem 
totals,
then the techniques Steve gave are probably better than this (certainly faster).

Assuming that the data files you are working with do not have holes (ie: not 
sparse),
you can use this on each file:  (stat.st_blocks - (stat.st_size/512))
That number will include all the metadata associated with a file, not just the 
extended
attributes, but it will be close.

If the data files have holes, the operation to list the attributes of a file 
will give
you the size (in bytes) of each attribute.  Adding those numbers will not 
include the
extra bytes needed to store those attributes, but it will get you close.  You 
can even
cache the results by creating a new attribute that contains a timestamp and the 
total
size.  If I remember correctly, doing any mods to attributes updates the 
"ctime" for
the inode, so you should be able to compare that timestamp against the "ctime" 
of the
inode and only recalculate if the attributes have changed.

I hope this helps...

Thanks,

        Curtis

--
Curtis Anderson         Dir. of S/W and Dev.            curtis@xxxxxxx



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