hammer prune explanation

Michael Neumann mneumann at ntecs.de
Sat May 10 13:25:39 PDT 2008

Matthew Dillon wrote:
> :Thanks a lot! Could this great explanation (or parts of it) go into the
> :man-page? I think it's very helpful, especially the visualization.
>     I am going to write up a whole paper on HAMMER.  It's almost time for
>     me to sit down and do it.
> :Is it possible to prune according to the filename? For example:
> :
> :   hammer prune /mnt/usr/obj from 2d everything
> :   hammer prune /mnt/usr/src from 1d to 10d every 1d
> :
> :Don't know if it is possible to implement... but would avoid the need
> :for separate filesystems.
> :
> :Regards,
> :
> :   Michael
>     The filesystem supports pruning on an object-by-object basis, so
>     it is possible to prune a single file.  The hammer utility does not
>     currently have support for that, but it would not be difficult to
>     add.  If you want a little side project, add it to the utility!
>     The core code that selects the object id range (aka inode numbers)
>     is in /usr/src/sbin/hammer/cmd_prune.c line 74ish.
Sounds good :)

>     What I would like to do is have a more sophisticated pruning 
>     in general, such as based on wildcarding and/or an inherited chflag
>     flag, or perhaps be able to specify a pruning category selector on
>     a file by file basis.  I don't know what the best approach is.

Yeah, I was thinking about wildcarding as well.

But is it possible to implement it within cmd_prune.c, or do I have to
modify the ioctl kernel code? If done in cmd_prune.c, I somehow have to
iterate over all deleted files and call the prune command for it.
I thought, it's easier to introduce a check in the kernel, whether the
file that should be pruned matches a given pattern. Doesn't sound very
hard to do, if it is easy to get the pathname for a given inode.
Are you thinking about something like the archive flag?

>     Right now any serious HAMMER user need to set up at least a daily
>     cron job to prune and reblock the filesystem.  I add a '-t timeout'
>     feature to the HAMMER utility to make allow the operations to be
>     set up in a cron job and keep the filesystem up to snuff over a long
>     period of time.  So, e.g. you would have a nightly cron job that
>     did this:
> 	# spend up to 5 minutes pruning the filesystem and another
> 	# 5 minutes reblocking it, then stop.
> 	hammer -t 300 prune /myfilesystem; hammer -t 300 reblock /myfilesystem
Does this degrade filesystem seriously?



More information about the Users mailing list