1. 14 Mar, 2022 4 commits
    • Filipe Manana's avatar
      btrfs: put initial index value of a directory in a constant · 528ee697
      Filipe Manana authored
      At btrfs_set_inode_index_count() we refer twice to the number 2 as the
      initial index value for a directory (when it's empty), with a proper
      comment explaining the reason for that value. In the next patch I'll
      have to use that magic value in the directory logging code, so put
      the value in a #define at btrfs_inode.h, to avoid hardcoding the
      magic value again at tree-log.c.
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      528ee697
    • Filipe Manana's avatar
      btrfs: don't log unnecessary boundary keys when logging directory · a450a4af
      Filipe Manana authored
      Before we start to log dir index keys from a leaf, we check if there is a
      previous index key, which normally is at the end of a leaf that was not
      changed in the current transaction. Then we log that key and set the start
      of logged range (item of type BTRFS_DIR_LOG_INDEX_KEY) to the offset of
      that key. This is to ensure that if there were deleted index keys between
      that key and the first key we are going to log, those deletions are
      replayed in case we need to replay to the log after a power failure.
      However we really don't need to log that previous key, we can just set the
      start of the logged range to that key's offset plus 1. This achieves the
      same and avoids logging one dir index key.
      
      The same logic is performed when we finish logging the index keys of a
      leaf and we find that the next leaf has index keys and was not changed in
      the current transaction. We are logging the first key of that next leaf
      and use its offset as the end of range we log. This is just to ensure that
      if there were deleted index keys between the last index key we logged and
      the first key of that next leaf, those index keys are deleted if we end
      up replaying the log. However that is not necessary, we can avoid logging
      that first index key of the next leaf and instead set the end of the
      logged range to match the offset of that index key minus 1.
      
      So avoid logging those index keys at the boundaries and adjust the start
      and end offsets of the logged ranges as described above.
      
      This patch is part of a patchset comprised of the following patches:
      
        1/4 btrfs: don't log unnecessary boundary keys when logging directory
        2/4 btrfs: put initial index value of a directory in a constant
        3/4 btrfs: stop copying old dir items when logging a directory
        4/4 btrfs: stop trying to log subdirectories created in past transactions
      
      Performance test results are listed in the changelog of patch 3/4.
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      a450a4af
    • Sahil Kang's avatar
      btrfs: reuse existing pointers from btrfs_ioctl · dc408ccd
      Sahil Kang authored
      btrfs_ioctl already contains pointers to the inode and btrfs_root
      structs, so we can pass them into the subfunctions instead of the
      toplevel struct file.
      Signed-off-by: default avatarSahil Kang <sahil.kang@asilaycomputing.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      dc408ccd
    • Filipe Manana's avatar
      btrfs: remove write and wait of struct walk_control · c816d705
      Filipe Manana authored
      The ->write and ->wait fields of struct walk_control, used for log trees,
      are not used since 2008, more specifically since commit d0c803c4
      ("Btrfs: Record dirty pages tree-log pages in an extent_io tree") and
      since commit d0c803c4 ("Btrfs: Record dirty pages tree-log pages in
      an extent_io tree"). So just remove them, along with the function
      btrfs_write_tree_block(), which is also not used anymore after removing
      the ->write member.
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      c816d705
  2. 13 Mar, 2022 2 commits
  3. 12 Mar, 2022 8 commits
  4. 11 Mar, 2022 26 commits