2024-05-14 01:26:39

by Stephen Rothwell

[permalink] [raw]
Subject: linux-next: manual merge of the vfs tree with Linus' tree

Hi all,

Today's linux-next merge of the vfs tree got a conflict in:

block/ioctl.c

between commits:

30f1e7241422 ("block: move discard checks into the ioctl handler")
719c15a75ebf ("blk-lib: check for kill signal in ioctl BLKDISCARD")
0c9f4ac808b0 ("Merge tag 'for-6.10/block-20240511' of git://git.kernel.dk/linux")

from Linus' tree and commit:

695eaf683e8e ("blk_ioctl_{discard,zeroout}(): we only want ->bd_inode->i_mapping here...")

from the vfs 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.

--
Cheers,
Stephen Rothwell

diff --cc block/ioctl.c
index c7db3bd2d653,0513fbe90280..000000000000
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@@ -95,12 -95,8 +95,11 @@@ static int compat_blkpg_ioctl(struct bl
static int blk_ioctl_discard(struct block_device *bdev, blk_mode_t mode,
unsigned long arg)
{
- uint64_t range[2];
- uint64_t start, len, end;
+ unsigned int bs_mask = bdev_logical_block_size(bdev) - 1;
- struct inode *inode = bdev->bd_inode;
+ uint64_t range[2], start, len, end;
+ struct bio *prev = NULL, *bio;
+ sector_t sector, nr_sects;
+ struct blk_plug plug;
int err;

if (!(mode & BLK_OPEN_WRITE))
@@@ -130,34 -124,9 +129,34 @@@
err = truncate_bdev_range(bdev, mode, start, start + len - 1);
if (err)
goto fail;
- err = blkdev_issue_discard(bdev, start >> 9, len >> 9, GFP_KERNEL);
+
+ sector = start >> SECTOR_SHIFT;
+ nr_sects = len >> SECTOR_SHIFT;
+
+ blk_start_plug(&plug);
+ while (1) {
+ if (fatal_signal_pending(current)) {
+ if (prev)
+ bio_await_chain(prev);
+ err = -EINTR;
+ goto out_unplug;
+ }
+ bio = blk_alloc_discard_bio(bdev, &sector, &nr_sects,
+ GFP_KERNEL);
+ if (!bio)
+ break;
+ prev = bio_chain_and_submit(prev, bio);
+ }
+ if (prev) {
+ err = submit_bio_wait(prev);
+ if (err == -EOPNOTSUPP)
+ err = 0;
+ bio_put(prev);
+ }
+out_unplug:
+ blk_finish_plug(&plug);
fail:
- filemap_invalidate_unlock(inode->i_mapping);
+ filemap_invalidate_unlock(bdev->bd_mapping);
return err;
}


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature