1. 13 4月, 2012 1 次提交
  2. 29 3月, 2012 2 次提交
  3. 27 3月, 2012 10 次提交
  4. 22 3月, 2012 4 次提交
  5. 24 2月, 2012 1 次提交
  6. 23 2月, 2012 1 次提交
  7. 17 2月, 2012 1 次提交
  8. 15 2月, 2012 1 次提交
    • L
      Btrfs: fix trim 0 bytes after a device delete · 2cac13e4
      Liu Bo 提交于
      A user reported a bug of btrfs's trim, that is we will trim 0 bytes
      after a device delete.
      
      The reproducer:
      
      $ mkfs.btrfs disk1
      $ mkfs.btrfs disk2
      $ mount disk1 /mnt
      $ fstrim -v /mnt
      $ btrfs device add disk2 /mnt
      $ btrfs device del disk1 /mnt
      $ fstrim -v /mnt
      
      This is because after we delete the device, the block group may start from
      a non-zero place, which will confuse trim to discard nothing.
      Reported-by: NLutz Euler <lutz.euler@freenet.de>
      Signed-off-by: NLiu Bo <liubo2009@cn.fujitsu.com>
      2cac13e4
  9. 27 1月, 2012 1 次提交
    • M
      Btrfs: fix enospc error caused by wrong checks of the chunk · 9e622d6b
      Miao Xie 提交于
      When we did sysbench test for inline files, enospc error happened easily though
      there was lots of free disk space which could be allocated for new chunks.
      
      Reproduce steps:
       # mkfs.btrfs -b $((2 * 1024 * 1024 * 1024)) <test partition>
       # mount <test partition> /mnt
       # ulimit -n 102400
       # cd /mnt
       # sysbench --num-threads=1 --test=fileio --file-num=81920 \
       > --file-total-size=80M --file-block-size=1K --file-io-mode=sync \
       > --file-test-mode=seqwr prepare
       # sysbench --num-threads=1 --test=fileio --file-num=81920 \
       > --file-total-size=80M --file-block-size=1K --file-io-mode=sync \
       > --file-test-mode=seqwr run
       <soon later, BUG_ON() was triggered by enospc error>
      
      The reason of this bug is:
      Now, we can reserve space which is larger than the free space in the chunks if
      we have enough free disk space which can be used for new chunks. By this way,
      the space allocator should allocate a new chunk by force if there is no free
      space in the free space cache. But there are two wrong checks which break this
      operation.
      
      One is
      	if (ret == -ENOSPC && num_bytes > min_alloc_size)
      in btrfs_reserve_extent(), it is wrong, we should try to allocate a new chunk
      even we fail to allocate free space by minimum allocable size.
      
      The other is
      	if (space_info->force_alloc)
      		force = space_info->force_alloc;
      in do_chunk_alloc(). It makes the allocator ignore CHUNK_ALLOC_FORCE If someone
      sets ->force_alloc to CHUNK_ALLOC_LIMITED, and makes the enospc error happen.
      
      Fix these two wrong checks. Especially the second one, we fix it by changing
      the value of CHUNK_ALLOC_LIMITED and CHUNK_ALLOC_FORCE, and make
      CHUNK_ALLOC_FORCE greater than CHUNK_ALLOC_LIMITED since CHUNK_ALLOC_FORCE has
      higher priority. And if the value which is passed in by the caller is greater
      than ->force_alloc, use the passed value.
      Signed-off-by: NMiao Xie <miaox@cn.fujitsu.com>
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      9e622d6b
  10. 17 1月, 2012 10 次提交
  11. 11 1月, 2012 2 次提交
    • L
      Btrfs: update global block_rsv when creating a new block group · c7c144db
      Li Zefan 提交于
      A bug was triggered while using seed device:
      
          # mkfs.btrfs /dev/loop1
          # btrfstune -S 1 /dev/loop1
          # mount -o /dev/loop1 /mnt
          # btrfs dev add /dev/loop2 /mnt
      
      btrfs: block rsv returned -28
      ------------[ cut here ]------------
      WARNING: at fs/btrfs/extent-tree.c:5969 btrfs_alloc_free_block+0x166/0x396 [btrfs]()
      ...
      Call Trace:
      ...
      [<f7b7c31c>] btrfs_cow_block+0x101/0x147 [btrfs]
      [<f7b7eaa6>] btrfs_search_slot+0x1b8/0x55f [btrfs]
      [<f7b7f844>] btrfs_insert_empty_items+0x42/0x7f [btrfs]
      [<f7b7f8c1>] btrfs_insert_item+0x40/0x7e [btrfs]
      [<f7b8ac02>] btrfs_make_block_group+0x243/0x2aa [btrfs]
      [<f7bb3f53>] __btrfs_alloc_chunk+0x672/0x70e [btrfs]
      [<f7bb41ff>] init_first_rw_device+0x77/0x13c [btrfs]
      [<f7bb5a62>] btrfs_init_new_device+0x664/0x9fd [btrfs]
      [<f7bbb65a>] btrfs_ioctl+0x694/0xdbe [btrfs]
      [<c04f55f7>] do_vfs_ioctl+0x496/0x4cc
      [<c04f5660>] sys_ioctl+0x33/0x4f
      [<c07b9edf>] sysenter_do_call+0x12/0x38
      ---[ end trace 906adac595facc7d ]---
      
      Since seed device is readonly, there's no usable space in the filesystem.
      Afterwards we add a sprout device to it, and the kernel creates a METADATA
      block group and a SYSTEM block group where comes free space we can reserve,
      but we still get revervation failure because the global block_rsv hasn't
      been updated accordingly.
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      c7c144db
    • L
      Btrfs: don't pass a trans handle unnecessarily in volumes.c · 125ccb0a
      Li Zefan 提交于
      Some functions never use the transaction handle passed to them.
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      125ccb0a
  12. 08 1月, 2012 1 次提交
  13. 07 1月, 2012 3 次提交
    • A
      Btrfs: test free space only for unclustered allocation · a5f6f719
      Alexandre Oliva 提交于
      Since the clustered allocation may be taking extents from a different
      block group, there's no point in spin-locking and testing the current
      block group free space before attempting to allocate space from a
      cluster, even more so when we might refrain from even trying the
      cluster in the current block group because, after the cluster was set
      up, not enough free space remained.  Furthermore, cluster creation
      attempts fail fast when the block group doesn't have enough free
      space, so the test was completely superfluous.
      
      I've move the free space test past the cluster allocation attempt,
      where it is more useful, and arranged for a cluster in the current
      block group to be released before trying an unclustered allocation,
      when we reach the LOOP_NO_EMPTY_SIZE stage, so that the free space in
      the cluster stands a chance of being combined with additional free
      space in the block group so as to succeed in the allocation attempt.
      Signed-off-by: NAlexandre Oliva <oliva@lsd.ic.unicamp.br>
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      a5f6f719
    • C
      Btrfs: lower the bar for chunk allocation · cf1d72c9
      Chris Mason 提交于
      The chunk allocation code has tried to keep a pretty tight lid on creating new
      metadata chunks.  This is partially because in the past the reservation
      code didn't give us an accurate idea of how much space was being used.
      
      The new code is much more accurate, so we're able to get rid of some of these
      checks.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      cf1d72c9
    • C
      Btrfs: run chunk allocations while we do delayed refs · 203bf287
      Chris Mason 提交于
      Btrfs tries to batch extent allocation tree changes to improve performance
      and reduce metadata trashing.  But it doesn't allocate new metadata chunks
      while it is doing allocations for the extent allocation tree.
      
      This commit changes the delayed refence code to do chunk allocations if we're
      getting low on room.  It prevents crashes and improves performance.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      203bf287
  14. 04 1月, 2012 2 次提交