linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC, PATCH 0/2] fiemap: filesystem free space mapping
@ 2012-10-18  5:11 Dave Chinner
  2012-10-18  5:11 ` [PATCH 1/2] fiemap: add freespace mapping to FS_IOC_FIEMAP Dave Chinner
                   ` (4 more replies)
  0 siblings, 5 replies; 15+ messages in thread
From: Dave Chinner @ 2012-10-18  5:11 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: xfs

So, I was bored a few days ago, and I was sick of having to run
xfs_db incorrectly report free space extents when the filesytem is
mounted, so I decided to extend fiemap to export freespace mappings
to userspace so I could get the information coherently through the
mounted filesystem.

Yes, this could probably be considered interface abuse but, well, it
was simple to do because extent mapping is exactly what fiemap is
designed to do. Hence I didn't have to write new walkers/formatters
and I was using code I knew worked correctly.

There are two methods of mapping - one is reporting free space in
ascending extent start offset order, then other in ascending extent
length order. Both a useful to have (e.g. defragmenter might want to
know about the nearest free block to given offset or the largest
free extent in a given region). Either way, XFS keeps indexes
ordered in both ways, so they can be exported directly with minimal
overhead.

The only "interesting" abuse of the interface is really the use of
FIEMAP_EXTENT_LAST. This means that the last extent in a freespace
index is being returned, rather than the last freespace extent. This
is done because filesystems often have multiple free space indexes,
and it may be difficult to sort/scan over multiple indexes in a
single map.

This means an application needs to keep track of what freespace has
been returned to it and adjust it's fiemap ranges apprpritately, or
be aware of the underlying filesystem structure to for requests that
don't span free space indexes. I don't see this a bug problem,
because any application that is digging in freespace maps needs to
know how the filesystem is structured to make any sense of the
infomration returned. As such, I see this interface purely for
filesystem diagnostics or utilities tightly bound to the filesystem
(e.g. xfs_fsr).

I'll attach a patch for a small utility that uses this interace to
replicate the xfs_db freespace command in a short while so people
can see how it is used. that shoul dmake it easier to comment on. :)

Cheers,

Dave.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2012-11-08 21:01 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-18  5:11 [RFC, PATCH 0/2] fiemap: filesystem free space mapping Dave Chinner
2012-10-18  5:11 ` [PATCH 1/2] fiemap: add freespace mapping to FS_IOC_FIEMAP Dave Chinner
2012-11-08 16:50   ` Mark Tinguely
2012-11-08 20:56     ` Dave Chinner
2012-11-08 21:01       ` Mark Tinguely
2012-10-18  5:11 ` [PATCH 2/2] xfs: implement FIEMAP_FLAG_FREESPACE_* Dave Chinner
2012-10-18  5:27 ` [RFC, PATCH 3/2] xfsprogs: space management tool Dave Chinner
2012-10-18  8:10 ` [RFC, PATCH 0/2] fiemap: filesystem free space mapping Andreas Dilger
2012-10-18 21:07   ` Dave Chinner
2012-10-23 12:30 ` Christoph Hellwig
2012-10-23 21:53   ` Dave Chinner
2012-10-24 11:47     ` Chris Mason
2012-10-24 12:32       ` Jie Liu
2012-10-24 15:09       ` Christoph Hellwig
2012-10-24 19:15         ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).