public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] fs: pass the write life time hint to the mapped filesystem
@ 2017-09-18 15:45 Michael Moy
  2017-09-18 15:49 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Moy @ 2017-09-18 15:45 UTC (permalink / raw)
  To: axboe, hch, linux-nvme, linux-block

The write hint needs to be copied to the mapped filesystem
so it can be passed down to the nvme device driver.

v2: fix tabs in the email

Signed-off-by: Michael Moy <michael.moy@encoresemi.com>
---
   mm/filemap.c | 10 ++++++++++
   1 file changed, 10 insertions(+)

diff --git a/mm/filemap.c b/mm/filemap.c
index 870971e..f9849b8 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -3008,6 +3008,16 @@ ssize_t generic_perform_write(struct file *file,
   			break;
   		}

+		/*
+		 * Copy a write hint to the mapped filesystem.
+		 *
+		 * Use the File hint first, inode next.
+		 */
+		if (file->f_write_hint)
+			mapping->host->i_write_hint = file->f_write_hint;
+		else if (file->f_inode->i_write_hint)
+			mapping->host->i_write_hint = file->f_inode->i_write_hint;
+
   		status = a_ops->write_begin(file, mapping, pos, bytes, flags,
   						&page, &fsdata);
   		if (unlikely(status < 0))
--
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] fs: pass the write life time hint to the mapped filesystem
  2017-09-18 15:45 [PATCH v2] fs: pass the write life time hint to the mapped filesystem Michael Moy
@ 2017-09-18 15:49 ` Christoph Hellwig
  2017-09-18 20:06   ` Michael Moy
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2017-09-18 15:49 UTC (permalink / raw)
  To: Michael Moy; +Cc: axboe, hch, linux-nvme, linux-block

On Mon, Sep 18, 2017 at 09:45:57AM -0600, Michael Moy wrote:
> The write hint needs to be copied to the mapped filesystem
> so it can be passed down to the nvme device driver.
>
> v2: fix tabs in the email

If you want the write hint for buffered I/O you need to set it on the
inode using F_SET_RW_HINT.

With your patch we'd magically move the file hint to the inode hint
on each write.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] fs: pass the write life time hint to the mapped filesystem
  2017-09-18 15:49 ` Christoph Hellwig
@ 2017-09-18 20:06   ` Michael Moy
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Moy @ 2017-09-18 20:06 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: axboe, linux-block, linux-nvme

Thanks, I see that now.

What is the file hint using F_SET_FILE_RW_HINT used for?

It seems that if both are set, the one set first gets used
and, if only the file hint is set, it is not used at all.


On 9/18/2017 9:49 AM, Christoph Hellwig wrote:
> On Mon, Sep 18, 2017 at 09:45:57AM -0600, Michael Moy wrote:
>> The write hint needs to be copied to the mapped filesystem
>> so it can be passed down to the nvme device driver.
>>
>> v2: fix tabs in the email
> If you want the write hint for buffered I/O you need to set it on the
> inode using F_SET_RW_HINT.
>
> With your patch we'd magically move the file hint to the inode hint
> on each write.
>
> _______________________________________________
> Linux-nvme mailing list
> Linux-nvme@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-nvme
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-09-18 20:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-18 15:45 [PATCH v2] fs: pass the write life time hint to the mapped filesystem Michael Moy
2017-09-18 15:49 ` Christoph Hellwig
2017-09-18 20:06   ` Michael Moy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox