16 Aug, 2017

2 commits


06 Jul, 2017

1 commit

  • Pull btrfs updates from David Sterba:
    "The core updates improve error handling (mostly related to bios), with
    the usual incremental work on the GFP_NOFS (mis)use removal,
    refactoring or cleanups. Except the two top patches, all have been in
    for-next for an extensive amount of time.

    User visible changes:

    - statx support

    - quota override tunable

    - improved compression thresholds

    - obsoleted mount option alloc_start

    Core updates:

    - bio-related updates:
    - faster bio cloning
    - no allocation failures
    - preallocated flush bios

    - more kvzalloc use, memalloc_nofs protections, GFP_NOFS updates

    - prep work for btree_inode removal

    - dir-item validation

    - qgoup fixes and updates

    - cleanups:
    - removed unused struct members, unused code, refactoring
    - argument refactoring (fs_info/root, caller -> callee sink)
    - SEARCH_TREE ioctl docs"

    * 'for-4.13-part1' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux: (115 commits)
    btrfs: Remove false alert when fiemap range is smaller than on-disk extent
    btrfs: Don't clear SGID when inheriting ACLs
    btrfs: fix integer overflow in calc_reclaim_items_nr
    btrfs: scrub: fix target device intialization while setting up scrub context
    btrfs: qgroup: Fix qgroup reserved space underflow by only freeing reserved ranges
    btrfs: qgroup: Introduce extent changeset for qgroup reserve functions
    btrfs: qgroup: Fix qgroup reserved space underflow caused by buffered write and quotas being enabled
    btrfs: qgroup: Return actually freed bytes for qgroup release or free data
    btrfs: qgroup: Cleanup btrfs_qgroup_prepare_account_extents function
    btrfs: qgroup: Add quick exit for non-fs extents
    Btrfs: rework delayed ref total_bytes_pinned accounting
    Btrfs: return old and new total ref mods when adding delayed refs
    Btrfs: always account pinned bytes when dropping a tree block ref
    Btrfs: update total_bytes_pinned when pinning down extents
    Btrfs: make BUG_ON() in add_pinned_bytes() an ASSERT()
    Btrfs: make add_pinned_bytes() take an s64 num_bytes instead of u64
    btrfs: fix validation of XATTR_ITEM dir items
    btrfs: Verify dir_item in iterate_object_props
    btrfs: Check name_len before in btrfs_del_root_ref
    btrfs: Check name_len before reading btrfs_get_name
    ...

    Linus Torvalds
     

20 Jun, 2017

2 commits

  • Nothing checks its return value.

    Is it safe to skip checking return value of btrfs_wait_tree_block_writeback?

    Liu Bo: I think yes, it's used in walk_log_tree which is called in two
    places, free_log_tree and log replay. For free_log_tree, it waits for
    any running writeback of the extent buffer under freeing to finish in
    case we need to access the eb pointer from page->private, and it's OK to
    not check the return value, while for log replay, it's doesn't wait
    because wc->wait is not set. So neither cares about the writeback error.

    Signed-off-by: Jeff Layton
    Reviewed-by: Jan Kara
    Reviewed-by: Liu Bo
    [ added more explanation to changelog, from Liu Bo ]
    Signed-off-by: David Sterba

    Jeff Layton
     
  • 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: Josef Bacik
    Reviewed-by: Chandan Rajendra
    Reviewed-by: David Sterba
    [ minor reordering of the callback prototypes ]
    Signed-off-by: David Sterba

    Josef Bacik
     

09 Jun, 2017

1 commit

  • Replace bi_error with a new bi_status to allow for a clear conversion.
    Note that device mapper overloaded bi_error with a private value, which
    we'll have to keep arround at least for now and thus propagate to a
    proper blk_status_t value.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     

18 Apr, 2017

1 commit

  • refcount_t type and corresponding API should be
    used instead of atomic_t when the variable is used as
    a reference counter. This allows to avoid accidental
    refcounter overflows that might lead to use-after-free
    situations.

    Signed-off-by: Elena Reshetova
    Signed-off-by: Hans Liljestrand
    Signed-off-by: Kees Cook
    Signed-off-by: David Windsor
    Signed-off-by: David Sterba

    Elena Reshetova
     

28 Feb, 2017

1 commit


17 Feb, 2017

2 commits


06 Dec, 2016

3 commits


30 Nov, 2016

2 commits


26 Sep, 2016

1 commit

  • While processing delayed refs, we may update block group's statistics
    and attach it to cur_trans->dirty_bgs, and later writing dirty block
    groups will process the list, which happens during
    btrfs_commit_transaction().

    For whatever reason, the transaction is aborted and dirty_bgs
    is not processed in cleanup_transaction(), we end up with memory leak
    of these dirty block group cache.

    Since btrfs_start_dirty_block_groups() doesn't make it go to the commit
    critical section, this also adds the cleanup work inside it.

    Signed-off-by: Liu Bo
    Signed-off-by: David Sterba

    Liu Bo
     

27 Aug, 2016

1 commit

  • Pull btrfs fixes from Chris Mason:
    "We've queued up a few different fixes in here. These range from
    enospc corners to fsync and quota fixes, and a few targeted at error
    handling for corrupt metadata/fuzzing"

    * 'for-linus-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
    Btrfs: fix lockdep warning on deadlock against an inode's log mutex
    Btrfs: detect corruption when non-root leaf has zero item
    Btrfs: check btree node's nritems
    btrfs: don't create or leak aliased root while cleaning up orphans
    Btrfs: fix em leak in find_first_block_group
    btrfs: do not background blkdev_put()
    Btrfs: clarify do_chunk_alloc()'s return value
    btrfs: fix fsfreeze hang caused by delayed iputs deal
    btrfs: update btrfs_space_info's bytes_may_use timely
    btrfs: divide btrfs_update_reserved_bytes() into two functions
    btrfs: use correct offset for reloc_inode in prealloc_file_extent_cluster()
    btrfs: qgroup: Fix qgroup incorrectness caused by log replay
    btrfs: relocation: Fix leaking qgroups numbers on data extents
    btrfs: qgroup: Refactor btrfs_qgroup_insert_dirty_extent()
    btrfs: waiting on qgroup rescan should not always be interruptible
    btrfs: properly track when rescan worker is running
    btrfs: flush_space: treat return value of do_chunk_alloc properly
    Btrfs: add ASSERT for block group's memory leak
    btrfs: backref: Fix soft lockup in __merge_refs function
    Btrfs: fix memory leak of reloc_root

    Linus Torvalds
     

25 Aug, 2016

1 commit

  • commit 909c3a22da3 (Btrfs: fix loading of orphan roots leading to BUG_ON)
    avoids the BUG_ON but can add an aliased root to the dead_roots list or
    leak the root.

    Since we've already been loading roots into the radix tree, we should
    use it before looking the root up on disk.

    Cc: # 4.5
    Signed-off-by: Jeff Mahoney
    Reviewed-by: David Sterba
    Signed-off-by: David Sterba
    Signed-off-by: Chris Mason

    Jeff Mahoney
     

05 Aug, 2016

1 commit

  • Pull more btrfs updates from Chris Mason:
    "This is part two of my btrfs pull, which is some cleanups and a batch
    of fixes.

    Most of the code here is from Jeff Mahoney, making the pointers we
    pass around internally more consistent and less confusing overall. I
    noticed a small problem right before I sent this out yesterday, so I
    fixed it up and re-tested overnight"

    * 'for-linus-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs: (40 commits)
    Btrfs: fix __MAX_CSUM_ITEMS
    btrfs: btrfs_abort_transaction, drop root parameter
    btrfs: add btrfs_trans_handle->fs_info pointer
    btrfs: btrfs_relocate_chunk pass extent_root to btrfs_end_transaction
    btrfs: convert nodesize macros to static inlines
    btrfs: introduce BTRFS_MAX_ITEM_SIZE
    btrfs: cleanup, remove prototype for btrfs_find_root_ref
    btrfs: copy_to_sk drop unused root parameter
    btrfs: simpilify btrfs_subvol_inherit_props
    btrfs: tests, use BTRFS_FS_STATE_DUMMY_FS_INFO instead of dummy root
    btrfs: tests, require fs_info for root
    btrfs: tests, move initialization into tests/
    btrfs: btrfs_test_opt and friends should take a btrfs_fs_info
    btrfs: prefix fsid to all trace events
    btrfs: plumb fs_info into btrfs_work
    btrfs: remove obsolete part of comment in statfs
    btrfs: hide test-only member under ifdef
    btrfs: Ratelimit "no csum found" info message
    btrfs: Add ratelimit to btrfs printing
    Btrfs: fix unexpected balance crash due to BUG_ON
    ...

    Linus Torvalds
     

27 Jul, 2016

1 commit

  • Pull core block updates from Jens Axboe:

    - the big change is the cleanup from Mike Christie, cleaning up our
    uses of command types and modified flags. This is what will throw
    some merge conflicts

    - regression fix for the above for btrfs, from Vincent

    - following up to the above, better packing of struct request from
    Christoph

    - a 2038 fix for blktrace from Arnd

    - a few trivial/spelling fixes from Bart Van Assche

    - a front merge check fix from Damien, which could cause issues on
    SMR drives

    - Atari partition fix from Gabriel

    - convert cfq to highres timers, since jiffies isn't granular enough
    for some devices these days. From Jan and Jeff

    - CFQ priority boost fix idle classes, from me

    - cleanup series from Ming, improving our bio/bvec iteration

    - a direct issue fix for blk-mq from Omar

    - fix for plug merging not involving the IO scheduler, like we do for
    other types of merges. From Tahsin

    - expose DAX type internally and through sysfs. From Toshi and Yigal

    * 'for-4.8/core' of git://git.kernel.dk/linux-block: (76 commits)
    block: Fix front merge check
    block: do not merge requests without consulting with io scheduler
    block: Fix spelling in a source code comment
    block: expose QUEUE_FLAG_DAX in sysfs
    block: add QUEUE_FLAG_DAX for devices to advertise their DAX support
    Btrfs: fix comparison in __btrfs_map_block()
    block: atari: Return early for unsupported sector size
    Doc: block: Fix a typo in queue-sysfs.txt
    cfq-iosched: Charge at least 1 jiffie instead of 1 ns
    cfq-iosched: Fix regression in bonnie++ rewrite performance
    cfq-iosched: Convert slice_resid from u64 to s64
    block: Convert fifo_time from ulong to u64
    blktrace: avoid using timespec
    block/blk-cgroup.c: Declare local symbols static
    block/bio-integrity.c: Add #include "blk.h"
    block/partition-generic.c: Remove a set-but-not-used variable
    block: bio: kill BIO_MAX_SIZE
    cfq-iosched: temporarily boost queue priority for idle classes
    block: drbd: avoid to use BIO_MAX_SIZE
    block: bio: remove BIO_MAX_SECTORS
    ...

    Linus Torvalds
     

26 Jul, 2016

1 commit


08 Jun, 2016

1 commit

  • The bio REQ_OP and bi_rw rq_flag_bits are now always setup, so there is
    no need to pass around the rq_flag_bits bits too. btrfs users should
    should access the bio insead.

    Signed-off-by: Mike Christie
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Jens Axboe

    Mike Christie
     

03 Jun, 2016

1 commit

  • self-tests code assumes 4k as the sectorsize and nodesize. This commit
    fix hardcoded 4K. Enables the self-tests code to be executed on non-4k
    page sized systems (e.g. ppc64).

    Reviewed-by: Josef Bacik
    Signed-off-by: Feifei Xu
    Signed-off-by: Chandan Rajendra
    Signed-off-by: David Sterba

    Feifei Xu
     

11 Jan, 2016

1 commit


07 Jan, 2016

1 commit

  • We use many constants to represent size and offset value. And to make
    code readable we use '256 * 1024 * 1024' instead of '268435456' to
    represent '256MB'. However we can make far more readable with 'SZ_256MB'
    which is defined in the 'linux/sizes.h'.

    So this patch replaces 'xxx * 1024 * 1024' kind of expression with
    single 'SZ_xxxMB' if 'xxx' is a power of 2 then 'xxx * SZ_1M' if 'xxx' is
    not a power of 2. And I haven't touched to '4096' & '8192' because it's
    more intuitive than 'SZ_4KB' & 'SZ_8KB'.

    Signed-off-by: Byongho Lee
    Signed-off-by: David Sterba

    Byongho Lee
     

07 Dec, 2015

1 commit


01 Oct, 2015

1 commit


01 Sep, 2015

1 commit

  • num_tolerated_disk_barrier_failures in btrfs_balance

    Code for updating fs_info->num_tolerated_disk_barrier_failures in
    btrfs_balance() lacks raid56 support.

    Reason:
    Above code was wroten in 2012-08-01, together with
    btrfs_calc_num_tolerated_disk_barrier_failures()'s first version.

    Then, btrfs_calc_num_tolerated_disk_barrier_failures() got updated
    later to support raid56, but code in btrfs_balance() was not
    updated together.

    Fix:
    Merge above similar code to a common function:
    btrfs_get_num_tolerated_disk_barrier_failures()
    and make it support both case.

    It can fix this bug with a bonus of cleanup, and make these code
    never in above no-sync state from now on.

    Suggested-by: Anand Jain
    Signed-off-by: Zhao Lei
    Signed-off-by: Chris Mason

    Zhao Lei
     

17 Feb, 2015

1 commit

  • This is the 3rd independent patch of a larger project to cleanup btrfs's
    internal usage of btrfs_root. Many functions take btrfs_root only to
    grab the fs_info struct.

    By requiring a root these functions cause programmer overhead. That
    these functions can accept any valid root is not obvious until
    inspection.

    This patch reduces the specificity of such functions to accept the
    fs_info directly.

    These patches can be applied independently and thus are not being
    submitted as a patch series. There should be about 26 patches by the
    project's completion. Each patch will cleanup between 1 and 34 functions
    apiece. Each patch covers a single file's functions.

    This patch affects the following function(s):
    1) csum_tree_block
    2) csum_dirty_buffer
    3) check_tree_block_fsid
    4) btrfs_find_tree_block
    5) clean_tree_block

    Signed-off-by: Daniel Dressler
    Signed-off-by: David Sterba

    Daniel Dressler
     

13 Dec, 2014

3 commits


05 Oct, 2014

1 commit


02 Oct, 2014

6 commits


18 Sep, 2014

1 commit

  • This patch implement data repair function when direct read fails.

    The detail of the implementation is:
    - When we find the data is not right, we try to read the data from the other
    mirror.
    - When the io on the mirror ends, we will insert the endio work into the
    dedicated btrfs workqueue, not common read endio workqueue, because the
    original endio work is still blocked in the btrfs endio workqueue, if we
    insert the endio work of the io on the mirror into that workqueue, deadlock
    would happen.
    - After we get right data, we write it back to the corrupted mirror.
    - And if the data on the new mirror is still corrupted, we will try next
    mirror until we read right data or all the mirrors are traversed.
    - After the above work, we set the uptodate flag according to the result.

    Signed-off-by: Miao Xie
    Signed-off-by: Chris Mason

    Miao Xie