linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Jain, Ayush" <ayush.jain3@amd.com>
To: David Howells <dhowells@redhat.com>, Jens Axboe <axboe@kernel.dk>
Cc: Christoph Hellwig <hch@lst.de>, Al Viro <viro@zeniv.linux.org.uk>,
	David Hildenbrand <david@redhat.com>,
	John Hubbard <jhubbard@nvidia.com>,
	Steve French <stfrench@microsoft.com>,
	linux-mm@kvack.org, linux-block@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] splice: Fix filemap of a blockdev
Date: Wed, 19 Apr 2023 16:47:08 +0530	[thread overview]
Message-ID: <c8952ba3-07cd-90aa-20f2-e24d40599160@amd.com> (raw)
In-Reply-To: <1770755.1681894451@warthog.procyon.org.uk>

Hello David,

This resolves the Fio-test issue that i reported in
Link: https://lore.kernel.org/r/0c6b661c-f7ff-cf12-b7f0-00b6b2f1317b@amd.com/

On 4/19/2023 2:24 PM, David Howells wrote:
> Fix the new filemap_splice_read() function to get i_size from
> in->f_mapping->host, not in->f_inode so that it works with block devices
> too (in->f_inode points to the device file, which is typically zero size).
> 
> Fixes: 07073eb01c5f ("splice: Add a func to do a splice from a buffered file without ITER_PIPE")
> Link: https://lore.kernel.org/r/0c6b661c-f7ff-cf12-b7f0-00b6b2f1317b@amd.com/
> Reported-by: Ayush Jain <ayush.jain3@amd.com>

Tested-by: Ayush Jain <ayush.jain3@amd.com>

> cc: Jens Axboe <axboe@kernel.dk>
> cc: Christoph Hellwig <hch@lst.de>
> cc: Al Viro <viro@zeniv.linux.org.uk>
> cc: David Hildenbrand <david@redhat.com>
> cc: John Hubbard <jhubbard@nvidia.com>
> cc: Steve French <stfrench@microsoft.com>
> cc: linux-mm@kvack.org
> cc: linux-block@vger.kernel.org
> cc: linux-fsdevel@vger.kernel.org
> ---
>   mm/filemap.c |    4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/filemap.c b/mm/filemap.c
> index 470be06b6096..f86cc8acf33a 100644
> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -2902,7 +2902,7 @@ ssize_t filemap_splice_read(struct file *in, loff_t *ppos,
>   	do {
>   		cond_resched();
>   
> -		if (*ppos >= i_size_read(file_inode(in)))
> +		if (*ppos >= i_size_read(in->f_mapping->host))
>   			break;
>   
>   		iocb.ki_pos = *ppos;
> @@ -2918,7 +2918,7 @@ ssize_t filemap_splice_read(struct file *in, loff_t *ppos,
>   		 * part of the page is not copied back to userspace (unless
>   		 * another truncate extends the file - this is desired though).
>   		 */
> -		isize = i_size_read(file_inode(in));
> +		isize = i_size_read(in->f_mapping->host);
>   		if (unlikely(*ppos >= isize))
>   			break;
>   		end_offset = min_t(loff_t, isize, *ppos + len);
> 

Regards,
Ayush Jain


  reply	other threads:[~2023-04-19 11:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-19  8:54 David Howells
2023-04-19 11:17 ` Jain, Ayush [this message]
2023-04-19 12:45 ` Jens Axboe
2023-04-19 12:57 ` David Howells
2023-04-19 13:10   ` Jens Axboe
2023-04-19 13:01 ` David Howells

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=c8952ba3-07cd-90aa-20f2-e24d40599160@amd.com \
    --to=ayush.jain3@amd.com \
    --cc=axboe@kernel.dk \
    --cc=david@redhat.com \
    --cc=dhowells@redhat.com \
    --cc=hch@lst.de \
    --cc=jhubbard@nvidia.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=stfrench@microsoft.com \
    --cc=viro@zeniv.linux.org.uk \
    /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