From: Andrew Morton <akpm@osdl.org>
To: cmm@us.ibm.com
Cc: Theodore Tso <tytso@mit.edu>,
linux-fsdevel@vger.kernel.org, ext2-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: Re: [Ext2-devel] [PATCH 1/9] extents for ext4
Date: Fri, 11 Aug 2006 16:16:55 -0700 [thread overview]
Message-ID: <20060811161655.0ad11259.akpm@osdl.org> (raw)
In-Reply-To: <1155334389.3765.18.camel@dyn9047017069.beaverton.ibm.com>
On Fri, 11 Aug 2006 15:13:09 -0700
Mingming Cao <cmm@us.ibm.com> wrote:
> On Thu, 2006-08-10 at 11:00 -0700, Andrew Morton wrote:
> > On Thu, 10 Aug 2006 13:17:55 -0400
> > Theodore Tso <tytso@mit.edu> wrote:
> >
> > > On Wed, Aug 09, 2006 at 11:39:40PM -0700, Andrew Morton wrote:
> > > > - replace all brelse() calls with put_bh(). Because brelse() is
> > > > old-fashioned, has a weird name and neelessly permits a NULL arg.
> > > >
> > > > In fact it would be beter to convert JBD and ext3 to put_bh before
> > > > copying it all over.
> > >
> > > Wouldn't it be better to preserve in the source code history the
> > > brelse->put_bh conversion? We can pour a huge number of changes in
> > > ext4 before we submit, but I would have thought it would be easier for
> > > everyone to see what is going on if we submit with just the minimal
> > > changes, and then have patches that address concerns like this one at
> > > a time.
> > >
> >
> > I'd suggest that this be one of the cleanups which be done within ext3
> > before taking the ext4 copy.
>
>
> Looked at this today -- currently brelse() and __brelse() will check the
> b_count before calling put_bh(). I think it's okay to replace put_bh()
> without checking the b_count, as we always call put_bh() with get_bh
> ()....but want to confirm with you.
>
I haven't seen that warning come out in a couple of years.
I guess that during development it would be useful to trap underflows in
put_bh().
Like this?
fs/buffer.c | 8 ++++++++
include/linux/buffer_head.h | 6 +-----
2 files changed, 9 insertions(+), 5 deletions(-)
diff -puN include/linux/buffer_head.h~put_bh-debug include/linux/buffer_head.h
--- a/include/linux/buffer_head.h~put_bh-debug
+++ a/include/linux/buffer_head.h
@@ -232,11 +232,7 @@ static inline void get_bh(struct buffer_
atomic_inc(&bh->b_count);
}
-static inline void put_bh(struct buffer_head *bh)
-{
- smp_mb__before_atomic_dec();
- atomic_dec(&bh->b_count);
-}
+void put_bh(struct buffer_head *bh);
static inline void brelse(struct buffer_head *bh)
{
diff -puN fs/buffer.c~put_bh-debug fs/buffer.c
--- a/fs/buffer.c~put_bh-debug
+++ a/fs/buffer.c
@@ -47,6 +47,14 @@ static void invalidate_bh_lrus(void);
#define BH_ENTRY(list) list_entry((list), struct buffer_head, b_assoc_buffers)
+void put_bh(struct buffer_head *bh)
+{
+ WARN_ON(atomic_read(&bh->b_count <= 0);
+ smp_mb__before_atomic_dec();
+ atomic_dec(&bh->b_count);
+}
+EXPORT_SYMBOL(put_bh);
+
inline void
init_buffer(struct buffer_head *bh, bh_end_io_t *handler, void *private)
{
_
next prev parent reply other threads:[~2006-08-11 23:17 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-10 1:20 Mingming Cao
2006-08-10 6:39 ` Andrew Morton
2006-08-10 9:29 ` [Ext2-devel] " Alex Tomas
2006-08-10 9:48 ` Andrew Morton
2006-08-10 10:08 ` Alex Tomas
2006-08-10 15:55 ` Zach Brown
2006-08-10 17:49 ` Randy.Dunlap
2006-08-10 19:05 ` Alex Tomas
2006-08-11 20:57 ` Randy.Dunlap
2006-08-11 21:05 ` Alex Tomas
2006-08-11 21:49 ` Mingming Cao
2006-08-11 23:00 ` Andrew Morton
2006-08-12 6:02 ` Randy.Dunlap
2006-08-12 17:43 ` Darrick J. Wong
2006-08-12 18:20 ` Randy.Dunlap
2006-08-14 16:26 ` Mingming Cao
2006-08-14 17:22 ` Randy.Dunlap
2006-08-14 17:52 ` Jeff Garzik
2006-08-14 18:05 ` Randy.Dunlap
2006-08-14 18:13 ` Jeff Garzik
2006-08-15 15:40 ` Pavel Machek
2006-08-18 13:08 ` Andreas Dilger
2006-08-10 16:46 ` Mingming Cao
2006-08-10 17:17 ` [Ext2-devel] " Theodore Tso
2006-08-10 18:00 ` Andrew Morton
2006-08-11 22:13 ` Mingming Cao
2006-08-11 23:16 ` Andrew Morton [this message]
2006-08-12 0:05 ` [PATCH 1/2] ext3 and jbd cleanup: remove whitespace Mingming Cao
2006-08-12 0:05 ` [PATCH 2/2] ext3 and jbd cleanup: replace brelse() to put_bh Mingming Cao
2006-08-15 21:27 [Ext2-devel] [PATCH 1/9] extents for ext4 Randy Dunlap
2006-08-15 23:19 ` Mingming Cao
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=20060811161655.0ad11259.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=cmm@us.ibm.com \
--cc=ext2-devel@lists.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
/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
Powered by JetHome