From: xiubli@redhat.com
To: ceph-devel@vger.kernel.org
Cc: idryomov@gmail.com, jlayton@kernel.org, vshankar@redhat.com,
mchangir@redhat.com, frankhsiao@qnap.com,
Xiubo Li <xiubli@redhat.com>
Subject: [PATCH v3 2/2] ceph: set the correct mask for getattr reqeust for read
Date: Tue, 19 Mar 2024 08:29:25 +0800 [thread overview]
Message-ID: <20240319002925.1228063-3-xiubli@redhat.com> (raw)
In-Reply-To: <20240319002925.1228063-1-xiubli@redhat.com>
From: Xiubo Li <xiubli@redhat.com>
In case of hitting the file EOF the ceph_read_iter() needs to
retrieve the file size from MDS, and the Fr caps is not a neccessary.
URL: https://patchwork.kernel.org/project/ceph-devel/list/?series=819323
Reported-by: Frank Hsiao 蕭法宣 <frankhsiao@qnap.com>
Signed-off-by: Xiubo Li <xiubli@redhat.com>
Tested-by: Frank Hsiao 蕭法宣 <frankhsiao@qnap.com>
---
fs/ceph/file.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index c35878427985..a85f95c941fc 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -2191,14 +2191,16 @@ static ssize_t ceph_read_iter(struct kiocb *iocb, struct iov_iter *to)
int statret;
struct page *page = NULL;
loff_t i_size;
+ int mask = CEPH_STAT_CAP_SIZE;
if (retry_op == READ_INLINE) {
page = __page_cache_alloc(GFP_KERNEL);
if (!page)
return -ENOMEM;
}
- statret = __ceph_do_getattr(inode, page,
- CEPH_STAT_CAP_INLINE_DATA, !!page);
+ if (retry_op == READ_INLINE)
+ mask = CEPH_STAT_CAP_INLINE_DATA;
+ statret = __ceph_do_getattr(inode, page, mask, !!page);
if (statret < 0) {
if (page)
__free_page(page);
@@ -2239,7 +2241,7 @@ static ssize_t ceph_read_iter(struct kiocb *iocb, struct iov_iter *to)
/* hit EOF or hole? */
if (retry_op == CHECK_EOF && iocb->ki_pos < i_size &&
ret < len) {
- doutc(cl, "hit hole, ppos %lld < size %lld, reading more\n",
+ doutc(cl, "may hit hole, ppos %lld < size %lld, reading more\n",
iocb->ki_pos, i_size);
read += ret;
--
2.43.0
next prev parent reply other threads:[~2024-03-19 0:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-19 0:29 [PATCH v3 0/2] ceph: skip copying the data extends the file EOF xiubli
2024-03-19 0:29 ` [PATCH v3 1/2] " xiubli
2024-03-19 8:02 ` 回覆: " Frank Hsiao 蕭法宣
2024-03-19 0:29 ` xiubli [this message]
2024-03-19 8:02 ` 回覆: [PATCH v3 2/2] ceph: set the correct mask for getattr reqeust for read Frank Hsiao 蕭法宣
2024-03-19 13:35 ` Ilya Dryomov
2024-03-19 23:53 ` Xiubo Li
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=20240319002925.1228063-3-xiubli@redhat.com \
--to=xiubli@redhat.com \
--cc=ceph-devel@vger.kernel.org \
--cc=frankhsiao@qnap.com \
--cc=idryomov@gmail.com \
--cc=jlayton@kernel.org \
--cc=mchangir@redhat.com \
--cc=vshankar@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).