28 Mar, 2011

1 commit

  • Tracepoints can provide insight into why btrfs hits bugs and be greatly
    helpful for debugging, e.g
    dd-7822 [000] 2121.641088: btrfs_inode_request: root = 5(FS_TREE), gen = 4, ino = 256, blocks = 8, disk_i_size = 0, last_trans = 8, logged_trans = 0
    dd-7822 [000] 2121.641100: btrfs_inode_new: root = 5(FS_TREE), gen = 8, ino = 257, blocks = 0, disk_i_size = 0, last_trans = 0, logged_trans = 0
    btrfs-transacti-7804 [001] 2146.935420: btrfs_cow_block: root = 2(EXTENT_TREE), refs = 2, orig_buf = 29368320 (orig_level = 0), cow_buf = 29388800 (cow_level = 0)
    btrfs-transacti-7804 [001] 2146.935473: btrfs_cow_block: root = 1(ROOT_TREE), refs = 2, orig_buf = 29364224 (orig_level = 0), cow_buf = 29392896 (cow_level = 0)
    btrfs-transacti-7804 [001] 2146.972221: btrfs_transaction_commit: root = 1(ROOT_TREE), gen = 8
    flush-btrfs-2-7821 [001] 2155.824210: btrfs_chunk_alloc: root = 3(CHUNK_TREE), offset = 1103101952, size = 1073741824, num_stripes = 1, sub_stripes = 0, type = DATA
    flush-btrfs-2-7821 [001] 2155.824241: btrfs_cow_block: root = 2(EXTENT_TREE), refs = 2, orig_buf = 29388800 (orig_level = 0), cow_buf = 29396992 (cow_level = 0)
    flush-btrfs-2-7821 [001] 2155.824255: btrfs_cow_block: root = 4(DEV_TREE), refs = 2, orig_buf = 29372416 (orig_level = 0), cow_buf = 29401088 (cow_level = 0)
    flush-btrfs-2-7821 [000] 2155.824329: btrfs_cow_block: root = 3(CHUNK_TREE), refs = 2, orig_buf = 20971520 (orig_level = 0), cow_buf = 20975616 (cow_level = 0)
    btrfs-endio-wri-7800 [001] 2155.898019: btrfs_cow_block: root = 5(FS_TREE), refs = 2, orig_buf = 29384704 (orig_level = 0), cow_buf = 29405184 (cow_level = 0)
    btrfs-endio-wri-7800 [001] 2155.898043: btrfs_cow_block: root = 7(CSUM_TREE), refs = 2, orig_buf = 29376512 (orig_level = 0), cow_buf = 29409280 (cow_level = 0)

    Here is what I have added:

    1) ordere_extent:
    btrfs_ordered_extent_add
    btrfs_ordered_extent_remove
    btrfs_ordered_extent_start
    btrfs_ordered_extent_put

    These provide critical information to understand how ordered_extents are
    updated.

    2) extent_map:
    btrfs_get_extent

    extent_map is used in both read and write cases, and it is useful for tracking
    how btrfs specific IO is running.

    3) writepage:
    __extent_writepage
    btrfs_writepage_end_io_hook

    Pages are cirtical resourses and produce a lot of corner cases during writeback,
    so it is valuable to know how page is written to disk.

    4) inode:
    btrfs_inode_new
    btrfs_inode_request
    btrfs_inode_evict

    These can show where and when a inode is created, when a inode is evicted.

    5) sync:
    btrfs_sync_file
    btrfs_sync_fs

    These show sync arguments.

    6) transaction:
    btrfs_transaction_commit

    In transaction based filesystem, it will be useful to know the generation and
    who does commit.

    7) back reference and cow:
    btrfs_delayed_tree_ref
    btrfs_delayed_data_ref
    btrfs_delayed_ref_head
    btrfs_cow_block

    Btrfs natively supports back references, these tracepoints are helpful on
    understanding btrfs's COW mechanism.

    8) chunk:
    btrfs_chunk_alloc
    btrfs_chunk_free

    Chunk is a link between physical offset and logical offset, and stands for space
    infomation in btrfs, and these are helpful on tracing space things.

    9) reserved_extent:
    btrfs_reserved_extent_alloc
    btrfs_reserved_extent_free

    These can show how btrfs uses its space.

    Signed-off-by: Liu Bo
    Signed-off-by: Chris Mason

    liubo
     

01 Feb, 2011

1 commit


22 Dec, 2010

1 commit


29 Nov, 2010

1 commit

  • The new DIO bio splitting code has problems when the bio
    spans more than one ordered extent. This will happen as the
    generic DIO code merges our get_blocks calls together into
    a bigger single bio.

    This fixes things by walking forward in the ordered extent
    code finding all the overlapping ordered extents and completing them
    all at once.

    Signed-off-by: Chris Mason

    Chris Mason
     

30 Oct, 2010

1 commit

  • These are all the cases where a variable is set, but not read which are
    not bugs as far as I can see, but simply leftovers.

    Still needs more review.

    Found by gcc 4.6's new warnings

    Signed-off-by: Andi Kleen
    Cc: Chris Mason
    Signed-off-by: Andrew Morton
    Signed-off-by: Chris Mason

    Andi Kleen
     

25 May, 2010

2 commits

  • This provides basic DIO support for reading and writing. It does not do the
    work to recover from mismatching checksums, that will come later. A few design
    changes have been made from Jim's code (sorry Jim!)

    1) Use the generic direct-io code. Jim originally re-wrote all the generic DIO
    code in order to account for all of BTRFS's oddities, but thanks to that work it
    seems like the best bet is to just ignore compression and such and just opt to
    fallback on buffered IO.

    2) Fallback on buffered IO for compressed or inline extents. Jim's code did
    it's own buffering to make dio with compressed extents work. Now we just
    fallback onto normal buffered IO.

    3) Use ordered extents for the writes so that all of the

    lock_extent()
    lookup_ordered()

    type checks continue to work.

    4) Do the lock_extent() lookup_ordered() loop in readpage so we don't race with
    DIO writes.

    I've tested this with fsx and everything works great. This patch depends on my
    dio and filemap.c patches to work. Thanks,

    Signed-off-by: Josef Bacik
    Signed-off-by: Chris Mason

    Josef Bacik
     
  • Introduce metadata reservation context for delayed allocation
    and update various related functions.

    This patch also introduces EXTENT_FIRST_DELALLOC control bit for
    set/clear_extent_bit. It tells set/clear_bit_hook whether they
    are processing the first extent_state with EXTENT_DELALLOC bit
    set. This change is important if set/clear_extent_bit involves
    multiple extent_state.

    Signed-off-by: Yan Zheng
    Signed-off-by: Chris Mason

    Yan, Zheng
     

06 Apr, 2010

1 commit

  • * git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable:
    Btrfs: add check for changed leaves in setup_leaf_for_split
    Btrfs: create snapshot references in same commit as snapshot
    Btrfs: fix small race with delalloc flushing waitqueue's
    Btrfs: use add_to_page_cache_lru, use __page_cache_alloc
    Btrfs: fix chunk allocate size calculation
    Btrfs: kill max_extent mount option
    Btrfs: fail to mount if we have problems reading the block groups
    Btrfs: check btrfs_get_extent return for IS_ERR()
    Btrfs: handle kmalloc() failure in inode lookup ioctl
    Btrfs: dereferencing freed memory
    Btrfs: Simplify num_stripes's calculation logical for __btrfs_alloc_chunk()
    Btrfs: Add error handle for btrfs_search_slot() in btrfs_read_chunk_tree()
    Btrfs: Remove unnecessary finish_wait() in wait_current_trans()
    Btrfs: add NULL check for do_walk_down()
    Btrfs: remove duplicate include in ioctl.c

    Fix trivial conflict in fs/btrfs/compression.c due to slab.h include
    cleanups.

    Linus Torvalds
     

31 Mar, 2010

1 commit

  • As Yan pointed out, theres not much reason for all this complicated math to
    account for file extents being split up into max_extent chunks, since they are
    likely to all end up in the same leaf anyway. Since there isn't much reason to
    use max_extent, just remove the option altogether so we have one less thing we
    need to test.

    Signed-off-by: Josef Bacik
    Signed-off-by: Chris Mason

    Josef Bacik
     

30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

15 Mar, 2010

2 commits

  • When finishing io we run btrfs_dec_test_ordered_pending, and then immediately
    run btrfs_lookup_ordered_extent, but btrfs_dec_test_ordered_pending does that
    already, so we're searching twice when we don't have to. This patch lets us
    pass a btrfs_ordered_extent in to btrfs_dec_test_ordered_pending so if we do
    complete io on that ordered extent we can just use the one we found then instead
    of having to do another btrfs_lookup_ordered_extent. This made my fio job with
    the other patch go from 24 mb/s to 29 mb/s.

    Signed-off-by: Josef Bacik
    Signed-off-by: Chris Mason

    Josef Bacik
     
  • The ordered tree used to need a mutex, but currently all we use it for is to
    protect the rb_tree, and a spin_lock is just fine for that. Using a spin_lock
    instead makes dbench run a little faster, 58 mb/s instead of 51 mb/s, and have
    less latency, 3445.138 ms instead of 3820.633 ms.

    Signed-off-by: Josef Bacik
    Signed-off-by: Chris Mason

    Josef Bacik
     

18 Jan, 2010

1 commit


18 Dec, 2009

2 commits

  • iput() can trigger new transactions if we are dropping the
    final reference, so calling it in btrfs_commit_transaction
    may end up deadlock. This patch adds delayed iput to avoid
    the issue.

    Signed-off-by: Yan Zheng
    Signed-off-by: Chris Mason

    Yan, Zheng
     
  • There are some cases file extents are inserted without involving
    ordered struct. In these cases, we update disk_i_size directly,
    without checking pending ordered extent and DELALLOC bit. This
    patch extends btrfs_ordered_update_i_size() to handle these cases.

    Signed-off-by: Yan Zheng
    Signed-off-by: Chris Mason

    Yan, Zheng
     

12 Oct, 2009

1 commit

  • * git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable:
    Btrfs: fix file clone ioctl for bookend extents
    Btrfs: fix uninit compiler warning in cow_file_range_nocow
    Btrfs: constify dentry_operations
    Btrfs: optimize back reference update during btrfs_drop_snapshot
    Btrfs: remove negative dentry when deleting subvolumne
    Btrfs: optimize fsync for the single writer case
    Btrfs: async delalloc flushing under space pressure
    Btrfs: release delalloc reservations on extent item insertion
    Btrfs: delay clearing EXTENT_DELALLOC for compressed extents
    Btrfs: cleanup extent_clear_unlock_delalloc flags
    Btrfs: fix possible softlockup in the allocator
    Btrfs: fix deadlock on async thread startup

    Linus Torvalds
     

09 Oct, 2009

1 commit

  • This patch fixes an issue with the delalloc metadata space reservation
    code. The problem is we used to free the reservation as soon as we
    allocated the delalloc region. The problem with this is if we are not
    inserting an inline extent, we don't actually insert the extent item until
    after the ordered extent is written out. This patch does 3 things,

    1) It moves the reservation clearing stuff into the ordered code, so when
    we remove the ordered extent we remove the reservation.
    2) It adds a EXTENT_DO_ACCOUNTING flag that gets passed when we clear
    delalloc bits in the cases where we want to clear the metadata reservation
    when we clear the delalloc extent, in the case that we do an inline extent
    or we invalidate the page.
    3) It adds another waitqueue to the space info so that when we start a fs
    wide delalloc flush, anybody else who also hits that area will simply wait
    for the flush to finish and then try to make their allocation.

    This has been tested thoroughly to make sure we did not regress on
    performance.

    Signed-off-by: Josef Bacik
    Signed-off-by: Chris Mason

    Josef Bacik
     

02 Oct, 2009

1 commit

  • Use filemap_fdatawrite_range and filemap_fdatawait_range instead of
    local copies of the functions. For filemap_fdatawait_range that
    also means replacing the awkward old wait_on_page_writeback_range
    calling convention with the regular filemap byte offsets.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Chris Mason

    Christoph Hellwig
     

24 Sep, 2009

1 commit


16 Sep, 2009

1 commit


12 Sep, 2009

2 commits

  • Btrfs writes go through delalloc to the data=ordered code. This
    makes sure that all of the data is on disk before the metadata
    that references it. The tracking means that we have to make sure
    each page in an extent is fully written before we add that extent into
    the on-disk btree.

    This was done in the past by setting the EXTENT_ORDERED bit for the
    range of an extent when it was added to the data=ordered code, and then
    clearing the EXTENT_ORDERED bit in the extent state tree as each page
    finished IO.

    One of the reasons we had to do this was because sometimes pages are
    magically dirtied without page_mkwrite being called. The EXTENT_ORDERED
    bit is checked at writepage time, and if it isn't there, our page become
    dirty without going through the proper path.

    These bit operations make for a number of rbtree searches for each page,
    and can cause considerable lock contention.

    This commit switches from the EXTENT_ORDERED bit to use PagePrivate2.
    As pages go into the ordered code, PagePrivate2 is set on each one.
    This is a cheap operation because we already have all the pages locked
    and ready to go.

    As IO finishes, the PagePrivate2 bit is cleared and the ordered
    accoutning is updated for each page.

    At writepage time, if the PagePrivate2 bit is missing, we go into the
    writepage fixup code to handle improperly dirtied pages.

    Signed-off-by: Chris Mason

    Chris Mason
     
  • This changes the btrfs code to find delalloc ranges in the extent state
    tree to use the new state caching code from set/test bit. It reduces
    one of the biggest causes of rbtree searches in the writeback path.

    test_range_bit is also modified to take the cached state as a starting
    point while searching.

    Signed-off-by: Chris Mason

    Chris Mason
     

21 Apr, 2009

1 commit

  • Part of reducing fsync/O_SYNC/O_DIRECT latencies is using WRITE_SYNC for
    writes we plan on waiting on in the near future. This patch
    mirrors recent changes in other filesystems and the generic code to
    use WRITE_SYNC when WB_SYNC_ALL is passed and to use WRITE_SYNC for
    other latency critical writes.

    Btrfs uses async worker threads for checksumming before the write is done,
    and then again to actually submit the bios. The bio submission code just
    runs a per-device list of bios that need to be sent down the pipe.

    This list is split into low priority and high priority lists so the
    WRITE_SYNC IO happens first.

    Signed-off-by: Chris Mason

    Chris Mason
     

01 Apr, 2009

1 commit

  • Renames and truncates are both common ways to replace old data with new
    data. The filesystem can make an effort to make sure the new data is
    on disk before actually replacing the old data.

    This is especially important for rename, which many application use as
    though it were atomic for both the data and the metadata involved. The
    current btrfs code will happily replace a file that is fully on disk
    with one that was just created and still has pending IO.

    If we crash after transaction commit but before the IO is done, we'll end
    up replacing a good file with a zero length file. The solution used
    here is to create a list of inodes that need special ordering and force
    them to disk before the commit is done. This is similar to the
    ext3 style data=ordering, except it is only done on selected files.

    Btrfs is able to get away with this because it does not wait on commits
    very often, even for fsync (which use a sub-commit).

    For renames, we order the file when it wasn't already
    on disk and when it is replacing an existing file. Larger files
    are sent to filemap_flush right away (before the transaction handle is
    opened).

    For truncates, we order if the file goes from non-zero size down to
    zero size. This is a little different, because at the time of the
    truncate the file has no dirty bytes to order. But, we flag the inode
    so that it is added to the ordered list on close (via release method). We
    also immediately add it to the ordered list of the current transaction
    so that we can try to flush down any writes the application sneaks in
    before commit.

    Signed-off-by: Chris Mason

    Chris Mason
     

21 Jan, 2009

1 commit


06 Jan, 2009

1 commit


09 Dec, 2008

1 commit

  • Btrfs stores checksums for each data block. Until now, they have
    been stored in the subvolume trees, indexed by the inode that is
    referencing the data block. This means that when we read the inode,
    we've probably read in at least some checksums as well.

    But, this has a few problems:

    * The checksums are indexed by logical offset in the file. When
    compression is on, this means we have to do the expensive checksumming
    on the uncompressed data. It would be faster if we could checksum
    the compressed data instead.

    * If we implement encryption, we'll be checksumming the plain text and
    storing that on disk. This is significantly less secure.

    * For either compression or encryption, we have to get the plain text
    back before we can verify the checksum as correct. This makes the raid
    layer balancing and extent moving much more expensive.

    * It makes the front end caching code more complex, as we have touch
    the subvolume and inodes as we cache extents.

    * There is potentitally one copy of the checksum in each subvolume
    referencing an extent.

    The solution used here is to store the extent checksums in a dedicated
    tree. This allows us to index the checksums by phyiscal extent
    start and length. It means:

    * The checksum is against the data stored on disk, after any compression
    or encryption is done.

    * The checksum is stored in a central location, and can be verified without
    following back references, or reading inodes.

    This makes compression significantly faster by reducing the amount of
    data that needs to be checksummed. It will also allow much faster
    raid management code in general.

    The checksums are indexed by a key with a fixed objectid (a magic value
    in ctree.h) and offset set to the starting byte of the extent. This
    allows us to copy the checksum items into the fsync log tree directly (or
    any other tree), without having to invent a second format for them.

    Signed-off-by: Chris Mason

    Chris Mason
     

07 Nov, 2008

1 commit

  • When reading compressed extents, try to put pages into the page cache
    for any pages covered by the compressed extent that readpages didn't already
    preload.

    Add an async work queue to handle transformations at delayed allocation processing
    time. Right now this is just compression. The workflow is:

    1) Find offsets in the file marked for delayed allocation
    2) Lock the pages
    3) Lock the state bits
    4) Call the async delalloc code

    The async delalloc code clears the state lock bits and delalloc bits. It is
    important this happens before the range goes into the work queue because
    otherwise it might deadlock with other work queue items that try to lock
    those extent bits.

    The file pages are compressed, and if the compression doesn't work the
    pages are written back directly.

    An ordered work queue is used to make sure the inodes are written in the same
    order that pdflush or writepages sent them down.

    This changes extent_write_cache_pages to let the writepage function
    update the wbc nr_written count.

    Signed-off-by: Chris Mason

    Chris Mason
     

31 Oct, 2008

2 commits

  • This patch updates btrfs-progs for fallocate support.

    fallocate is a little different in Btrfs because we need to tell the
    COW system that a given preallocated extent doesn't need to be
    cow'd as long as there are no snapshots of it. This leverages the
    -o nodatacow checks.

    Signed-off-by: Yan Zheng

    Yan Zheng
     
  • This patch simplifies the nodatacow checker. If all references
    were created after the latest snapshot, then we can avoid COW
    safely. This patch also updates run_delalloc_nocow to do more
    fine-grained checking.

    Signed-off-by: Yan Zheng

    Yan Zheng
     

30 Oct, 2008

1 commit

  • This is a large change for adding compression on reading and writing,
    both for inline and regular extents. It does some fairly large
    surgery to the writeback paths.

    Compression is off by default and enabled by mount -o compress. Even
    when the -o compress mount option is not used, it is possible to read
    compressed extents off the disk.

    If compression for a given set of pages fails to make them smaller, the
    file is flagged to avoid future compression attempts later.

    * While finding delalloc extents, the pages are locked before being sent down
    to the delalloc handler. This allows the delalloc handler to do complex things
    such as cleaning the pages, marking them writeback and starting IO on their
    behalf.

    * Inline extents are inserted at delalloc time now. This allows us to compress
    the data before inserting the inline extent, and it allows us to insert
    an inline extent that spans multiple pages.

    * All of the in-memory extent representations (extent_map.c, ordered-data.c etc)
    are changed to record both an in-memory size and an on disk size, as well
    as a flag for compression.

    From a disk format point of view, the extent pointers in the file are changed
    to record the on disk size of a given extent and some encoding flags.
    Space in the disk format is allocated for compression encoding, as well
    as encryption and a generic 'other' field. Neither the encryption or the
    'other' field are currently used.

    In order to limit the amount of data read for a single random read in the
    file, the size of a compressed extent is limited to 128k. This is a
    software only limit, the disk format supports u64 sized compressed extents.

    In order to limit the ram consumed while processing extents, the uncompressed
    size of a compressed extent is limited to 256k. This is a software only limit
    and will be subject to tuning later.

    Checksumming is still done on compressed extents, and it is done on the
    uncompressed version of the data. This way additional encodings can be
    layered on without having to figure out which encoding to checksum.

    Compression happens at delalloc time, which is basically singled threaded because
    it is usually done by a single pdflush thread. This makes it tricky to
    spread the compression load across all the cpus on the box. We'll have to
    look at parallel pdflush walks of dirty inodes at a later time.

    Decompression is hooked into readpages and it does spread across CPUs nicely.

    Signed-off-by: Chris Mason

    Chris Mason
     

04 Oct, 2008

1 commit

  • This reworks the btrfs O_DIRECT write code a bit. It had always fallen
    back to buffered IO and done an invalidate, but needed to be updated
    for the data=ordered code. The invalidate wasn't actually removing pages
    because they were still inside an ordered extent.

    This also combines the O_DIRECT/O_SYNC paths where possible, and kicks
    off IO in the main btrfs_file_write loop to keep the pipe down the the
    disk full as we process long writes.

    Signed-off-by: Chris Mason

    Chris Mason
     

30 Sep, 2008

1 commit

  • This improves the comments at the top of many functions. It didn't
    dive into the guts of functions because I was trying to
    avoid merging problems with the new allocator and back reference work.

    extent-tree.c and volumes.c were both skipped, and there is definitely
    more work todo in cleaning and commenting the code.

    Signed-off-by: Chris Mason

    Chris Mason
     

26 Sep, 2008

1 commit

  • * Add an EXTENT_BOUNDARY state bit to keep the writepage code
    from merging data extents that are in the process of being
    relocated. This allows us to do accounting for them properly.

    * The balancing code relocates data extents indepdent of the underlying
    inode. The extent_map code was modified to properly account for
    things moving around (invalidating extent_map caches in the inode).

    * Don't take the drop_mutex in the create_subvol ioctl. It isn't
    required.

    * Fix walking of the ordered extent list to avoid races with sys_unlink

    * Change the lock ordering rules. Transaction start goes outside
    the drop_mutex. This allows btrfs_commit_transaction to directly
    drop the relocation trees.

    Signed-off-by: Chris Mason

    Zheng Yan
     

25 Sep, 2008

6 commits

  • Signed-off-by: Chris Mason

    Yan Zheng
     
  • This trivial patch contains two locking fixes and a off by one fix.

    ---

    Signed-off-by: Chris Mason

    Yan Zheng
     
  • Before setting an extent to delalloc, the code needs to wait for
    pending ordered extents.

    Also, the relocation code needs to wait for ordered IO before scanning
    the block group again. This is because the extents are not removed
    until the IO for the new extents is finished

    Signed-off-by: Chris Mason

    Chris Mason
     
  • Checksum items are not inserted into the tree until all of the io from a
    given extent is complete. This means one dirty page from an extent may
    be written, freed, and then read again before the entire extent is on disk
    and the checksum item is inserted.

    The checksums themselves are stored in the ordered extent so they can
    be inserted in bulk when IO is complete. On read, if a checksum item isn't
    found, the ordered extents were being searched for a checksum record.

    This all worked most of the time, but the checksum insertion code tries
    to reduce the number of tree operations by pre-inserting checksum items
    based on i_size and a few other factors. This means the read code might
    find a checksum item that hasn't yet really been filled in.

    This commit changes things to check the ordered extents first and only
    dive into the btree if nothing was found. This removes the need for
    extra locking and is more reliable.

    Signed-off-by: Chris Mason

    Chris Mason
     
  • Signed-off-by: Chris Mason

    Chris Mason
     
  • Stress testing was showing data checksum errors, most of which were caused
    by a lookup bug in the extent_map tree. The tree was caching the last
    pointer returned, and searches would check the last pointer first.

    But, search callers also expect the search to return the very first
    matching extent in the range, which wasn't always true with the last
    pointer usage.

    For now, the code to cache the last return value is just removed. It is
    easy to fix, but I think lookups are rare enough that it isn't required anymore.

    This commit also replaces do_sync_mapping_range with a local copy of the
    related functions.

    Signed-off-by: Chris Mason

    Chris Mason