[lkml]   [2003]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRE: Is there a "make hole" (truncate in middle) syscall?
    > The abstract interface for make_hole() is simple, but it turns into a
    > pretty expensive filesystem operation, I think. After many cycles of
    > free/allocate, your file would be badly fragmented across the
    > filesystem.

    Understood. Two filesystems we are using: tmpfs and ext3. For the
    former, fragmentation doesn't matter.

    Hey, I think when I get some cycles I can try to implement this for
    tmpfs (since it's simpler) myself, and post a patch. :-) But before
    that, I want to make sure it's doable.

    > You'll probably get better overall performance by keeping
    > track of how "sparse" your file is (you could compare st_blocks versus
    > how many blocks you have allocated in your tree structure)
    > and re-write
    > it when you're wasting more than, say, 20% of the allocated space.
    > It turns into an interesting problem if you don't want to double your
    > space requirements during the re-write process. You could write the
    > new file "backwards", one MB at a time, truncating the
    > previous file at
    > each step to free up the blocks. You'd end up with contiguous 1MB
    > chunks, which given your tree organization is probably good
    > enough. If
    > you wanted really good streaming performance you'd want to do bigger
    > chunks (or just write the file from the beginning, or use the
    > pre-allocation APIs that I think XFS provides).
    > -andy

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 13:59    [W:0.021 / U:3.780 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site