public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: Daire Byrne <daire.byrne@gmail.com>
Cc: xfs@oss.sgi.com
Subject: Re: Contiguous file sequences
Date: Wed, 22 Sep 2010 15:10:00 -0500	[thread overview]
Message-ID: <4C9A6298.106@sandeen.net> (raw)
In-Reply-To: <AANLkTikHqjvEGJb0XnNy+nz7+nHLVLwjF_wp5RZdk_1-@mail.gmail.com>

Daire Byrne wrote:
> Hi,
> 
> I have been trying to figure out how to lay down a file sequence (e.g.
> images) such that they are guaranteed to always be contiguous on disk
> (i.e. no block gaps between them). 

There's no mechanism to guarantee that.

Why is this the goal, what are you trying to achieve?

> Currently if I write a sequence to
> disk things like "filestreams" help keep everything in the same AG and
> the allocation algorithm seems to prefer to try and place files next
> to eachother but without the filesystem knowing the total size of the
> sequence there are always likely to be gaps in the blocks where
> existing data has been written. 

preallocation of each image before writing would help make it more
likely that each image is itself contiguous (but again this is not
-guaranteed-)

> So even if the first file is written
> completely contiguously to disk there is no way to guarantee that
> there is contiguous free space after it to write the rest of the
> images.
> 
> What I really want is to be able to find and reserve enough space for
> the entire sequence and then write the files into that big contiguous
> range. I tried to do this with xfs_io hoping that the allocator would
> just know what I wanted and do the right thing (ever the optimist...).

:)

> So something like this:
> 
>   # find and reserve a big chunk to fit all my files in
>   xfs_io -f -c "resvsp 0 136314880" -c "bmap -v" $DIR/test.0
> 
>   # now shrink it keeping the start block
>   xfs_io -f -c "freesp 13631488 0" -c "bmap -v" $DIR/test.0
> 
>   # now write a bunch of files and hope they continue from test.0 on disk
>   dd if=/dev/zero of=$DIR/test.0 bs=1M count=13 conv=nocreat,notrunc
>   for  x in `seq 1 4`; do
>       dd if=/dev/zero of=$DIR/test.$x bs=1M count=13 conv=notrunc
>   done
> 
> But a new allocation is made for the first new file in the sequence
> elsewhere on disk and I don't know how to get it to use the large
> chunk of free contiguous space after the "test.0" file instead.

You can't specify a starting block for any given file I'm afraid.

> Another option might be to create a single contiguous large file,
> concatenate all the images into it and then split it up on disk using
> offsets but I don't think such a thing is even possible? I always know
> the image sequence size beforehand, all images are exactly the same
> size and I can control/freeze the filesystem access if needed.
> 
> Anybody got any suggestions? It *seems* like something that should be
> possible and would be useful.

This would be pretty low-level control of the allocator by userspace.

I'll just go back and ask what problem you're trying to solve?  There
may be a better (i.e. currently existing) solution.

-Eric

> Daire
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
> 

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2010-09-22 20:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-22 11:01 Contiguous file sequences Daire Byrne
2010-09-22 20:10 ` Eric Sandeen [this message]
2010-09-24 10:43   ` Daire Byrne
2010-09-27  4:08     ` Eric Sandeen
2010-09-27 16:30       ` Daire Byrne
2010-09-27 18:35         ` Matthias Schniedermeyer
2010-09-28  1:16         ` Dave Chinner
2010-09-27 20:56       ` Roger Willcocks
2010-09-25  9:42   ` Michael Monnerie
2010-09-22 20:50 ` Matthias Schniedermeyer
2010-09-22 22:36   ` Dave Chinner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C9A6298.106@sandeen.net \
    --to=sandeen@sandeen.net \
    --cc=daire.byrne@gmail.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox