linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Al Viro <viro@ZenIV.linux.org.uk>, Sage Weil <sage@newdream.net>
Cc: Linux-Next Mailing List <linux-next@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"Yan, Zheng" <zyan@redhat.com>, Ilya Dryomov <idryomov@gmail.com>,
	David Howells <dhowells@redhat.com>
Subject: linux-next: manual merge of the vfs tree with the ceph tree
Date: Mon, 29 Oct 2018 12:16:39 +1100	[thread overview]
Message-ID: <20181029121639.738ab89c@canb.auug.org.au> (raw)

[-- Attachment #1: Type: text/plain, Size: 4915 bytes --]

Hi Al,

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

  fs/ceph/file.c

between commit:

  fce7a9744bdf ("ceph: refactor ceph_sync_read()")

from the ceph tree and commit:

  00e23707442a ("iov_iter: Use accessor function")

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 fs/ceph/file.c
index f788496fafcc,5dd433aa9b23..000000000000
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@@ -594,103 -658,48 +594,103 @@@ static ssize_t ceph_sync_read(struct ki
  	if (ret < 0)
  		return ret;
  
 -	if (unlikely(iov_iter_is_pipe(to))) {
 +	ret = 0;
 +	while ((len = iov_iter_count(to)) > 0) {
 +		struct ceph_osd_request *req;
 +		struct page **pages;
 +		int num_pages;
  		size_t page_off;
 -		ret = iov_iter_get_pages_alloc(to, &pages, len,
 -					       &page_off);
 -		if (ret <= 0)
 -			return -ENOMEM;
 -		num_pages = DIV_ROUND_UP(ret + page_off, PAGE_SIZE);
 +		u64 i_size;
 +		bool more;
 +
 +		req = ceph_osdc_new_request(osdc, &ci->i_layout,
 +					ci->i_vino, off, &len, 0, 1,
 +					CEPH_OSD_OP_READ, CEPH_OSD_FLAG_READ,
 +					NULL, ci->i_truncate_seq,
 +					ci->i_truncate_size, false);
 +		if (IS_ERR(req)) {
 +			ret = PTR_ERR(req);
 +			break;
 +		}
 +
 +		more = len < iov_iter_count(to);
  
- 		if (unlikely(to->type & ITER_PIPE)) {
 -		ret = striped_read(inode, off, ret, pages, num_pages,
 -				   page_off, checkeof);
 -		if (ret > 0) {
 -			iov_iter_advance(to, ret);
 -			off += ret;
++		if (unlikely(iov_iter_is_pipe(to))) {
 +			ret = iov_iter_get_pages_alloc(to, &pages, len,
 +						       &page_off);
 +			if (ret <= 0) {
 +				ceph_osdc_put_request(req);
 +				ret = -ENOMEM;
 +				break;
 +			}
 +			num_pages = DIV_ROUND_UP(ret + page_off, PAGE_SIZE);
 +			if (ret < len) {
 +				len = ret;
 +				osd_req_op_extent_update(req, 0, len);
 +				more = false;
 +			}
  		} else {
 -			iov_iter_advance(to, 0);
 +			num_pages = calc_pages_for(off, len);
 +			page_off = off & ~PAGE_MASK;
 +			pages = ceph_alloc_page_vector(num_pages, GFP_KERNEL);
 +			if (IS_ERR(pages)) {
 +				ceph_osdc_put_request(req);
 +				ret = PTR_ERR(pages);
 +				break;
 +			}
  		}
 -		ceph_put_page_vector(pages, num_pages, false);
 -	} else {
 -		num_pages = calc_pages_for(off, len);
 -		pages = ceph_alloc_page_vector(num_pages, GFP_KERNEL);
 -		if (IS_ERR(pages))
 -			return PTR_ERR(pages);
 -
 -		ret = striped_read(inode, off, len, pages, num_pages,
 -				   (off & ~PAGE_MASK), checkeof);
 -		if (ret > 0) {
 -			int l, k = 0;
 -			size_t left = ret;
 -
 -			while (left) {
 -				size_t page_off = off & ~PAGE_MASK;
 -				size_t copy = min_t(size_t, left,
 -						    PAGE_SIZE - page_off);
 -				l = copy_page_to_iter(pages[k++], page_off,
 -						      copy, to);
 -				off += l;
 -				left -= l;
 -				if (l < copy)
 +
 +		osd_req_op_extent_osd_data_pages(req, 0, pages, len, page_off,
 +						 false, false);
 +		ret = ceph_osdc_start_request(osdc, req, false);
 +		if (!ret)
 +			ret = ceph_osdc_wait_request(osdc, req);
 +		ceph_osdc_put_request(req);
 +
 +		i_size = i_size_read(inode);
 +		dout("sync_read %llu~%llu got %zd i_size %llu%s\n",
 +		     off, len, ret, i_size, (more ? " MORE" : ""));
 +
 +		if (ret == -ENOENT)
 +			ret = 0;
 +		if (ret >= 0 && ret < len && (off + ret < i_size)) {
 +			int zlen = min(len - ret, i_size - off - ret);
 +			int zoff = page_off + ret;
 +			dout("sync_read zero gap %llu~%llu\n",
 +                             off + ret, off + ret + zlen);
 +			ceph_zero_page_vector_range(zoff, zlen, pages);
 +			ret += zlen;
 +		}
 +
- 		if (unlikely(to->type & ITER_PIPE)) {
++		if (unlikely(iov_iter_is_pipe(to))) {
 +			if (ret > 0) {
 +				iov_iter_advance(to, ret);
 +				off += ret;
 +			} else {
 +				iov_iter_advance(to, 0);
 +			}
 +			ceph_put_page_vector(pages, num_pages, false);
 +		} else {
 +			int idx = 0;
 +			size_t left = ret > 0 ? ret : 0;
 +			while (left > 0) {
 +				size_t len, copied;
 +				page_off = off & ~PAGE_MASK;
 +				len = min_t(size_t, left, PAGE_SIZE - page_off);
 +				copied = copy_page_to_iter(pages[idx++],
 +							   page_off, len, to);
 +				off += copied;
 +				left -= copied;
 +				if (copied < len) {
 +					ret = -EFAULT;
  					break;
 +				}
  			}
 +			ceph_release_page_vector(pages, num_pages);
  		}
 -		ceph_release_page_vector(pages, num_pages);
 +
 +		if (ret <= 0 || off >= i_size || !more)
 +			break;
  	}
  
  	if (off > iocb->ki_pos) {

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

             reply	other threads:[~2018-10-29  1:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-29  1:16 Stephen Rothwell [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-08-29  1:25 linux-next: manual merge of the vfs tree with the ceph tree Stephen Rothwell
2019-08-27  1:06 Stephen Rothwell
2015-06-26  1:17 Stephen Rothwell
2015-06-26  8:21 ` Ilya Dryomov
2015-06-26  8:33   ` 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=20181029121639.738ab89c@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=dhowells@redhat.com \
    --cc=idryomov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=sage@newdream.net \
    --cc=viro@ZenIV.linux.org.uk \
    --cc=zyan@redhat.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;
as well as URLs for NNTP newsgroup(s).