1. 09 9月, 2019 3 次提交
  2. 02 7月, 2019 3 次提交
  3. 01 7月, 2019 3 次提交
  4. 02 5月, 2019 1 次提交
  5. 30 4月, 2019 1 次提交
  6. 25 2月, 2019 3 次提交
    • D
      btrfs: add zstd compression level support · 3f93aef5
      Dennis Zhou 提交于
      Zstd compression requires different amounts of memory for each level of
      compression. The prior patches implemented indirection to allow for each
      compression type to manage their workspaces independently. This patch
      uses this indirection to implement compression level support for zstd.
      
      To manage the additional memory require, each compression level has its
      own queue of workspaces. A global LRU is used to help with reclaim.
      Reclaim is done via a timer which provides a mechanism to decrease
      memory utilization by keeping only workspaces around that are sized
      appropriately. Forward progress is guaranteed by a preallocated max
      workspace hidden from the LRU.
      
      When getting a workspace, it uses a bitmap to identify the levels that
      are populated and scans up. If it finds a workspace that is greater than
      it, it uses it, but does not update the last_used time and the
      corresponding place in the LRU. If we hit memory pressure, we sleep on
      the max level workspace. We continue to rescan in case we can use a
      smaller workspace, but eventually should be able to obtain the max level
      workspace or allocate one again should memory pressure subside.
      
      The memory requirement for decompression is the same as level 1, and
      therefore can use any of available workspace.
      
      The number of workspaces is bound by an upper limit of the workqueue's
      limit which currently is 2 (percpu limit). The reclaim timer is used to
      free inactive/improperly sized workspaces and is set to 307s to avoid
      colliding with transaction commit (every 30s).
      
      Repeating the experiment from v2 [1], the Silesia corpus was copied to a
      btrfs filesystem 10 times and then read back after dropping the caches.
      The btrfs filesystem was on an SSD.
      
      Level   Ratio   Compression (MB/s)  Decompression (MB/s)  Memory (KB)
      1       2.658        438.47                910.51            780
      2       2.744        364.86                886.55           1004
      3       2.801        336.33                828.41           1260
      4       2.858        286.71                886.55           1260
      5       2.916        212.77                556.84           1388
      6       2.363        119.82                990.85           1516
      7       3.000        154.06                849.30           1516
      8       3.011        159.54                875.03           1772
      9       3.025        100.51                940.15           1772
      10      3.033        118.97                616.26           1772
      11      3.036         94.19                802.11           1772
      12      3.037         73.45                931.49           1772
      13      3.041         55.17                835.26           2284
      14      3.087         44.70                716.78           2547
      15      3.126         37.30                878.84           2547
      
      [1] https://lore.kernel.org/linux-btrfs/20181031181108.289340-1-terrelln@fb.com/
      
      Cc: Nick Terrell <terrelln@fb.com>
      Cc: Omar Sandoval <osandov@osandov.com>
      Signed-off-by: NDennis Zhou <dennis@kernel.org>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      3f93aef5
    • D
      btrfs: change set_level() to bound the level passed in · d0ab62ce
      Dennis Zhou 提交于
      Currently, the only user of set_level() is zlib which sets an internal
      workspace parameter. As level is now plumbed into get_workspace(), this
      can be handled there rather than separately.
      
      This repurposes set_level() to bound the level passed in so it can be
      used when setting the mounts compression level and as well as verifying
      the level before getting a workspace. The other benefit is this divides
      the meaning of compress(0) and get_workspace(0). The former means we
      want to use the default compression level of the compression type. The
      latter means we can use any workspace available.
      Signed-off-by: NDennis Zhou <dennis@kernel.org>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      d0ab62ce
    • A
      btrfs: introduce new ioctl to unregister a btrfs device · 228a73ab
      Anand Jain 提交于
      Support for a new command that can be used eg. as a command
      
        $ btrfs device scan --forget [dev]'
      (the final name may change though)
      
      to undo the effects of 'btrfs device scan [dev]'. For this purpose
      this patch proposes to use ioctl #5 as it was empty and is next to the
      SCAN ioctl.
      
      The new ioctl BTRFS_IOC_FORGET_DEV works only on the control device
      (/dev/btrfs-control) to unregister one or all devices, devices that are
      not mounted.
      
      The argument is struct btrfs_ioctl_vol_args, ::name specifies the device
      path. To unregister all device, the path is an empty string.
      
      Again, the devices are removed only if they aren't part of a mounte
      filesystem.
      
      This new ioctl provides:
      
      - release of unwanted btrfs_fs_devices and btrfs_devices structures
        from memory if the device is not going to be mounted
      
      - ability to mount filesystem in degraded mode, when one devices is
        corrupted like in split brain raid1
      
      - running test cases which would require reloading the kernel module
        but this is not possible eg. due to mounted filesystem or built-in
      Signed-off-by: NAnand Jain <anand.jain@oracle.com>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      [ update changelog ]
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      228a73ab
  7. 31 1月, 2019 1 次提交
  8. 22 12月, 2018 3 次提交
    • A
      LSM: hide struct security_mnt_opts from any generic code · 204cc0cc
      Al Viro 提交于
      Keep void * instead, allocate on demand (in parse_str_opts, at the
      moment).  Eventually both selinux and smack will be better off
      with private structures with several strings in those, rather than
      this "counter and two pointers to dynamically allocated arrays"
      ugliness.  This commit allows to do that at leisure, without
      disrupting anything outside of given module.
      
      Changes:
      	* instead of struct security_mnt_opt use an opaque pointer
      initialized to NULL.
      	* security_sb_eat_lsm_opts(), security_sb_parse_opts_str() and
      security_free_mnt_opts() take it as var argument (i.e. as void **);
      call sites are unchanged.
      	* security_sb_set_mnt_opts() and security_sb_remount() take
      it by value (i.e. as void *).
      	* new method: ->sb_free_mnt_opts().  Takes void *, does
      whatever freeing that needs to be done.
      	* ->sb_set_mnt_opts() and ->sb_remount() might get NULL as
      mnt_opts argument, meaning "empty".
      Reviewed-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      204cc0cc
    • A
      btrfs: sanitize security_mnt_opts use · a65001e8
      Al Viro 提交于
      1) keeping a copy in btrfs_fs_info is completely pointless - we never
      use it for anything.  Getting rid of that allows for simpler calling
      conventions for setup_security_options() (caller is responsible for
      freeing mnt_opts in all cases).
      
      2) on remount we want to use ->sb_remount(), not ->sb_set_mnt_opts(),
      same as we would if not for FS_BINARY_MOUNTDATA.  Behaviours *are*
      close (in fact, selinux sb_set_mnt_opts() ought to punt to
      sb_remount() in "already initialized" case), but let's handle
      that uniformly.  And the only reason why the original btrfs changes
      didn't go for security_sb_remount() in btrfs_remount() case is that
      it hadn't been exported.  Let's export it for a while - it'll be
      going away soon anyway.
      Reviewed-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      a65001e8
    • A
      new helper: security_sb_eat_lsm_opts() · f5c0c26d
      Al Viro 提交于
      combination of alloc_secdata(), security_sb_copy_data(),
      security_sb_parse_opt_str() and free_secdata().
      Reviewed-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      f5c0c26d
  9. 17 12月, 2018 2 次提交
  10. 15 11月, 2018 1 次提交
  11. 06 11月, 2018 1 次提交
    • A
      btrfs: avoid link error with CONFIG_NO_AUTO_INLINE · 7e17916b
      Arnd Bergmann 提交于
      Note: this patch fixes a problem in a feature outside of btrfs ("kernel
      hacking: add a config option to disable compiler auto-inlining") and is
      applied ahead of time due to cross-subsystem dependencies.
      
      On 32-bit ARM with gcc-8, I see a link error with the addition of the
      CONFIG_NO_AUTO_INLINE option:
      
      fs/btrfs/super.o: In function `btrfs_statfs':
      super.c:(.text+0x67b8): undefined reference to `__aeabi_uldivmod'
      super.c:(.text+0x67fc): undefined reference to `__aeabi_uldivmod'
      super.c:(.text+0x6858): undefined reference to `__aeabi_uldivmod'
      super.c:(.text+0x6920): undefined reference to `__aeabi_uldivmod'
      super.c:(.text+0x693c): undefined reference to `__aeabi_uldivmod'
      fs/btrfs/super.o:super.c:(.text+0x6958): more undefined references to `__aeabi_uldivmod' follow
      
      So far this is the only file that shows the behavior, so I'd propose
      to just work around it by marking the functions as 'static inline'
      that normally get inlined here.
      
      The reference to __aeabi_uldivmod comes from a div_u64() which has an
      optimization for a constant division that uses a straight '/' operator
      when the result should be known to the compiler. My interpretation is
      that as we turn off inlining, gcc still expects the result to be constant
      but fails to use that constant value.
      
      Link: https://lkml.kernel.org/r/20181103153941.1881966-1-arnd@arndb.deReviewed-by: NNikolay Borisov <nborisov@suse.com>
      Reviewed-by: NChangbin Du <changbin.du@gmail.com>
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      [ add the note ]
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      7e17916b
  12. 15 10月, 2018 1 次提交
    • M
      btrfs: Remove 'objectid' member from struct btrfs_root · 4fd786e6
      Misono Tomohiro 提交于
      There are two members in struct btrfs_root which indicate root's
      objectid: objectid and root_key.objectid.
      
      They are both set to the same value in __setup_root():
      
        static void __setup_root(struct btrfs_root *root,
                                 struct btrfs_fs_info *fs_info,
                                 u64 objectid)
        {
          ...
          root->objectid = objectid;
          ...
          root->root_key.objectid = objecitd;
          ...
        }
      
      and not changed to other value after initialization.
      
      grep in btrfs directory shows both are used in many places:
        $ grep -rI "root->root_key.objectid" | wc -l
        133
        $ grep -rI "root->objectid" | wc -l
        55
       (4.17, inc. some noise)
      
      It is confusing to have two similar variable names and it seems
      that there is no rule about which should be used in a certain case.
      
      Since ->root_key itself is needed for tree reloc tree, let's remove
      'objecitd' member and unify code to use ->root_key.objectid in all places.
      Signed-off-by: NMisono Tomohiro <misono.tomohiro@jp.fujitsu.com>
      Reviewed-by: NQu Wenruo <wqu@suse.com>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      4fd786e6
  13. 06 8月, 2018 15 次提交
  14. 29 5月, 2018 2 次提交