public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: broonie@kernel.org
To: David Sterba <dsterba@suse.cz>
Cc: "David Sterba" <dsterba@suse.com>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"Linux Next Mailing List" <linux-next@vger.kernel.org>,
	"Qu Wenruo" <wqu@suse.com>, "Dāvis Mosāns" <davispuh@gmail.com>
Subject: linux-next: manual merge of the btrfs tree with the btrfs-fixes tree
Date: Thu, 24 Feb 2022 13:44:27 +0000	[thread overview]
Message-ID: <20220224134427.3208381-1-broonie@kernel.org> (raw)

Hi all,

Today's linux-next merge of the btrfs tree got conflicts in:

  fs/btrfs/ctree.h
  fs/btrfs/file.c
  fs/btrfs/inode.c
  fs/btrfs/ioctl.c
  fs/btrfs/lzo.c

between commit:

  2ac3e062af024 ("btrfs: reduce extent threshold for autodefrag")
  741b23a970a79 ("btrfs: prevent copying too big compressed lzo segment")
  26fbac2517fca ("btrfs: autodefrag: only scan one inode once")
  966d879bafaaf ("btrfs: defrag: allow defrag_one_cluster() to skip large extent which is not a target")
  d5633b0dee02d ("btrfs: defrag: bring back the old file extent search behavior")

from the btrfs-fixes tree and commit:

  13b2f7ab699a5 ("btrfs: close the gap between inode_should_defrag() and autodefrag extent size threshold")
  48b433a2ef82a ("btrfs: add lzo workspace buffer length constants")
  db360c49d476f ("btrfs: autodefrag: only scan one inode once")
  e6c69fcbee7ef ("btrfs: defrag: use control structure in btrfs_defrag_file()")
  6b17743d934ec ("btrfs: defrag: bring back the old file extent search behavior")

from the btrfs tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

diff --cc fs/btrfs/ctree.h
index 947f04789389e,5a569bc756c3c..0000000000000
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
diff --cc fs/btrfs/file.c
index 01111ee06e1ef,8815981447034..0000000000000
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
diff --cc fs/btrfs/inode.c
index 76e530f76e3cf,44e8d28182b7f..0000000000000
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
diff --cc fs/btrfs/ioctl.c
index 8d47ec5fc4f44,998bf48e5ce29..0000000000000
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@@ -1435,16 -1460,16 +1461,23 @@@ static int defrag_collect_targets(struc
  			goto add;
  
  		/* Skip too large extent */
- 		if (range_len >= extent_thresh)
+ 		if (range_len >= ctrl->extent_thresh)
+ 			goto next;
+ 
+ 		/*
+ 		 * Skip extents already at its max capacity, this is mostly for
+ 		 * compressed extents, which max cap is only 128K.
+ 		 */
+ 		if (em->len >= get_extent_max_capacity(em))
  			goto next;
  
 +		/*
 +		 * Skip extents already at its max capacity, this is mostly for
 +		 * compressed extents, which max cap is only 128K.
 +		 */
 +		if (em->len >= get_extent_max_capacity(em))
 +			goto next;
 +
  		next_mergeable = defrag_check_next_extent(&inode->vfs_inode, em,
  							  locked);
  		if (!next_mergeable) {
@@@ -1683,19 -1715,11 +1723,20 @@@ static int defrag_one_cluster(struct bt
  			break;
  		}
  
- 		if (max_sectors)
+ 		if (ctrl->max_sectors_to_defrag)
  			range_len = min_t(u32, range_len,
- 				(max_sectors - *sectors_defragged) * sectorsize);
+ 					  (ctrl->max_sectors_to_defrag -
+ 					   ctrl->sectors_defragged) * sectorsize);
  
 +		/*
 +		 * If defrag_one_range() has updated last_scanned_ret,
 +		 * our range may already be invalid (e.g. hole punched).
 +		 * Skip if our range is before last_scanned_ret, as there is
 +		 * no need to defrag the range anymore.
 +		 */
 +		if (entry->start + range_len <= *last_scanned_ret)
 +			continue;
 +
  		if (ra)
  			page_cache_sync_readahead(inode->vfs_inode.i_mapping,
  				ra, NULL, entry->start >> PAGE_SHIFT,
@@@ -1834,13 -1879,11 +1898,10 @@@ int btrfs_defrag_file(struct inode *ino
  			break;
  		}
  		if (do_compress)
- 			BTRFS_I(inode)->defrag_compress = compress_type;
- 		ret = defrag_one_cluster(BTRFS_I(inode), ra, cur,
- 				cluster_end + 1 - cur, extent_thresh,
- 				newer_than, do_compress, &sectors_defragged,
- 				max_to_defrag, &last_scanned);
 -			BTRFS_I(inode)->defrag_compress = ctrl->compress;
+ 		ret = defrag_one_cluster(BTRFS_I(inode), ra, ctrl, cur,
+ 					 cluster_end + 1 - cur);
  
- 		if (sectors_defragged > prev_sectors_defragged)
+ 		if (ctrl->sectors_defragged > prev_sectors_defragged)
  			balance_dirty_pages_ratelimited(inode->i_mapping);
  
  		btrfs_inode_unlock(inode, 0);
diff --cc fs/btrfs/lzo.c
index e6e28a9c79877,430ad36b8b080..0000000000000
--- a/fs/btrfs/lzo.c
+++ b/fs/btrfs/lzo.c


diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 7d3542893a165..5ef7c08b24b89 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1734,7 +1734,7 @@ static int defrag_one_cluster(struct btrfs_inode *inode,
 		 * Skip if our range is before last_scanned_ret, as there is
 		 * no need to defrag the range anymore.
 		 */
-		if (entry->start + range_len <= *last_scanned_ret)
+		if (entry->start + range_len <= ctrl->last_scanned)
 			continue;
 
 		if (ra)
@@ -1760,7 +1760,7 @@ static int defrag_one_cluster(struct btrfs_inode *inode,
 		kfree(entry);
 	}
 	if (ret >= 0)
-		*last_scanned_ret = max(*last_scanned_ret, start + len);
+		ctrl->last_scanned = max(ctrl->last_scanned, start + len);
 	return ret;
 }
 

             reply	other threads:[~2022-02-24 13:46 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-24 13:44 broonie [this message]
2022-02-25 11:59 ` linux-next: manual merge of the btrfs tree with the btrfs-fixes tree David Sterba
  -- strict thread matches above, loose matches on Subject: below --
2026-03-24 13:25 Mark Brown
2026-03-24 13:25 Mark Brown
2026-03-17 13:48 Mark Brown
2026-03-17 13:48 Mark Brown
2026-03-17 13:48 Mark Brown
2025-09-18 11:26 Mark Brown
2024-06-06 22:55 Stephen Rothwell
2024-06-06 23:12 ` Qu Wenruo
2023-10-04 23:09 Stephen Rothwell
2022-10-31 23:28 Stephen Rothwell
2022-09-05 23:50 Stephen Rothwell
2022-09-06  0:15 ` Stephen Rothwell
2022-09-06 19:41   ` David Sterba
2022-03-24 23:48 Stephen Rothwell
2021-01-10 22:29 Stephen Rothwell
2020-05-01  0:28 Stephen Rothwell
2020-05-03 21:40 ` David Sterba
2020-05-01  0:24 Stephen Rothwell
2020-05-01  1:05 ` Stephen Rothwell
2020-05-01  2:06   ` Qu Wenruo
2020-01-08 22:14 Stephen Rothwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220224134427.3208381-1-broonie@kernel.org \
    --to=broonie@kernel.org \
    --cc=davispuh@gmail.com \
    --cc=dsterba@suse.com \
    --cc=dsterba@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=wqu@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox