From: Nick Piggin <npiggin@kernel.dk>
To: Boaz Harrosh <bharrosh@panasas.com>
Cc: Nick Piggin <npiggin@kernel.dk>,
linux-fsdevel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Al Viro <viro@ZenIV.linux.org.uk>,
linux-ext4@vger.kernel.org, linux-btrfs@vger.kernel.org,
Jan Kara <jack@suse.cz>, Eric Sandeen <sandeen@redhat.com>,
Theodore Ts'o <tytso@mit.edu>
Subject: Re: [patch] fs: fix deadlocks in writeback_if_idle
Date: Tue, 23 Nov 2010 21:54:32 +1100 [thread overview]
Message-ID: <20101123105432.GA4483@amd> (raw)
In-Reply-To: <4CEB96D7.80105@panasas.com>
On Tue, Nov 23, 2010 at 12:26:31PM +0200, Boaz Harrosh wrote:
> > *
> > * Invoke writeback_inodes_sb if no writeback is currently underway.
> > * Returns 1 if writeback was started, 0 if not.
> > + *
> > + * Even if 1 is returned, writeback may not be started if memory allocation
> > + * fails. This function makes no guarantees about anything.
> > */
> > int writeback_inodes_sb_if_idle(struct super_block *sb)
> > {
> > if (!writeback_in_progress(sb->s_bdi)) {
> > - down_read(&sb->s_umount);
> > - writeback_inodes_sb(sb);
> > - up_read(&sb->s_umount);
> > + bdi_start_writeback(sb->s_bdi, get_nr_dirty_pages());
> > return 1;
> > - } else
> > - return 0;
> > + }
> > + return 0;
> > }
> > EXPORT_SYMBOL(writeback_inodes_sb_if_idle);
> >
> > @@ -1172,17 +1173,18 @@ EXPORT_SYMBOL(writeback_inodes_sb_if_idl
> > *
> > * Invoke writeback_inodes_sb if no writeback is currently underway.
> > * Returns 1 if writeback was started, 0 if not.
> > + *
> > + * Even if 1 is returned, writeback may not be started if memory allocation
> > + * fails. This function makes no guarantees about anything.
> > */
> > int writeback_inodes_sb_nr_if_idle(struct super_block *sb,
> > unsigned long nr)
> > {
> > if (!writeback_in_progress(sb->s_bdi)) {
> > - down_read(&sb->s_umount);
> > - writeback_inodes_sb_nr(sb, nr);
> > - up_read(&sb->s_umount);
> > + bdi_start_writeback(sb->s_bdi, nr);
> > return 1;
> > - } else
> > - return 0;
> > + }
> > + return 0;
> > }
> > EXPORT_SYMBOL(writeback_inodes_sb_nr_if_idle);
> >
>
> static inline int writeback_inodes_sb_if_idle(struct super_block *sb)
> {
> return writeback_inodes_sb_nr_if_idle(sb, get_nr_dirty_pages());
> }
>
> In writeback.h, No?
I didn't care enough to move it :P I don't know if it matters.
> But it has a single user so please just kill it.
>
> Also writeback_inodes_sb_nr_if_idle() has a single user. Combined with above,
> two users. Why not open code it in the two sites. It should be much
> clearer to understand what the magic is all about?
The filesystem shouldn't be aware of the details (the "magic") of how to
kick writeback, so I think the abstraction is right as is.
Thanks,
Nick
next prev parent reply other threads:[~2010-11-23 10:54 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-23 10:02 [patch] fs: fix deadlocks in writeback_if_idle Nick Piggin
2010-11-23 10:11 ` Nick Piggin
2010-11-23 13:18 ` Jan Kara
2010-11-25 3:52 ` Nick Piggin
2010-11-23 10:26 ` Boaz Harrosh
2010-11-23 10:54 ` Nick Piggin [this message]
2010-11-23 12:00 ` Boaz Harrosh
2010-11-23 12:34 ` Chris Mason
2010-11-23 12:52 ` Nick Piggin
2010-11-23 18:58 ` Chris Mason
2010-11-24 1:03 ` Nick Piggin
2010-11-24 13:10 ` Jan Kara
2010-11-25 3:53 ` Nick Piggin
2010-11-29 22:26 ` Andrew Morton
2010-11-30 0:01 ` Nick Piggin
2010-12-16 3:12 ` Nick Piggin
2010-11-24 22:51 ` Andrew Morton
2010-11-25 4:07 ` Nick Piggin
2010-11-24 22:47 ` Andrew Morton
2010-11-25 9:41 ` Boaz Harrosh
2010-11-25 20:30 ` Andrew Morton
2010-11-30 0:50 ` Chris Mason
2010-11-23 12:54 ` Dmitry
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=20101123105432.GA4483@amd \
--to=npiggin@kernel.dk \
--cc=akpm@linux-foundation.org \
--cc=bharrosh@panasas.com \
--cc=jack@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=sandeen@redhat.com \
--cc=tytso@mit.edu \
--cc=viro@ZenIV.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).