Skip to contentSkip to conversation

linux-next: manual merge of the vfs tree with the erofs tree

DISCUSSION Stephen Rothwell 2 participants 4 messages Dec 4, 2022 – Dec 5, 2022 Linux-next tree

lore
Share & tools
lore
#0 lore raw

Hi all,

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

fs/erofs/fscache.c

between commits:

89175ef1262d ("erofs: switch to prepare_ondemand_read() in fscache mode") 89175ef1262d ("erofs: switch to prepare_ondemand_read() in fscache mode")

from the erofs tree and commit:

89175ef1262d ("erofs: switch to prepare_ondemand_read() in fscache mode")

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.

Signature · 95 lines
Cheers,
Stephen Rothwell

diff --cc fs/erofs/fscache.c
index f14886c479bd,4c837be3b6e3..000000000000
--- a/fs/erofs/fscache.c
+++ b/fs/erofs/fscache.c
@@@ -126,28 -159,47 +126,28 @@@ static int erofs_fscache_read_folios_as
  
  	ret = fscache_begin_read_operation(cres, cookie);
  	if (ret)
 -		goto out;
 +		return ret;
  
  	while (done < len) {
 -		subreq = kzalloc(sizeof(struct netfs_io_subrequest),
 -				 GFP_KERNEL);
 -		if (subreq) {
 -			INIT_LIST_HEAD(&subreq->rreq_link);
 -			refcount_set(&subreq->ref, 2);
 -			subreq->rreq = rreq;
 -			refcount_inc(&rreq->ref);
 -		} else {
 -			ret = -ENOMEM;
 -			goto out;
 -		}
 -
 -		subreq->start = pstart + done;
 -		subreq->len	=  len - done;
 -		subreq->flags = 1 << NETFS_SREQ_ONDEMAND;
 +		loff_t sstart = pstart + done;
 +		size_t slen = len - done;
 +		unsigned long flags = 1 << NETFS_SREQ_ONDEMAND;
  
 -		list_add_tail(&subreq->rreq_link, &rreq->subrequests);
 -
 -		source = cres->ops->prepare_read(subreq, LLONG_MAX);
 -		if (WARN_ON(subreq->len == 0))
 +		source = cres->ops->prepare_ondemand_read(cres,
 +				sstart, &slen, LLONG_MAX, &flags, 0);
 +		if (WARN_ON(slen == 0))
  			source = NETFS_INVALID_READ;
  		if (source != NETFS_READ_FROM_CACHE) {
 -			erofs_err(sb, "failed to fscache prepare_read (source %d)",
 -				  source);
 -			ret = -EIO;
 -			subreq->error = ret;
 -			erofs_fscache_put_subrequest(subreq);
 -			goto out;
 +			erofs_err(sb, "failed to fscache prepare_read (source %d)", source);
 +			return -EIO;
  		}
  
 -		atomic_inc(&rreq->nr_outstanding);
 +		refcount_inc(&req->ref);
- 		iov_iter_xarray(&iter, READ, &req->mapping->i_pages,
++		iov_iter_xarray(&iter, ITER_DEST, &req->mapping->i_pages,
 +				lstart + done, slen);
  
 -		iov_iter_xarray(&iter, ITER_DEST, &rreq->mapping->i_pages,
 -				start + done, subreq->len);
 -
 -		ret = fscache_read(cres, subreq->start, &iter,
 -				   NETFS_READ_HOLE_FAIL,
 -				   erofc_fscache_subreq_complete, subreq);
 +		ret = fscache_read(cres, sstart, &iter, NETFS_READ_HOLE_FAIL,
 +				   erofs_fscache_subreq_complete, req);
  		if (ret == -EIOCBQUEUED)
  			ret = 0;
  		if (ret) {
@@@ -233,19 -297,17 +233,19 @@@ static int erofs_fscache_data_read_slic
  		}
  		iov_iter_zero(PAGE_SIZE - size, &iter);
  		erofs_put_metabuf(&buf);
 -		return PAGE_SIZE;
 +		primary->submitted += PAGE_SIZE;
 +		return 0;
  	}
  
 +	count = primary->len - primary->submitted;
  	if (!(map.m_flags & EROFS_MAP_MAPPED)) {
- 		iov_iter_xarray(&iter, READ, &mapping->i_pages, pos, count);
 -		count = len;
+ 		iov_iter_xarray(&iter, ITER_DEST, &mapping->i_pages, pos, count);
  		iov_iter_zero(count, &iter);
 -		return count;
 +		primary->submitted += count;
 +		return 0;
  	}
  
 -	count = min_t(size_t, map.m_llen - (pos - map.m_la), len);
 +	count = min_t(size_t, map.m_llen - (pos - map.m_la), count);
  	DBG_BUGON(!count || count % PAGE_SIZE);
  
  	mdev = (struct erofs_map_dev) {
#1 lore raw

Hi Stephen,

Quoted 8 lines · Stephen Rothwell

Hi all,

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

fs/erofs/fscache.c

between commits:

Quoted 8 lines

89175ef1262d ("erofs: switch to prepare_ondemand_read() in fscache mode") 89175ef1262d ("erofs: switch to prepare_ondemand_read() in fscache mode")

from the erofs tree and commit:

89175ef1262d ("erofs: switch to prepare_ondemand_read() in fscache mode")

from the vfs tree.

Is the commit from the vfs tree correct?

The conflict fix looks good to me (we tend to enable large folios in the next cycle.)

Thanks,
Gao Xiang

Quoted 104 lines

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.

Signature · 2 lines
Cheers,
Stephen Rothwell
fs/erofs/fscache.c +2 -2
diff --cc fs/erofs/fscache.c
index f14886c479bd,4c837be3b6e3..000000000000
@@@ -126,28 -159,47 +126,28 @@@ static int erofs_fscache_read_folios_as
 
  	ret = fscache_begin_read_operation(cres, cookie);
  	if (ret)
 -		goto out;
 +		return ret;
 
  	while (done < len) {
 -		subreq = kzalloc(sizeof(struct netfs_io_subrequest),
 -				 GFP_KERNEL);
 -		if (subreq) {
 -			INIT_LIST_HEAD(&subreq->rreq_link);
 -			refcount_set(&subreq->ref, 2);
 -			subreq->rreq = rreq;
 -			refcount_inc(&rreq->ref);
 -		} else {
 -			ret = -ENOMEM;
 -			goto out;
 -		}
 -
 -		subreq->start = pstart + done;
 -		subreq->len	=  len - done;
 -		subreq->flags = 1 << NETFS_SREQ_ONDEMAND;
 +		loff_t sstart = pstart + done;
 +		size_t slen = len - done;
 +		unsigned long flags = 1 << NETFS_SREQ_ONDEMAND;
 
 -		list_add_tail(&subreq->rreq_link, &rreq->subrequests);
 -
 -		source = cres->ops->prepare_read(subreq, LLONG_MAX);
 -		if (WARN_ON(subreq->len == 0))
 +		source = cres->ops->prepare_ondemand_read(cres,
 +				sstart, &slen, LLONG_MAX, &flags, 0);
 +		if (WARN_ON(slen == 0))
  			source = NETFS_INVALID_READ;
  		if (source != NETFS_READ_FROM_CACHE) {
 -			erofs_err(sb, "failed to fscache prepare_read (source %d)",
 -				  source);
 -			ret = -EIO;
 -			subreq->error = ret;
 -			erofs_fscache_put_subrequest(subreq);
 -			goto out;
 +			erofs_err(sb, "failed to fscache prepare_read (source %d)", source);
 +			return -EIO;
  		}
 
 -		atomic_inc(&rreq->nr_outstanding);
 +		refcount_inc(&req->ref);
- 		iov_iter_xarray(&iter, READ, &req->mapping->i_pages,
++		iov_iter_xarray(&iter, ITER_DEST, &req->mapping->i_pages,
 +				lstart + done, slen);
 
 -		iov_iter_xarray(&iter, ITER_DEST, &rreq->mapping->i_pages,
 -				start + done, subreq->len);
 -
 -		ret = fscache_read(cres, subreq->start, &iter,
 -				   NETFS_READ_HOLE_FAIL,
 -				   erofc_fscache_subreq_complete, subreq);
 +		ret = fscache_read(cres, sstart, &iter, NETFS_READ_HOLE_FAIL,
 +				   erofs_fscache_subreq_complete, req);
  		if (ret == -EIOCBQUEUED)
  			ret = 0;
  		if (ret) {
@@@ -233,19 -297,17 +233,19 @@@ static int erofs_fscache_data_read_slic
  		}
  		iov_iter_zero(PAGE_SIZE - size, &iter);
  		erofs_put_metabuf(&buf);
 -		return PAGE_SIZE;
 +		primary->submitted += PAGE_SIZE;
 +		return 0;
  	}
 
 +	count = primary->len - primary->submitted;
  	if (!(map.m_flags & EROFS_MAP_MAPPED)) {
- 		iov_iter_xarray(&iter, READ, &mapping->i_pages, pos, count);
 -		count = len;
+ 		iov_iter_xarray(&iter, ITER_DEST, &mapping->i_pages, pos, count);
  		iov_iter_zero(count, &iter);
 -		return count;
 +		primary->submitted += count;
 +		return 0;
  	}
 
 -	count = min_t(size_t, map.m_llen - (pos - map.m_la), len);
 +	count = min_t(size_t, map.m_llen - (pos - map.m_la), count);
  	DBG_BUGON(!count || count % PAGE_SIZE);
 
  	mdev = (struct erofs_map_dev) {
#2 lore raw

Hi Gao,

Quoted 15 lines · On Mon, 5 Dec 2022 11:13:50 +0800 Gao Xiang <[email protected]> wrote:
Quoted 13 lines · Stephen Rothwell

Hi all,

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

fs/erofs/fscache.c

between commits:

89175ef1262d ("erofs: switch to prepare_ondemand_read() in fscache mode") 89175ef1262d ("erofs: switch to prepare_ondemand_read() in fscache mode")

from the erofs tree and commit:

Quoted 8 lines
Quoted 3 lines

89175ef1262d ("erofs: switch to prepare_ondemand_read() in fscache mode")

from the vfs tree.

Is the commit from the vfs tree correct?

The conflict fix looks good to me (we tend to enable large folios in the next cycle.)

The commits should be

89175ef1262d ("erofs: switch to prepare_ondemand_read() in fscache mode") a21274e993a6 ("erofs: support large folios for fscache mode")

from the erofs tree and

de4eda9de2d9 ("use less confusing names for iov_iter direction initializers")

from the vfs tree.

Cut and paste weirdness caught me again :-(

Signature · 2 lines
Cheers,
Stephen Rothwell
#3 lore raw
Quoted 32 lines · Stephen Rothwell

Hi Gao,

Quoted 15 lines · On Mon, 5 Dec 2022 11:13:50 +0800 Gao Xiang <[email protected]> wrote:
Quoted 13 lines · Stephen Rothwell

Hi all,

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

fs/erofs/fscache.c

between commits:

89175ef1262d ("erofs: switch to prepare_ondemand_read() in fscache mode") 89175ef1262d ("erofs: switch to prepare_ondemand_read() in fscache mode")

from the erofs tree and commit:

Quoted 8 lines
Quoted 3 lines

89175ef1262d ("erofs: switch to prepare_ondemand_read() in fscache mode")

from the vfs tree.

Is the commit from the vfs tree correct?

The conflict fix looks good to me (we tend to enable large folios in the next cycle.)

The commits should be

89175ef1262d ("erofs: switch to prepare_ondemand_read() in fscache mode") a21274e993a6 ("erofs: support large folios for fscache mode")

Quoted 7 lines

from the erofs tree and

de4eda9de2d9 ("use less confusing names for iov_iter direction initializers")

from the vfs tree.

Cut and paste weirdness caught me again :-(

Thanks for the confirmation!

Thanks,
Gao Xiang

Quoted 4 lines
Signature · 3 lines
-- 
Cheers,
Stephen Rothwell