All of lore.kernel.org
 help / color / mirror / Atom feed
* generic_writepages & jbd2 and ext4
@ 2022-11-16 13:50 ` Christoph Hellwig via Ocfs2-devel
  0 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2022-11-16 13:50 UTC (permalink / raw)
  To: Theodore Ts'o, Jan Kara, Aneesh Kumar K.V, Mingming Cao
  Cc: linux-fsdevel, linux-ext4, ocfs2-devel, linux-mm

Hi all,

I've recently started looking into killing off the ->writepage method,
and as an initial subproject kill of external uses of generic_writepages.
One of the two remaining callers s in jbd2 and I'm a bit confused about
it.

jbd2_journal_submit_inode_data_buffers has two comments that explicitly
ask for ->writepages as that doesn't allocate data:

/*
 * write the filemap data using writepage() address_space_operations.
 * We don't do block allocation here even for delalloc. We don't
 * use writepages() because with delayed allocation we may be doing
 * block allocation in writepages().
 */

	/*
         * submit the inode data buffers. We use writepage
	 * instead of writepages. Because writepages can do
	 * block allocation with delalloc. We need to write
	 * only allocated blocks here.
	 */

and these look really stange to me.  ->writepage and ->writepages per
their document VM/VFS semantics don't different on what they allocate,
so this seems to reverse engineer ext4 internal behavior in some
way.  Either way looping over ->writepage just for that is rather
inefficient.  If jbd2 really wants a way to skip delalloc conversion
can we come up with a flag in struct writeback_control for that?

Is there anyone familiar enough with this code who would be willing
to give it a try?

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

* [Ocfs2-devel] generic_writepages & jbd2 and ext4
@ 2022-11-16 13:50 ` Christoph Hellwig via Ocfs2-devel
  0 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig via Ocfs2-devel @ 2022-11-16 13:50 UTC (permalink / raw)
  To: Theodore Ts'o, Jan Kara, Aneesh Kumar K.V, Mingming Cao
  Cc: linux-fsdevel, linux-mm, linux-ext4, ocfs2-devel

Hi all,

I've recently started looking into killing off the ->writepage method,
and as an initial subproject kill of external uses of generic_writepages.
One of the two remaining callers s in jbd2 and I'm a bit confused about
it.

jbd2_journal_submit_inode_data_buffers has two comments that explicitly
ask for ->writepages as that doesn't allocate data:

/*
 * write the filemap data using writepage() address_space_operations.
 * We don't do block allocation here even for delalloc. We don't
 * use writepages() because with delayed allocation we may be doing
 * block allocation in writepages().
 */

	/*
         * submit the inode data buffers. We use writepage
	 * instead of writepages. Because writepages can do
	 * block allocation with delalloc. We need to write
	 * only allocated blocks here.
	 */

and these look really stange to me.  ->writepage and ->writepages per
their document VM/VFS semantics don't different on what they allocate,
so this seems to reverse engineer ext4 internal behavior in some
way.  Either way looping over ->writepage just for that is rather
inefficient.  If jbd2 really wants a way to skip delalloc conversion
can we come up with a flag in struct writeback_control for that?

Is there anyone familiar enough with this code who would be willing
to give it a try?

_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel@oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel

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

* Re: generic_writepages & jbd2 and ext4
  2022-11-16 13:50 ` [Ocfs2-devel] " Christoph Hellwig via Ocfs2-devel
@ 2022-11-16 15:36   ` Jan Kara via Ocfs2-devel
  -1 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2022-11-16 15:36 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Theodore Ts'o, Jan Kara, Aneesh Kumar K.V, Mingming Cao,
	linux-fsdevel, linux-ext4, ocfs2-devel, linux-mm

On Wed 16-11-22 14:50:16, Christoph Hellwig wrote:
> Hi all,
> 
> I've recently started looking into killing off the ->writepage method,
> and as an initial subproject kill of external uses of generic_writepages.
> One of the two remaining callers s in jbd2 and I'm a bit confused about
> it.
> 
> jbd2_journal_submit_inode_data_buffers has two comments that explicitly
> ask for ->writepages as that doesn't allocate data:
> 
> /*
>  * write the filemap data using writepage() address_space_operations.
>  * We don't do block allocation here even for delalloc. We don't
>  * use writepages() because with delayed allocation we may be doing
>  * block allocation in writepages().
>  */
> 
> 	/*
>          * submit the inode data buffers. We use writepage
> 	 * instead of writepages. Because writepages can do
> 	 * block allocation with delalloc. We need to write
> 	 * only allocated blocks here.
> 	 */
> 
> and these look really stange to me.  ->writepage and ->writepages per
> their document VM/VFS semantics don't different on what they allocate,
> so this seems to reverse engineer ext4 internal behavior in some
> way.  Either way looping over ->writepage just for that is rather
> inefficient.  If jbd2 really wants a way to skip delalloc conversion
> can we come up with a flag in struct writeback_control for that?
> 
> Is there anyone familiar enough with this code who would be willing
> to give it a try?

Yes, I've written that code quite a few years ago :) And I agree JBD2 is
abusing internal knowledge about ext4 here. So yes, writeback_control flag
so that we can propagate the information to ->writepages method should do
the trick. I'll have a look into that.

								Honza

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

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

* Re: [Ocfs2-devel] generic_writepages & jbd2 and ext4
@ 2022-11-16 15:36   ` Jan Kara via Ocfs2-devel
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Kara via Ocfs2-devel @ 2022-11-16 15:36 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jan Kara, linux-mm, Mingming Cao, Aneesh Kumar K.V, linux-fsdevel,
	Theodore Ts'o, linux-ext4, ocfs2-devel

On Wed 16-11-22 14:50:16, Christoph Hellwig wrote:
> Hi all,
> 
> I've recently started looking into killing off the ->writepage method,
> and as an initial subproject kill of external uses of generic_writepages.
> One of the two remaining callers s in jbd2 and I'm a bit confused about
> it.
> 
> jbd2_journal_submit_inode_data_buffers has two comments that explicitly
> ask for ->writepages as that doesn't allocate data:
> 
> /*
>  * write the filemap data using writepage() address_space_operations.
>  * We don't do block allocation here even for delalloc. We don't
>  * use writepages() because with delayed allocation we may be doing
>  * block allocation in writepages().
>  */
> 
> 	/*
>          * submit the inode data buffers. We use writepage
> 	 * instead of writepages. Because writepages can do
> 	 * block allocation with delalloc. We need to write
> 	 * only allocated blocks here.
> 	 */
> 
> and these look really stange to me.  ->writepage and ->writepages per
> their document VM/VFS semantics don't different on what they allocate,
> so this seems to reverse engineer ext4 internal behavior in some
> way.  Either way looping over ->writepage just for that is rather
> inefficient.  If jbd2 really wants a way to skip delalloc conversion
> can we come up with a flag in struct writeback_control for that?
> 
> Is there anyone familiar enough with this code who would be willing
> to give it a try?

Yes, I've written that code quite a few years ago :) And I agree JBD2 is
abusing internal knowledge about ext4 here. So yes, writeback_control flag
so that we can propagate the information to ->writepages method should do
the trick. I'll have a look into that.

								Honza

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

_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel@oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel

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

end of thread, other threads:[~2022-11-16 15:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-16 13:50 generic_writepages & jbd2 and ext4 Christoph Hellwig
2022-11-16 13:50 ` [Ocfs2-devel] " Christoph Hellwig via Ocfs2-devel
2022-11-16 15:36 ` Jan Kara
2022-11-16 15:36   ` [Ocfs2-devel] " Jan Kara via Ocfs2-devel

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.