From: Jan Kara <jack@suse.cz>
To: Asahi Lina <lina@asahilina.net>
Cc: Dan Williams <dan.j.williams@intel.com>,
Matthew Wilcox <willy@infradead.org>, Jan Kara <jack@suse.cz>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>,
Sergio Lopez Pascual <slp@redhat.com>,
linux-fsdevel@vger.kernel.org, nvdimm@lists.linux.dev,
linux-kernel@vger.kernel.org, asahi@lists.linux.dev
Subject: Re: [PATCH] dax: Allow block size > PAGE_SIZE
Date: Mon, 4 Nov 2024 11:57:11 +0100 [thread overview]
Message-ID: <20241104105711.mqk4of6frmsllarn@quack3> (raw)
In-Reply-To: <20241101-dax-page-size-v1-1-eedbd0c6b08f@asahilina.net>
On Fri 01-11-24 21:22:31, Asahi Lina wrote:
> For virtio-dax, the file/FS blocksize is irrelevant. FUSE always uses
> large DAX blocks (2MiB), which will work with all host page sizes. Since
> we are mapping files into the DAX window on the host, the underlying
> block size of the filesystem and its block device (if any) are
> meaningless.
>
> For real devices with DAX, the only requirement should be that the FS
> block size is *at least* as large as PAGE_SIZE, to ensure that at least
> whole pages can be mapped out of the device contiguously.
>
> Fixes warning when using virtio-dax on a 4K guest with a 16K host,
> backed by tmpfs (which sets blksz == PAGE_SIZE on the host).
>
> Signed-off-by: Asahi Lina <lina@asahilina.net>
> ---
> fs/dax.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Well, I don't quite understand how just relaxing the check is enough. I
guess it may work with virtiofs (I don't know enough about virtiofs to
really tell either way) but for ordinary DAX filesystem it would be
seriously wrong if DAX was used with blocksize > pagesize as multiple
mapping entries could be pointing to the same PFN which is going to have
weird results. If virtiofs can actually map 4k subpages out of 16k page on
host (and generally perform 4k granular tracking etc.), it would seem more
appropriate if virtiofs actually exposed the filesystem 4k block size instead
of 16k blocksize? Or am I missing something?
Honza
> diff --git a/fs/dax.c b/fs/dax.c
> index c62acd2812f8d4981aaba82acfeaf972f555362a..406fb75bdbe9d17a6e4bf3d4cb92683e90f05910 100644
> --- a/fs/dax.c
> +++ b/fs/dax.c
> @@ -1032,7 +1032,7 @@ int dax_writeback_mapping_range(struct address_space *mapping,
> int ret = 0;
> unsigned int scanned = 0;
>
> - if (WARN_ON_ONCE(inode->i_blkbits != PAGE_SHIFT))
> + if (WARN_ON_ONCE(inode->i_blkbits < PAGE_SHIFT))
> return -EIO;
>
> if (mapping_empty(mapping) || wbc->sync_mode != WB_SYNC_ALL)
>
> ---
> base-commit: 81983758430957d9a5cb3333fe324fd70cf63e7e
> change-id: 20241101-dax-page-size-83a1073b4e1b
>
> Cheers,
> ~~ Lina
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2024-11-04 10:57 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-01 12:22 [PATCH] dax: Allow block size > PAGE_SIZE Asahi Lina
2024-11-04 10:57 ` Jan Kara [this message]
2024-11-04 15:31 ` Asahi Lina
2024-11-04 22:16 ` Dave Chinner
2024-11-06 10:55 ` Asahi Lina
2024-11-06 12:12 ` Jan Kara
2024-11-06 19:59 ` Dan Williams
2024-11-07 10:01 ` Jan Kara
2024-11-07 16:09 ` Asahi Lina
2024-11-07 21:24 ` Dan Williams
2024-11-07 22:34 ` Asahi Lina
2024-11-08 12:16 ` Jan Kara
2024-11-12 9:49 ` Asahi Lina
2024-11-12 14:34 ` Jan Kara
2024-11-12 19:32 ` Dan Williams
2024-11-07 21:22 ` Dan Williams
2024-11-07 20:52 ` Matthew Wilcox
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=20241104105711.mqk4of6frmsllarn@quack3 \
--to=jack@suse.cz \
--cc=asahi@lists.linux.dev \
--cc=brauner@kernel.org \
--cc=dan.j.williams@intel.com \
--cc=lina@asahilina.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nvdimm@lists.linux.dev \
--cc=slp@redhat.com \
--cc=viro@zeniv.linux.org.uk \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.