device ordered files (for backups etc)

Jon Peatfield (J.S.Peatfield@damtp.cam.ac.uk)
Tue, 15 May 2001 05:10:58 +0100


While reading the "getting fs access events" thread I remembered
something which I've been meaning to look at for ages.

[some history]
I don't trust programs which dump file systems by reading the data
directly from the block device (I'm never sure that they get things
right). I prefer to do backups through the standard fs interfaces (so
logically we do 2 steps, make a list of files and then archive them).

However, this does mean that the order of real block reads may not be
very good (since files may accessed in an order which doesn't minimise
seeks). Ignoring the problem of files with blocks spread far apart,
it seems clear that mapping the file to a rough index into the device
and ordering the reading of the files by this index ought to reduce
the seeks.

Now most systems provide no interface for this (pity), though Linux
does through the FIBMAP ioctl() (for fs which support bmap at least).
However to use this we need to open() all the files get the block
index, sort them and then reopen the files in the right order.

There is also the problem that we are (indirectly) reading the
directories to do the readdir()/lstat() etc in some arbitrary order,
so causing more seeks.

Is there some trick I'm missing or is there really no way to avoid
these seek penalty and go through the standard fs interfaces?

-- Jon
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/