linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* generic_quota_read
       [not found]   ` <YpBlF2xbfL2yY98n@infradead.org>
@ 2022-06-03 14:40     ` Matthew Wilcox
  2022-06-06  7:37       ` generic_quota_read Jan Kara
  0 siblings, 1 reply; 2+ messages in thread
From: Matthew Wilcox @ 2022-06-03 14:40 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: jfs-discussion, linux-fsdevel, Darrick J . Wong, linux-ext4, Jan Kara

On Thu, May 26, 2022 at 10:43:51PM -0700, Christoph Hellwig wrote:
> >  static ssize_t jfs_quota_read(struct super_block *sb, int type, char *data,
> > +			      size_t len, loff_t pos)
>
> And this whole helper is generic now.  It might be worth to move it
> into fs/quota/dquot.c as generic_quota_read.

I've been working on that this week.  Unfortunately, you have to convert
both quota_read and quota_write at the same time, it turns out.  At
least ext4_quota_write() uses the bdev's inode's page cache to back
the buffer_heads, so quota_read() and quota_write() are incoherent
with each other:

00017 gqr: mapping:00000000ee19acfb index:0x1 pos:0x1470 len:0x30
00017 4qw: mapping:000000007f9a811e index:0x18405 pos:0x1440 len:0x30

I don't know if there's a way around this.  Can't really use
read_mapping_folio() on the bdev's inode in generic_quota_read() -- the
blocks for a given page might be fragmented on disk.  I don't know
if there's a way to tell ext4_bread() to use the inode's page cache
instead of the bdev's.  And if we did that, would it even work as
being part of a transaction?


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

* Re: generic_quota_read
  2022-06-03 14:40     ` generic_quota_read Matthew Wilcox
@ 2022-06-06  7:37       ` Jan Kara
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2022-06-06  7:37 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: Christoph Hellwig, jfs-discussion, linux-fsdevel,
	Darrick J . Wong, linux-ext4, Jan Kara

On Fri 03-06-22 15:40:13, Matthew Wilcox wrote:
> On Thu, May 26, 2022 at 10:43:51PM -0700, Christoph Hellwig wrote:
> > >  static ssize_t jfs_quota_read(struct super_block *sb, int type, char *data,
> > > +			      size_t len, loff_t pos)
> >
> > And this whole helper is generic now.  It might be worth to move it
> > into fs/quota/dquot.c as generic_quota_read.
> 
> I've been working on that this week.  Unfortunately, you have to convert
> both quota_read and quota_write at the same time, it turns out.  At
> least ext4_quota_write() uses the bdev's inode's page cache to back
> the buffer_heads, so quota_read() and quota_write() are incoherent
> with each other:
> 
> 00017 gqr: mapping:00000000ee19acfb index:0x1 pos:0x1470 len:0x30
> 00017 4qw: mapping:000000007f9a811e index:0x18405 pos:0x1440 len:0x30

Yes, reads and writes have to use the same cache. Otherwise bad things
happen...

> I don't know if there's a way around this.  Can't really use
> read_mapping_folio() on the bdev's inode in generic_quota_read() -- the
> blocks for a given page might be fragmented on disk.  I don't know
> if there's a way to tell ext4_bread() to use the inode's page cache
> instead of the bdev's.

There's no way for ext4_bread() to read from inode's page cache. And that
is deliberate - ext4_bread() is used for filesystem metadata (and quota is
treated as filesystem metadata) and we use bdev page cache for all the
metadata.

> And if we did that, would it even work as being part of a transaction?

In principle it could work because we would then treat quota as journalled
data and jbd2 supports that. But honestly, special-casing quota as
journalled data IMHO brings more hassle on the write side than it can save
by sharing some code on the read side.

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

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

end of thread, other threads:[~2022-06-06  7:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20220526192910.357055-1-willy@infradead.org>
     [not found] ` <20220526192910.357055-8-willy@infradead.org>
     [not found]   ` <YpBlF2xbfL2yY98n@infradead.org>
2022-06-03 14:40     ` generic_quota_read Matthew Wilcox
2022-06-06  7:37       ` generic_quota_read Jan Kara

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).