ceph-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Jeff Layton <jlayton@kernel.org>
Cc: ceph-devel@vger.kernel.org, linux-cachefs@redhat.com,
	pfmeec@rit.edu, dhowells@redhat.com, idryomov@gmail.com,
	stable@vger.kernel.org, Andrew W Elble <aweits@rit.edu>
Subject: Re: [PATCH] ceph: fix write_begin optimization when write is beyond EOF
Date: Fri, 11 Jun 2021 21:48:19 +0100	[thread overview]
Message-ID: <YMPME0Bey8Tzz37l@casper.infradead.org> (raw)
In-Reply-To: <20210611195904.160416-1-jlayton@kernel.org>

On Fri, Jun 11, 2021 at 03:59:04PM -0400, Jeff Layton wrote:
>  		if ((pos_in_page == 0 && len == PAGE_SIZE) ||
> -		    (pos >= i_size_read(inode)) ||
> +		    (index > (i_size_read(inode) / PAGE_SIZE)) ||

I think that wants to be ((i_size_read(inode) - 1) / PAGE_SIZE)

If your file is 4096 bytes long, that means bytes 0-4095 contain data.
Except that i_size can be 0, so ...

		if ((offset == 0 && len == PAGE_SIZE) || i_size == 0 ||
		    (index > (i_size - 1) / PAGE_SIZE) ||
		    (offset == 0 && pos + len >= i_size))
  			zero_user_segments(page, 0, pos_in_page,
  					   pos_in_page + len, PAGE_SIZE);


  reply	other threads:[~2021-06-11 20:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-11 19:59 [PATCH] ceph: fix write_begin optimization when write is beyond EOF Jeff Layton
2021-06-11 20:48 ` Matthew Wilcox [this message]
2021-06-11 22:20   ` Jeff Layton
2021-06-12  0:11 ` [PATCH v2] " Jeff Layton
2021-06-12 13:36   ` Matthew Wilcox
2021-06-12 18:35     ` [PATCH v3] " Jeff Layton
2021-06-13 11:04       ` Matthew Wilcox
2021-06-13 11:36         ` [PATCH v4] " Jeff Layton
2021-06-13 12:02           ` Jeff Layton
2021-06-13 15:15             ` Matthew Wilcox
2021-06-13 15:25               ` 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=YMPME0Bey8Tzz37l@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=aweits@rit.edu \
    --cc=ceph-devel@vger.kernel.org \
    --cc=dhowells@redhat.com \
    --cc=idryomov@gmail.com \
    --cc=jlayton@kernel.org \
    --cc=linux-cachefs@redhat.com \
    --cc=pfmeec@rit.edu \
    --cc=stable@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).