1. 21 6月, 2021 35 次提交
    • D
      btrfs: remove extra sb::s_id from message in btrfs_validate_metadata_buffer · ff14aa79
      David Sterba 提交于
      The s_id is already printed by message helpers.
      Reviewed-by: NQu Wenruo <wqu@suse.com>
      Reviewed-by: NAnand Jain <anand.jain@oracle.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      ff14aa79
    • D
      btrfs: reduce compressed_bio members' types · 282ab3ff
      David Sterba 提交于
      Several members of compressed_bio are of type that's unnecessarily big
      for the values that they'd hold:
      
      - the size of the uncompressed and compressed data is 128K now, we can
        keep is as int
      - same for number of pages
      - the compress type fits to a byte
      - the errors is 0/1
      
      The size of the unpatched structure is 80 bytes with several holes.
      Reordering nr_pages next to the pages the hole after pending_bios is
      filled and the resulting size is 56 bytes. This keeps the csums array
      aligned to 8 bytes, which is nice. Further size optimizations may be
      possible but right now it looks good to me:
      
      struct compressed_bio {
              refcount_t                 pending_bios;         /*     0     4 */
              unsigned int               nr_pages;             /*     4     4 */
              struct page * *            compressed_pages;     /*     8     8 */
              struct inode *             inode;                /*    16     8 */
              u64                        start;                /*    24     8 */
              unsigned int               len;                  /*    32     4 */
              unsigned int               compressed_len;       /*    36     4 */
              u8                         compress_type;        /*    40     1 */
              u8                         errors;               /*    41     1 */
      
              /* XXX 2 bytes hole, try to pack */
      
              int                        mirror_num;           /*    44     4 */
              struct bio *               orig_bio;             /*    48     8 */
              u8                         sums[];               /*    56     0 */
      
              /* size: 56, cachelines: 1, members: 12 */
              /* sum members: 54, holes: 1, sum holes: 2 */
              /* last cacheline: 56 bytes */
      };
      Reviewed-by: NAnand Jain <anand.jain@oracle.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      282ab3ff
    • D
    • D
      btrfs: scrub: factor out common scrub_stripe constraints · 7735cd75
      David Sterba 提交于
      There are common values set for the stripe constraints, some of them
      are already factored out. Do that for increment and mirror_num as well.
      Reviewed-by: NQu Wenruo <wqu@suse.com>
      Reviewed-by: NAnand Jain <anand.jain@oracle.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      7735cd75
    • D
      btrfs: clear log tree recovering status if starting transaction fails · 1aeb6b56
      David Sterba 提交于
      When a log recovery is in progress, lots of operations have to take that
      into account, so we keep this status per tree during the operation. Long
      time ago error handling revamp patch 79787eaa ("btrfs: replace many
      BUG_ONs with proper error handling") removed clearing of the status in
      an error branch. Add it back as was intended in e02119d5 ("Btrfs:
      Add a write ahead tree log to optimize synchronous operations").
      
      There are probably no visible effects, log replay is done only during
      mount and if it fails all structures are cleared so the stale status
      won't be kept.
      
      Fixes: 79787eaa ("btrfs: replace many BUG_ONs with proper error handling")
      Reviewed-by: NQu Wenruo <wqu@suse.com>
      Reviewed-by: NAnand Jain <anand.jain@oracle.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      1aeb6b56
    • D
      btrfs: clear defrag status of a root if starting transaction fails · 6819703f
      David Sterba 提交于
      The defrag loop processes leaves in batches and starting transaction for
      each. The whole defragmentation on a given root is protected by a bit
      but in case the transaction fails, the bit is not cleared
      
      In case the transaction fails the bit would prevent starting
      defragmentation again, so make sure it's cleared.
      
      CC: stable@vger.kernel.org # 4.4+
      Reviewed-by: NQu Wenruo <wqu@suse.com>
      Reviewed-by: NAnand Jain <anand.jain@oracle.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      6819703f
    • D
      btrfs: sysfs: fix format string for some discard stats · 8c5ec995
      David Sterba 提交于
      The type of discard_bitmap_bytes and discard_extent_bytes is u64 so the
      format should be %llu, though the actual values would hardly ever
      overflow to negative values.
      Reviewed-by: NQu Wenruo <wqu@suse.com>
      Reviewed-by: NAnand Jain <anand.jain@oracle.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      8c5ec995
    • J
      btrfs: always abort the transaction if we abort a trans handle · 5963ffca
      Josef Bacik 提交于
      While stress testing our error handling I noticed that sometimes we
      would still commit the transaction even though we had aborted the
      transaction.
      
      Currently we track if a trans handle has dirtied any metadata, and if it
      hasn't we mark the filesystem as having an error (so no new transactions
      can be started), but we will allow the current transaction to complete
      as we do not mark the transaction itself as having been aborted.
      
      This sounds good in theory, but we were not properly tracking IO errors
      in btrfs_finish_ordered_io, and thus committing the transaction with
      bogus free space data.  This isn't necessarily a problem per-se with the
      free space cache, as the other guards in place would have kept us from
      accepting the free space cache as valid, but highlights a real world
      case where we had a bug and could have corrupted the filesystem because
      of it.
      
      This "skip abort on empty trans handle" is nice in theory, but assumes
      we have perfect error handling everywhere, which we clearly do not.
      Also we do not allow further transactions to be started, so all this
      does is save the last transaction that was happening, which doesn't
      necessarily gain us anything other than the potential for real
      corruption.
      
      Remove this particular bit of code, if we decide we need to abort the
      transaction then abort the current one and keep us from doing real harm
      to the file system, regardless of whether this specific trans handle
      dirtied anything or not.
      Signed-off-by: NJosef Bacik <josef@toxicpanda.com>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      5963ffca
    • F
      btrfs: don't set the full sync flag when truncation does not touch extents · 0d7d3165
      Filipe Manana 提交于
      At btrfs_truncate() where we truncate the inode either to the same size
      or to a smaller size, we always set the full sync flag on the inode.
      
      This is needed in case the truncation drops or trims any file extent items
      that start beyond or cross the new inode size, so that the next fsync
      drops all inode items from the log and scans again the fs/subvolume tree
      to find all items that must be logged.
      
      However if the truncation does not drop or trims any file extent items, we
      do not need to set the full sync flag and force the next fsync to use the
      slow code path. So do not set the full sync flag in such cases.
      
      One use case where it is frequent to do truncations that do not change
      the inode size and do not drop any extents (no prealloc extents beyond
      i_size) is when running Microsoft's SQL Server inside a Docker container.
      One example workload is the one Philipp Fent reported recently, in the
      thread with a link below. In this workload a large number of fsyncs are
      preceded by such truncate operations.
      
      After this change I constantly get the runtime for that workload from
      Philipp to be reduced by about -12%, for example from 184 seconds down
      to 162 seconds.
      
      Link: https://lore.kernel.org/linux-btrfs/93c4600e-5263-5cba-adf0-6f47526e7561@in.tum.de/Tested-by: NAnand Jain <anand.jain@oracle.com>
      Signed-off-by: NFilipe Manana <fdmanana@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      0d7d3165
    • F
      btrfs: fix misleading and incomplete comment of btrfs_truncate() · 4f7e6737
      Filipe Manana 提交于
      The comment at the top of btrfs_truncate() mentions that csum items are
      dropped or truncated to the new i_size, but this is wrong and non sense,
      as they are unrelated to the i_size and are located in the csums tree and
      not on a tree with inode items (fs/subvolume tree or a log tree). Instead
      that claim applies to file extent items, so fix the comment to refer to
      them instead.
      
      While at it make the whole comment for the function more descriptive and
      follow the kernel doc style.
      Tested-by: NAnand Jain <anand.jain@oracle.com>
      Signed-off-by: NFilipe Manana <fdmanana@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      4f7e6737
    • J
      btrfs: abort transaction if we fail to update the delayed inode · 04587ad9
      Josef Bacik 提交于
      If we fail to update the delayed inode we need to abort the transaction,
      because we could leave an inode with the improper counts or some other
      such corruption behind.
      Signed-off-by: NJosef Bacik <josef@toxicpanda.com>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      04587ad9
    • J
      btrfs: fix error handling in __btrfs_update_delayed_inode · bb385bed
      Josef Bacik 提交于
      If we get an error while looking up the inode item we'll simply bail
      without cleaning up the delayed node.  This results in this style of
      warning happening on commit:
      
        WARNING: CPU: 0 PID: 76403 at fs/btrfs/delayed-inode.c:1365 btrfs_assert_delayed_root_empty+0x5b/0x90
        CPU: 0 PID: 76403 Comm: fsstress Tainted: G        W         5.13.0-rc1+ #373
        Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.13.0-2.fc32 04/01/2014
        RIP: 0010:btrfs_assert_delayed_root_empty+0x5b/0x90
        RSP: 0018:ffffb8bb815a7e50 EFLAGS: 00010286
        RAX: 0000000000000000 RBX: ffff95d6d07e1888 RCX: ffff95d6c0fa3000
        RDX: 0000000000000002 RSI: 000000000029e91c RDI: ffff95d6c0fc8060
        RBP: ffff95d6c0fc8060 R08: 00008d6d701a2c1d R09: 0000000000000000
        R10: ffff95d6d1760ea0 R11: 0000000000000001 R12: ffff95d6c15a4d00
        R13: ffff95d6c0fa3000 R14: 0000000000000000 R15: ffffb8bb815a7e90
        FS:  00007f490e8dbb80(0000) GS:ffff95d73bc00000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: 00007f6e75555cb0 CR3: 00000001101ce001 CR4: 0000000000370ef0
        Call Trace:
         btrfs_commit_transaction+0x43c/0xb00
         ? finish_wait+0x80/0x80
         ? vfs_fsync_range+0x90/0x90
         iterate_supers+0x8c/0x100
         ksys_sync+0x50/0x90
         __do_sys_sync+0xa/0x10
         do_syscall_64+0x3d/0x80
         entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      Because the iref isn't dropped and this leaves an elevated node->count,
      so any release just re-queues it onto the delayed inodes list.  Fix this
      by going to the out label to handle the proper cleanup of the delayed
      node.
      Signed-off-by: NJosef Bacik <josef@toxicpanda.com>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      bb385bed
    • J
      btrfs: make btrfs_release_delayed_iref handle the !iref case · a4cb90dc
      Josef Bacik 提交于
      Right now we only cleanup the delayed iref if we have
      BTRFS_DELAYED_NODE_DEL_IREF set on the node.  However we have some error
      conditions that need to cleanup the iref if it still exists, so to make
      this code cleaner move the test_bit into btrfs_release_delayed_iref
      itself and unconditionally call it in each of the cases instead.
      Signed-off-by: NJosef Bacik <josef@toxicpanda.com>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      a4cb90dc
    • D
      btrfs: scrub: per-device bandwidth control · eb3b5053
      David Sterba 提交于
      Add sysfs interface to limit io during scrub. We relied on the ionice
      interface to do that, eg. the idle class let the system usable while
      scrub was running. This has changed when mq-deadline got widespread and
      did not implement the scheduling classes. That was a CFQ thing that got
      deleted. We've got numerous complaints from users about degraded
      performance.
      
      Currently only BFQ supports that but it's not a common scheduler and we
      can't ask everybody to switch to it.
      
      Alternatively the cgroup io limiting can be used but that also a
      non-trivial setup (v2 required, the controller must be enabled on the
      system). This can still be used if desired.
      
      Other ideas that have been explored: piggy-back on ionice (that is set
      per-process and is accessible) and interpret the class and classdata as
      bandwidth limits, but this does not have enough flexibility as there are
      only 8 allowed and we'd have to map fixed limits to each value. Also
      adjusting the value would need to lookup the process that currently runs
      scrub on the given device, and the value is not sticky so would have to
      be adjusted each time scrub runs.
      
      Running out of options, sysfs does not look that bad:
      
      - it's accessible from scripts, or udev rules
      - the name is similar to what MD-RAID has
        (/proc/sys/dev/raid/speed_limit_max or /sys/block/mdX/md/sync_speed_max)
      - the value is sticky at least for filesystem mount time
      - adjusting the value has immediate effect
      - sysfs is available in constrained environments (eg. system rescue)
      - the limit also applies to device replace
      
      Sysfs:
      
      - raw value is in bytes
      - values written to the file accept suffixes like K, M
      - file is in the per-device directory /sys/fs/btrfs/FSID/devinfo/DEVID/scrub_speed_max
      - 0 means use default priority of IO
      
      The scheduler is a simple deadline one and the accuracy is up to nearest
      128K.
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      eb3b5053
    • J
      btrfs: zoned: factor out zoned device lookup · e7ff9e6b
      Johannes Thumshirn 提交于
      To be able to construct a zone append bio we need to look up the
      btrfs_device. The code doing the chunk map lookup to get the device is
      present in btrfs_submit_compressed_write and submit_extent_page.
      
      Factor out the lookup calls into a helper and use it in the submission
      paths.
      Signed-off-by: NJohannes Thumshirn <johannes.thumshirn@wdc.com>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      e7ff9e6b
    • T
      btrfs: return EAGAIN if defrag is canceled · 50535db8
      Tian Tao 提交于
      When inode defrag is canceled, the error is set to EAGAIN but then
      overwritten by number of defragmented bytes. As this would hide the
      error, rather return EAGAIN. This does not harm 'btrfs fi defrag', it
      will print the error and continue to next file (as it does in for any
      other error).
      Signed-off-by: NTian Tao <tiantao6@hisilicon.com>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      [ update changelog ]
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      50535db8
    • Q
      btrfs: remove io_failure_record::in_validation · 1245835d
      Qu Wenruo 提交于
      The io_failure_record::in_validation was introduced to handle failed bio
      which cross several sectors.  In such case, we still need to verify
      which sectors are corrupted.
      
      But since we've changed the way how we handle corrupted sectors, by only
      submitting repair for each corrupted sector, there is no need for extra
      validation any more.
      
      This patch will cleanup all io_failure_record::in_validation related
      code.
      Signed-off-by: NQu Wenruo <wqu@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      1245835d
    • Q
      btrfs: submit read time repair only for each corrupted sector · 150e4b05
      Qu Wenruo 提交于
      Currently btrfs_submit_read_repair() has some extra check on whether the
      failed bio needs extra validation for repair.  But we can avoid all
      these extra mechanisms if we submit the repair for each sector.
      
      By this, each read repair can be easily handled without the need to
      verify which sector is corrupted.
      
      This will also benefit subpage, as one subpage bvec can contain several
      sectors, making the extra verification more complex.
      
      So this patch will:
      
      - Introduce repair_one_sector()
        The main code submitting repair, which is more or less the same as old
        btrfs_submit_read_repair().
        But this time, it only repairs one sector.
      
      - Make btrfs_submit_read_repair() to handle sectors differently
        There are 3 different cases:
      
        * Good sector
          We need to release the page and extent, set the range uptodate.
      
        * Bad sector and failed to submit repair bio
          We need to release the page and extent, but not set the range
          uptodate.
      
        * Bad sector but repair bio submitted
          The page and extent release will be handled by the submitted repair
          bio. Nothing needs to be done.
      
        Since btrfs_submit_read_repair() will handle the page and extent
        release now, we need to skip to next bvec even we hit some error.
      
      - Change the lifespan of @uptodate in end_bio_extent_readpage()
        Since now btrfs_submit_read_repair() will handle the full bvec
        which contains any corruption, we don't need to bother updating
        @uptodate bit anymore.
        Just let @uptodate to be local variable inside the main loop,
        so that any error from one bvec won't affect later bvec.
      
      - Only export btrfs_repair_one_sector(), unexport
        btrfs_submit_read_repair()
        The only outside caller for read repair is DIO, which already submits
        its repair for just one sector.
        Only export btrfs_repair_one_sector() for DIO.
      
      This patch will focus on the change on the repair path, the extra
      validation code is still kept as is, and will be cleaned up later.
      Signed-off-by: NQu Wenruo <wqu@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      150e4b05
    • Q
      btrfs: make btrfs_verify_data_csum() to return a bitmap · 08508fea
      Qu Wenruo 提交于
      This will provide the basis for later per-sector repair for subpage,
      while still keeping the existing code happy.
      
      As if all csums match, the return value will be 0, same as now.
      Only when csum mismatches, the return value is different.
      
      The new return value will be a bitmap, for 4K sectorsize and 4K page
      size, it will be either 1, instead of the -EIO (which is not used
      directly by the callers, no effective change).
      
      But for 4K sectorsize and 64K page size, aka subpage case, since the
      bvec can contain multiple sectors, knowing which sectors are corrupted
      will allow us to submit repair only for corrupted sectors.
      Signed-off-by: NQu Wenruo <wqu@suse.com>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      08508fea
    • J
      btrfs: rename check_async_write and let it return bool · f4dcfb30
      Johannes Thumshirn 提交于
      The 'check_async_write' function is a helper used in
      'btrfs_submit_metadata_bio' and it checks if asynchronous writing can be
      used for metadata.
      
      Make the function return bool and get rid of the local variable async in
      btrfs_submit_metadata_bio storing the result of check_async_write's
      tests.
      
      As this is touching all function call sites, also rename it to
      should_async_write as this is more in line with the naming we use.
      Signed-off-by: NJohannes Thumshirn <johannes.thumshirn@wdc.com>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      f4dcfb30
    • J
      btrfs: zoned: bail out if we can't read a reliable write pointer · 06e1e7f4
      Johannes Thumshirn 提交于
      If we can't read a reliable write pointer from a sequential zone fail
      creating the block group with an I/O error.
      
      Also if the read write pointer is beyond the end of the respective zone,
      fail the creation of the block group on this zone with an I/O error.
      
      While this could also happen in real world scenarios with misbehaving
      drives, this issue addresses a problem uncovered by fstests' test case
      generic/475.
      
      CC: stable@vger.kernel.org # 5.12+
      Signed-off-by: NJohannes Thumshirn <johannes.thumshirn@wdc.com>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      06e1e7f4
    • N
      btrfs: zoned: print message when zone sanity check type fails · 47cdfb5e
      Naohiro Aota 提交于
      This extends patch 784daf2b ("btrfs: zoned: sanity check zone
      type"), the message was supposed to be there but was lost during merge.
      We want to make the error noticeable so add it.
      
      Fixes: 784daf2b ("btrfs: zoned: sanity check zone type")
      CC: stable@vger.kernel.org # 5.12+
      Signed-off-by: NNaohiro Aota <naohiro.aota@wdc.com>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      47cdfb5e
    • J
      btrfs: handle preemptive delalloc flushing slightly differently · 385f421f
      Josef Bacik 提交于
      If we decide to flush delalloc from the preemptive flusher, we really do
      not want to wait on ordered extents, as it gains us nothing.  However
      there was logic to go ahead and wait on ordered extents if there was
      more ordered bytes than delalloc bytes.  We do not want this behavior,
      so pass through whether this flushing is for preemption, and do not wait
      for ordered extents if that's the case.  Also break out of the shrink
      loop after the first flushing, as we just want to one shot shrink
      delalloc.
      Signed-off-by: NJosef Bacik <josef@toxicpanda.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      385f421f
    • J
      btrfs: only ignore delalloc if delalloc is much smaller than ordered · 3e101569
      Josef Bacik 提交于
      While testing heavy delalloc workloads I noticed that sometimes we'd
      just stop preemptively flushing when we had loads of delalloc available
      to flush.  This is because we skip preemptive flushing if delalloc <=
      ordered.  However if we start with say 4gib of delalloc, and we flush
      2gib of that, we'll stop flushing there, when we still have 2gib of
      delalloc to flush.
      
      Instead adjust the ordered bytes down by half, this way if 2/3 of our
      outstanding delalloc reservations are tied up by ordered extents we
      don't bother preemptive flushing, as we're getting close to the state
      where we need to wait on ordered extents.
      Signed-off-by: NJosef Bacik <josef@toxicpanda.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      3e101569
    • J
      btrfs: don't include the global rsv size in the preemptive used amount · 30acce4e
      Josef Bacik 提交于
      When deciding if we should preemptively flush space, we will add in the
      amount of space used by all block rsvs.  However this also includes the
      global block rsv, which isn't flushable so shouldn't be accounted for in
      this calculation.  If we decide to use ->bytes_may_use in our used
      calculation we need to subtract the global rsv size from this amount so
      it most closely matches the flushable space.
      Reviewed-by: NJohannes Thumshirn <johannes.thumshirn@wdc.com>
      Signed-off-by: NJosef Bacik <josef@toxicpanda.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      30acce4e
    • J
      btrfs: use the global rsv size in the preemptive thresh calculation · 1239e2da
      Josef Bacik 提交于
      We calculate the amount of "free" space available for normal
      reservations by taking the total space and subtracting out the hard used
      space, which is readonly, used, and reserved space.
      
      However we weren't taking into account the global block rsv, which is
      essentially hard used space.  Handle this by subtracting it from the
      available free space, so that our threshold more closely mirrors
      reality.
      
      We need to do the check because it's possible that the global_rsv_size +
      used is > total_bytes, sometimes the global reserve can end up being
      calculated as larger than the available size (think small filesystems
      where we only have the original 8MiB chunk of metadata).  It doesn't
      usually happen, but that can get us into trouble so this is safer.
      Signed-off-by: NJosef Bacik <josef@toxicpanda.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      1239e2da
    • J
      btrfs: take into account global rsv in need_preemptive_reclaim · 610a6ef4
      Josef Bacik 提交于
      Global rsv can't be used for normal allocations, and for very full file
      systems we can decide to try and async flush constantly even though
      there's really not a lot of space to reclaim.  Deal with this by
      including the global block rsv size in the "total used" calculation.
      Reviewed-by: NJohannes Thumshirn <johannes.thumshirn@wdc.com>
      Signed-off-by: NJosef Bacik <josef@toxicpanda.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      610a6ef4
    • J
      btrfs: only clamp the first time we have to start flushing · 0aae4ca9
      Josef Bacik 提交于
      We were clamping the threshold for preemptive reclaim any time we added
      a ticket to wait on, which if we have a lot of threads means we'd
      essentially max out the clamp the first time we start to flush.
      
      Instead of doing this, simply do it every time we have to start
      flushing, this will make us ramp up gradually instead of going to max
      clamping as soon as we start needing to do flushing.
      Signed-off-by: NJosef Bacik <josef@toxicpanda.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      0aae4ca9
    • J
      btrfs: check worker before need_preemptive_reclaim · ed738ba7
      Josef Bacik 提交于
      need_preemptive_reclaim() does some calculations, which aren't heavy,
      but if we're already running preemptive reclaim there's no reason to do
      them at all, so re-order the checks so that we don't do the calculation
      if we're already doing reclaim.
      Reviewed-by: NJohannes Thumshirn <johannes.thumshirn@wdc.com>
      Signed-off-by: NJosef Bacik <josef@toxicpanda.com>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      ed738ba7
    • S
      btrfs: remove stale comment for argument seed of btrfs_find_device · 94358c35
      Su Yue 提交于
      Commit b2598edf ("btrfs: remove unused argument seed from
      btrfs_find_device") removed the argument seed from btrfs_find_device
      but forgot the comment, so remove it.
      Reviewed-by: NAnand Jain <anand.jain@oracle.com>
      Signed-off-by: NSu Yue <l@damenly.su>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      94358c35
    • G
      btrfs: correct try_lock_extent() usage in read_extent_buffer_subpage() · dc56219f
      Goldwyn Rodrigues 提交于
      try_lock_extent() returns 1 on success or 0 for failure and not an error
      code. If try_lock_extent() fails, read_extent_buffer_subpage() returns
      zero indicating subpage extent read success.
      
      Return EAGAIN/EWOULDBLOCK if try_lock_extent() fails in locking the
      extent.
      Reviewed-by: NQu Wenruo <wqu@suse.com>
      Reviewed-by: NJosef Bacik <josef@toxicpanda.com>
      Signed-off-by: NGoldwyn Rodrigues <rgoldwyn@suse.com>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      dc56219f
    • L
      Linux 5.13-rc7 · 13311e74
      Linus Torvalds 提交于
      13311e74
    • L
      Merge tag 'sched_urgent_for_v5.13_rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · cba5e972
      Linus Torvalds 提交于
      Pull scheduler fix from Borislav Petkov:
       "A single fix to restore fairness between control groups with equal
        priority"
      
      * tag 'sched_urgent_for_v5.13_rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        sched/fair: Correctly insert cfs_rq's to list on unthrottle
      cba5e972
    • L
      Merge tag 'irq_urgent_for_v5.13_rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 9df7f15e
      Linus Torvalds 提交于
      Pull irq fix from Borislav Petkov:
       "A single fix for GICv3 to not take an interrupt in an NMI context"
      
      * tag 'irq_urgent_for_v5.13_rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        irqchip/gic-v3: Workaround inconsistent PMR setting on NMI entry
      9df7f15e
    • L
      Merge tag 'x86_urgent_for_v5.13_rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 8363e795
      Linus Torvalds 提交于
      Pull x86 fixes from Borislav Petkov:
       "A first set of urgent fixes to the FPU/XSTATE handling mess^W code.
        (There's a lot more in the pipe):
      
         - Prevent corruption of the XSTATE buffer in signal handling by
           validating what is being copied from userspace first.
      
         - Invalidate other task's preserved FPU registers on XRSTOR failure
           (#PF) because latter can still modify some of them.
      
         - Restore the proper PKRU value in case userspace modified it
      
         - Reset FPU state when signal restoring fails
      
        Other:
      
         - Map EFI boot services data memory as encrypted in a SEV guest so
           that the guest can access it and actually boot properly
      
         - Two SGX correctness fixes: proper resources freeing and a NUMA fix"
      
      * tag 'x86_urgent_for_v5.13_rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/mm: Avoid truncating memblocks for SGX memory
        x86/sgx: Add missing xa_destroy() when virtual EPC is destroyed
        x86/fpu: Reset state for all signal restore failures
        x86/pkru: Write hardware init value to PKRU when xstate is init
        x86/process: Check PF_KTHREAD and not current->mm for kernel threads
        x86/fpu: Invalidate FPU state after a failed XRSTOR from a user buffer
        x86/fpu: Prevent state corruption in __fpu__restore_sig()
        x86/ioremap: Map EFI-reserved memory as encrypted for SEV
      8363e795
  2. 20 6月, 2021 2 次提交
    • L
      Merge tag 'powerpc-5.13-6' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · b84a7c28
      Linus Torvalds 提交于
      Pull powerpc fixes from Michael Ellerman:
       "Fix initrd corruption caused by our recent change to use relative jump
        labels.
      
        Fix a crash using perf record on systems without a hardware PMU
        backend.
      
        Rework our 64-bit signal handling slighty to make it more closely
        match the old behaviour, after the recent change to use unsafe user
        accessors.
      
        Thanks to Anastasia Kovaleva, Athira Rajeev, Christophe Leroy, Daniel
        Axtens, Greg Kurz, and Roman Bolshakov"
      
      * tag 'powerpc-5.13-6' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        powerpc/perf: Fix crash in perf_instruction_pointer() when ppmu is not set
        powerpc: Fix initrd corruption with relative jump labels
        powerpc/signal64: Copy siginfo before changing regs->nip
        powerpc/mem: Add back missing header to fix 'no previous prototype' error
      b84a7c28
    • L
      Merge tag 'perf-tools-fixes-for-v5.13-2021-06-19' of... · 913ec3c2
      Linus Torvalds 提交于
      Merge tag 'perf-tools-fixes-for-v5.13-2021-06-19' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux
      
      Pull perf tools fixes from Arnaldo Carvalho de Melo:
      
       - Fix refcount usage when processing PERF_RECORD_KSYMBOL.
      
       - 'perf stat' metric group fixes.
      
       - Fix 'perf test' non-bash issue with stat bpf counters.
      
       - Update unistd, in.h and socket.h with the kernel sources, silencing
         perf build warnings.
      
      * tag 'perf-tools-fixes-for-v5.13-2021-06-19' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
        tools headers UAPI: Sync linux/in.h copy with the kernel sources
        tools headers UAPI: Sync asm-generic/unistd.h with the kernel original
        perf beauty: Update copy of linux/socket.h with the kernel sources
        perf test: Fix non-bash issue with stat bpf counters
        perf machine: Fix refcount usage when processing PERF_RECORD_KSYMBOL
        perf metricgroup: Return error code from metricgroup__add_metric_sys_event_iter()
        perf metricgroup: Fix find_evsel_group() event selector
      913ec3c2
  3. 19 6月, 2021 3 次提交