CEPH filesystem development
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: dhowells@redhat.com, Jeff Layton <jlayton@kernel.org>,
	Andrew W Elble <aweits@rit.edu>,
	ceph-devel@vger.kernel.org, pfmeec@rit.edu,
	linux-cachefs@redhat.com
Subject: Re: [PATCH 5/5] ceph: fold ceph_update_writeable_page into ceph_write_begin
Date: Fri, 11 Jun 2021 22:47:14 +0100	[thread overview]
Message-ID: <97002.1623448034@warthog.procyon.org.uk> (raw)
In-Reply-To: <YMOj1rjCOb4fQo5Y@casper.infradead.org>

Matthew Wilcox <willy@infradead.org> wrote:

> Anyway, looking at netfs_write_begin(), it's wrong too, in a bunch of
> ways.  You don't need to zero out the part of the page you're going to
> copy into.

Zeroing it out isn't 'wrong', per se, just inefficient.  Fixing that needs the
filesystem to deal with it if the copy fails.

> And the condition is overly complicated which makes it
> hard to know what's going on.  Setting aside the is_cache_enabled part,
> I think you want:
> 
> 	if (offset == 0 && len >= thp_size(page))
> 		goto have_page_no_wait;
> 	if (page_offset(page) >= size) {
> 		zero_user_segments(page, 0, offset,
> 				   offset + len, thp_size(page));

There's a third case too: where the write starts at the beginning of the page
and goes to/straddles the EOF - but doesn't continue to the end of the page.

You also didn't set PG_uptodate - presumably deliberately because there's a
hole potentially containing random rubbish in the middle.

> 		goto have_page_no_wait;
> 	}
> 	... read the interesting chunks of page ...

David


  reply	other threads:[~2021-06-11 21:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-16 17:38 [PATCH 0/5] ceph: addr.c cleanups Jeff Layton
2020-09-16 17:38 ` [PATCH 1/5] ceph: break out writeback of incompatible snap context to separate function Jeff Layton
2020-09-16 17:38 ` [PATCH 2/5] ceph: don't call ceph_update_writeable_page from page_mkwrite Jeff Layton
2020-09-16 17:38 ` [PATCH 3/5] ceph: fold ceph_sync_readpages into ceph_readpage Jeff Layton
2020-09-16 17:38 ` [PATCH 4/5] ceph: fold ceph_sync_writepages into writepage_nounlock Jeff Layton
2020-09-16 17:38 ` [PATCH 5/5] ceph: fold ceph_update_writeable_page into ceph_write_begin Jeff Layton
2020-09-16 19:16   ` Jeff Layton
2021-06-11 14:14     ` Andrew W Elble
2021-06-11 14:52       ` Jeff Layton
2021-06-11 15:11         ` David Howells
2021-06-11 15:20           ` Matthew Wilcox
2021-06-11 15:35             ` David Howells
2021-06-11 15:59               ` Andrew W Elble
2021-06-11 17:56               ` Matthew Wilcox
2021-06-11 21:47                 ` David Howells [this message]
2021-06-11 15:38             ` Jeff Layton

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=97002.1623448034@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=aweits@rit.edu \
    --cc=ceph-devel@vger.kernel.org \
    --cc=jlayton@kernel.org \
    --cc=linux-cachefs@redhat.com \
    --cc=pfmeec@rit.edu \
    --cc=willy@infradead.org \
    /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