1. 16 3月, 2018 1 次提交
  2. 01 3月, 2018 1 次提交
    • A
      btrfs: use proper endianness accessors for super_copy · 3c181c12
      Anand Jain 提交于
      The fs_info::super_copy is a byte copy of the on-disk structure and all
      members must use the accessor macros/functions to obtain the right
      value.  This was missing in update_super_roots and in sysfs readers.
      
      Moving between opposite endianness hosts will report bogus numbers in
      sysfs, and mount may fail as the root will not be restored correctly. If
      the filesystem is always used on a same endian host, this will not be a
      problem.
      
      Fix this by using the btrfs_set_super...() functions to set
      fs_info::super_copy values, and for the sysfs, use the cached
      fs_info::nodesize/sectorsize values.
      
      CC: stable@vger.kernel.org
      Fixes: df93589a ("btrfs: export more from FS_INFO to sysfs")
      Signed-off-by: NAnand Jain <anand.jain@oracle.com>
      Reviewed-by: NLiu Bo <bo.li.liu@oracle.com>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      [ update changelog ]
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      3c181c12
  3. 22 1月, 2018 3 次提交
  4. 02 11月, 2017 1 次提交
    • J
      btrfs: don't call btrfs_start_delalloc_roots in flushoncommit · ce8ea7cc
      Josef Bacik 提交于
      We're holding the sb_start_intwrite lock at this point, and doing async
      filemap_flush of the inodes will result in a deadlock if we freeze the
      fs during this operation.  This is because we could do a
      btrfs_join_transaction() in the thread we are waiting on which would
      block at sb_start_intwrite, and thus deadlock.  Using
      writeback_inodes_sb() side steps the problem by not introducing all of
      these extra locking dependencies.
      Signed-off-by: NJosef Bacik <jbacik@fb.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      ce8ea7cc
  5. 30 10月, 2017 2 次提交
  6. 30 6月, 2017 2 次提交
  7. 20 6月, 2017 3 次提交
    • D
      btrfs: move fs_info::fs_frozen to the flags · fac03c8d
      David Sterba 提交于
      We can keep the state among the other fs_info flags, there's no reason
      why fs_frozen would need to be separate.
      Reviewed-by: NNikolay Borisov <nborisov@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      fac03c8d
    • D
      btrfs: use generic slab for for btrfs_transaction · 4b5faeac
      David Sterba 提交于
      Observing the number of slab objects of btrfs_transaction, there's just
      one active on an almost quiescent filesystem, and the number of objects
      goes to about ten when sync is in progress. Then the nubmer goes down to
      1.  This matches the expectations of the transaction lifetime.
      
      For such use the separate slab cache is not justified, as we do not
      reuse objects frequently. For the shortlived transaction, the generic
      slab (size 512) should be ok. We can optimistically expect that the 512
      slabs are not all used (fragmentation) and there are free slots to take
      when we do the allocation, compared to potentially allocating a whole new
      page for the separate slab.
      
      We'll lose the stats about the object use, which could be added later if
      we really need them.
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      4b5faeac
    • J
      Btrfs: replace tree->mapping with tree->private_data · c6100a4b
      Josef Bacik 提交于
      For extent_io tree's we have carried the address_mapping of the inode
      around in the io tree in order to pull the inode back out for calling
      into various tree ops hooks.  This works fine when everything that has
      an extent_io_tree has an inode.  But we are going to remove the
      btree_inode, so we need to change this.  Instead just have a generic
      void * for private data that we can initialize with, and have all the
      tree ops use that instead.  This had a lot of cascading changes but
      should be relatively straightforward.
      Signed-off-by: NJosef Bacik <jbacik@fb.com>
      Reviewed-by: NChandan Rajendra <chandan@linux.vnet.ibm.com>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      [ minor reordering of the callback prototypes ]
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      c6100a4b
  8. 18 4月, 2017 3 次提交
  9. 28 2月, 2017 3 次提交
  10. 17 2月, 2017 3 次提交
  11. 14 2月, 2017 3 次提交
    • J
      btrfs: allow unlink to exceed subvolume quota · 003d7c59
      Jeff Mahoney 提交于
      Once a qgroup limit is exceeded, it's impossible to restore normal
      operation to the subvolume without modifying the limit or removing
      the subvolume.  This is a surprising situation for many users used
      to the typical workflow with quotas on other file systems where it's
      possible to remove files until the used space is back under the limit.
      
      When we go to unlink a file and start the transaction, we'll hit
      the qgroup limit while trying to reserve space for the items we'll
      modify while removing the file.  We discussed last month how best
      to handle this situation and agreed that there is no perfect solution.
      The best principle-of-least-surprise solution is to handle it similarly
      to how we already handle ENOSPC when unlinking, which is to allow
      the operation to succeed with the expectation that it will ultimately
      release space under most circumstances.
      
      This patch modifies the transaction start path to select whether to
      honor the qgroups limits.  btrfs_start_transaction_fallback_global_rsv
      is the only caller that skips enforcement.  The reservation and tracking
      still happens normally -- it just skips the enforcement step.
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      Reviewed-by: NQu Wenruo <quwenruo@cn.fujitsu.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      003d7c59
    • N
      btrfs: Make btrfs_ino take a struct btrfs_inode · 4a0cc7ca
      Nikolay Borisov 提交于
      Currently btrfs_ino takes a struct inode and this causes a lot of
      internal btrfs functions which consume this ino to take a VFS inode,
      rather than btrfs' own struct btrfs_inode. In order to fix this "leak"
      of VFS structs into the internals of btrfs first it's necessary to
      eliminate all uses of struct inode for the purpose of inode. This patch
      does that by using BTRFS_I to convert an inode to btrfs_inode. With
      this problem eliminated subsequent patches will start eliminating the
      passing of struct inode altogether, eventually resulting in a lot cleaner
      code.
      Signed-off-by: NNikolay Borisov <n.borisov.lkml@gmail.com>
      [ fix btrfs_get_extent tracepoint prototype ]
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      4a0cc7ca
    • S
      Btrfs: ACCESS_ONCE cleanup · 20c7bcec
      Seraphime Kirkovski 提交于
      This replaces ACCESS_ONCE macro with the corresponding
      READ|WRITE macros
      Signed-off-by: NSeraphime Kirkovski <kirkseraph@gmail.com>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      20c7bcec
  12. 06 12月, 2016 9 次提交
  13. 28 9月, 2016 1 次提交
  14. 27 9月, 2016 4 次提交
  15. 26 9月, 2016 1 次提交
    • J
      Btrfs: add a flags field to btrfs_fs_info · afcdd129
      Josef Bacik 提交于
      We have a lot of random ints in btrfs_fs_info that can be put into flags.  This
      is mostly equivalent with the exception of how we deal with quota going on or
      off, now instead we set a flag when we are turning it on or off and deal with
      that appropriately, rather than just having a pending state that the current
      quota_enabled gets set to.  Thanks,
      Signed-off-by: NJosef Bacik <jbacik@fb.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      afcdd129