1. 13 12月, 2012 2 次提交
    • S
      Btrfs: pass fs_info instead of root · aa1b8cd4
      Stefan Behrens 提交于
      A small number of functions that are used in a device replace
      procedure when the operation is resumed at mount time are unable
      to pass the same root pointer that would be used in the regular
      (ioctl) context. And since the root pointer is not required, only
      the fs_info is, the root pointer argument is replaced with the
      fs_info pointer argument.
      Signed-off-by: NStefan Behrens <sbehrens@giantdisaster.de>
      Signed-off-by: NChris Mason <chris.mason@fusionio.com>
      aa1b8cd4
    • S
      Btrfs: don't allow degraded mount if too many devices are missing · 292fd7fc
      Stefan Behrens 提交于
      The current behavior is to allow mounting or remounting a filesystem
      writeable in degraded mode if at least one writeable device is
      present.
      The next failed write access to a missing device which is above
      the tolerance of the configured level of redundancy results in an
      read-only enforcement. Even without this, the next time
      barrier_all_devices() is called and more devices are missing than
      tolerable, the switch to read-only mode takes place.
      
      In order to behave predictably and to provide proper feedback to
      the user at mount time, this patch compares the number of missing
      devices with the number of devices that are tolerated to be missing
      according to the configured RAID level. If more devices are missing
      than tolerated, e.g. if two devices are missing in case of RAID1,
      only a read-only mount and remount is allowed.
      Signed-off-by: NStefan Behrens <sbehrens@giantdisaster.de>
      Signed-off-by: NChris Mason <chris.mason@fusionio.com>
      292fd7fc
  2. 09 10月, 2012 3 次提交
    • A
      Btrfs: make compress and nodatacow mount options mutually exclusive · bedb2cca
      Andrei Popa 提交于
      If a filesystem is mounted with compression and then remounted by adding nodatacow,
      the compression is disabled but the compress flag is still visible.
      Also, if a filesystem is mounted with nodatacow and then remounted with compression,
      nodatacow flag is still present but it's not active.
      This patch:
      - removes compress flags and notifies that the compression has been disabled if the
        filesystem is mounted with nodatacow
      - removes nodatacow and nodatasum flags if mounted with compress.
      Signed-off-by: NAndrei Popa <andrei.popa@i-neo.ro>
      bedb2cca
    • D
      btrfs: fix message printing · 48940662
      Daniel J Blueman 提交于
      Fix various messages to include newline and module prefix.
      Signed-off-by: NDaniel J Blueman <daniel@quora.org>
      48940662
    • M
      Btrfs: fix orphan transaction on the freezed filesystem · 354aa0fb
      Miao Xie 提交于
      With the following debug patch:
      
       static int btrfs_freeze(struct super_block *sb)
       {
      + 	struct btrfs_fs_info *fs_info = btrfs_sb(sb);
      +	struct btrfs_transaction *trans;
      +
      +	spin_lock(&fs_info->trans_lock);
      +	trans = fs_info->running_transaction;
      +	if (trans) {
      +		printk("Transid %llu, use_count %d, num_writer %d\n",
      +			trans->transid, atomic_read(&trans->use_count),
      +			atomic_read(&trans->num_writers));
      +	}
      +	spin_unlock(&fs_info->trans_lock);
       	return 0;
       }
      
      I found there was a orphan transaction after the freeze operation was done.
      
      It is because the transaction may not be committed when the transaction handle
      end even though it is the last handle of the current transaction. This design
      avoid committing the transaction frequently, but also introduce the above
      problem.
      
      So I add btrfs_attach_transaction() which can catch the current transaction
      and commit it. If there is no transaction, it will return ENOENT, and do not
      anything.
      
      This function also can be used to instead of btrfs_join_transaction_freeze()
      because it don't increase the writer counter and don't start a new transaction,
      so it also can fix the deadlock between sync and freeze.
      
      Besides that, it is used to instead of btrfs_join_transaction() in
      transaction_kthread(), because if there is no transaction, the transaction
      kthread needn't anything.
      Signed-off-by: NMiao Xie <miaox@cn.fujitsu.com>
      354aa0fb
  3. 04 10月, 2012 3 次提交
  4. 02 10月, 2012 2 次提交
    • M
      Btrfs: output more information when aborting a unused transaction handle · 69ce977a
      Miao Xie 提交于
      Though we dump the stack information when aborting a unused transaction
      handle, we don't know the correct place where we decide to abort the
      transaction handle if one function has several place where the transaction
      abort function is invoked and jumps to the same place after this call.
      And beside that we also don't know the reason why we jump to abort
      the current handle. So I modify the transaction abort function and make
      it output the function name, line and error information.
      Signed-off-by: NMiao Xie <miaox@cn.fujitsu.com>
      69ce977a
    • M
      Btrfs: use a slab for ordered extents allocation · 6352b91d
      Miao Xie 提交于
      The ordered extent allocation is in the fast path of the IO, so use a slab
      to improve the speed of the allocation.
      
       "Size of the struct is 280, so this will fall into the size-512 bucket,
        giving 8 objects per page, while own slab will pack 14 objects into a page.
      
        Another benefit I see is to check for leaked objects when the module is
        removed (and the cache destroy takes place)."
      						-- David Sterba
      Signed-off-by: NMiao Xie <miaox@cn.fujitsu.com>
      6352b91d
  5. 29 8月, 2012 2 次提交
    • J
      Btrfs: fix deadlock with freeze and sync V2 · bd7de2c9
      Josef Bacik 提交于
      We can deadlock with freeze right now because we unconditionally start a
      transaction in our ->sync_fs() call.  To fix this just check and see if we
      have a running transaction to commit.  This saves us from the deadlock
      because at this point we'll have the umount sem for the sb so we're safe
      from freezes coming in after we've done our check.  With this patch the
      freeze xfstests no longer deadlocks.  Thanks,
      Signed-off-by: NJosef Bacik <jbacik@fusionio.com>
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      bd7de2c9
    • J
      Btrfs: do not use missing devices when showing devname · aa9ddcd4
      Josef Bacik 提交于
      If you do the following
      
      mkfs.btrfs /dev/sdb /dev/sdc
      rmmod btrfs
      dd if=/dev/zero of=/dev/sdb bs=1M count=1
      mount -o degraded /dev/sdc /mnt/btrfs-test
      
      the box will panic trying to deref the name for the missing dev since it is
      the lower numbered devid.  So fix show_devname to not use missing devices.
      Thanks,
      Signed-off-by: NJosef Bacik <jbacik@fusionio.com>
      aa9ddcd4
  6. 04 8月, 2012 1 次提交
  7. 31 7月, 2012 1 次提交
  8. 26 7月, 2012 1 次提交
  9. 24 7月, 2012 3 次提交
  10. 14 7月, 2012 1 次提交
  11. 03 7月, 2012 1 次提交
  12. 15 6月, 2012 1 次提交
    • J
      Btrfs: implement ->show_devname · 9c5085c1
      Josef Bacik 提交于
      Because btrfs can remove the device that was mounted we need to have a
      ->show_devname so that in this case we can print out some other device in
      the file system to /proc/mount.  So if there are multiple devices in a btrfs
      file system we will just print the device with the lowest devid that we can
      find.  This will make everything consistent and deal with device removal
      properly.  The drawback is if you mount with a device that is higher than
      the lowest devicd it won't show up as the mounted device in /proc/mounts,
      but this is a small price to pay. This was inspired by Miao Xie's patch.
      Thanks,
      Reviewed-by: NMiao Xie <miaox@cn.fujitsu.com>
      Signed-off-by: NJosef Bacik <josef@redhat.com>
      9c5085c1
  13. 30 5月, 2012 4 次提交
    • J
      Btrfs: avoid buffer overrun in mount option handling · f60d16a8
      Jim Meyering 提交于
      There is an off-by-one error: allocating room for a maximal result
      string but without room for a trailing NUL.  That, can lead to
      returning a transformed string that is not NUL-terminated, and
      then to a caller reading beyond end of the malloc'd buffer.
      
      Rewrite to s/kzalloc/kmalloc/, remove unwarranted use of strncpy
      (the result is guaranteed to fit), remove dead strlen at end, and
      change a few variable names and comments.
      Reviewed-by: NJosef Bacik <josef@redhat.com>
      Signed-off-by: NJim Meyering <meyering@redhat.com>
      f60d16a8
    • J
      Btrfs: avoid buffer overrun in btrfs_printk · f07c9a79
      Jim Meyering 提交于
      The buffer read-overrun would be triggered by a printk format
      starting with <N>, where N is a single digit.  NUL-terminate
      after strncpy.  Use memcpy, not strncpy, since we know the
      string we're copying fits in the destination buffer and
      contains no NUL byte.
      Signed-off-by: NJim Meyering <meyering@redhat.com>
      f07c9a79
    • S
      btrfs: allow changing 'thread_pool' size at remount time · 0d2450ab
      Sergei Trofimovich 提交于
      Changing 'mount -oremount,thread_pool=2 /' didn't make any effect:
      
      maximum amount of worker threads is specified in 2 places:
      - in 'strict btrfs_fs_info::thread_pool_size'
      - in each worker struct: 'struct btrfs_workers::max_workers'
      
      'mount -oremount' updated only 'btrfs_fs_info::thread_pool_size'.
      
      Fix it by pushing new maximum value to all created worker structures
      as well.
      
      Cc: Josef Bacik <josef@redhat.com>
      Cc: Chris Mason <chris.mason@oracle.com>
      Reviewed-by: NJosef Bacik <josef@redhat.com>
      Signed-off-by: NSergei Trofimovich <slyfox@gentoo.org>
      0d2450ab
    • J
      Btrfs: use i_version instead of our own sequence · 0c4d2d95
      Josef Bacik 提交于
      We've been keeping around the inode sequence number in hopes that somebody
      would use it, but nobody uses it and people actually use i_version which
      serves the same purpose, so use i_version where we used the incore inode's
      sequence number and that way the sequence is updated properly across the
      board, and not just in file write.  Thanks,
      Signed-off-by: NJosef Bacik <josef@redhat.com>
      0c4d2d95
  14. 28 4月, 2012 1 次提交
    • J
      Btrfs: do not start delalloc inodes during sync · 996d282c
      Josef Bacik 提交于
      btrfs_start_delalloc_inodes will just walk the list of delalloc inodes and
      start writing them out, but it doesn't splice the list or anything so as
      long as somebody is doing work on the box you could end up in this section
      _forever_.  So just remove it, it's not needed anyway since sync will start
      writeback on all inodes anyway, all we need to do is wait for ordered
      extents and then we can commit the transaction.  In my horrible torture test
      sync goes from taking 4 minutes to about 1.5 minutes.  Thanks,
      Signed-off-by: NJosef Bacik <josef@redhat.com>
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      996d282c
  15. 19 4月, 2012 1 次提交
  16. 27 3月, 2012 1 次提交
  17. 22 3月, 2012 5 次提交
  18. 21 3月, 2012 1 次提交
  19. 17 1月, 2012 1 次提交
  20. 09 1月, 2012 5 次提交