mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Neil Brown <neilb@suse.de>
Cc: sander@humilis.net, linux-kernel@vger.kernel.org,
	reiserfs-dev@namesys.com
Subject: Re: Please help me understand ->writepage. Was Re: segfault mdadm --write-behind, 2.6.14-mm2  (was: Re: RAID1 ramdisk patch)
Date: Mon, 21 Nov 2005 19:47:30 -0800	[thread overview]
Message-ID: <20051121194730.3993f4ca.akpm@osdl.org> (raw)
In-Reply-To: <17282.35980.613583.592130@cse.unsw.edu.au>

Neil Brown <neilb@suse.de> wrote:
>
> Uhm, what would you think of testing mapping_cap_writeback_dirty in
>  write_one_page??  If you don't like it, I can take it into write_page.

write_one_page() is a little library function for filesystems to call, and
filesystems implicitly know whether or not they have backing store.  So
probably it's best to do this test in the (unusual) caller.

> > Also, write_page() doesn't need to run set_page_dirty(); ->commit_write()
> > will do that.
>
> Ok.... but I think I'm dropping prepare_write / commit_write.
>

Those functions do some pretty handy things, like creating disk blocks
within the file to back the page.  If someone comes along and ftruncate()s
the bitmap file while you're not looking, what happens?  Generally we use
i_sem for this sort of thing.


If you know that the page is still mapped into the file then yes, you can do

	lock_page()
	kmap_atomic()
	<modify>
	kunmap_atomic()
	flush_dcache_page()
	set_page_dirty()
	unlock_page()
	write_one_page(wait==1)

but that's rather a lot of work.

bitmap_unplug() looks risky - calling filesystem functions (like
lock_page()) from inside an unplug function.  Can this all be called from
the vmscan->writepage path?

It might be simpler and more maintainable to maintain the bitmap in normal
kernel memory, sync it to disk via higher-level entrypoints like
sys_write(), vfs_write(), sys_sync(), do_sync(), etc.

  reply	other threads:[~2005-11-22  3:47 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-05  0:46 RAID1 ramdisk patch Wilco Baan Hofman
2005-09-05  1:27 ` Neil Brown
2005-09-05  7:40   ` Wilco Baan Hofman
2005-11-16 13:36   ` segfault mdadm --write-behind, 2.6.14-mm2 (was: Re: RAID1 ramdisk patch) Sander
2005-11-16 22:20     ` Andrew Morton
2005-11-16 23:08       ` Neil Brown
2005-11-17  7:50         ` Sander
2005-11-17 10:12           ` Sander
2005-11-17 10:15             ` Sander
2005-11-21 23:07               ` Please help me understand ->writepage. Was " Neil Brown
2005-11-21 23:30                 ` Jeff Garzik
2005-11-21 23:51                 ` Andrew Morton
2005-11-22  3:12                   ` Neil Brown
2005-11-22  3:47                     ` Andrew Morton [this message]
2005-11-22 10:34                     ` Sander
2005-11-24  5:41                       ` Please help me understand reiser4_writepage. " Neil Brown
2005-11-22 12:00                     ` Please help me understand ->writepage. " Anton Altaparmakov
2005-11-24  5:29                       ` Neil Brown
2005-11-18 14:18       ` segfault mdadm --write-behind, 2.6.14-mm2 Vladimir V. Saveliev

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=20051121194730.3993f4ca.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=reiserfs-dev@namesys.com \
    --cc=sander@humilis.net \
    /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

all inboxes | Powered by JetHome®