linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@zip.com.au>
To: lkml <linux-kernel@vger.kernel.org>
Subject: [patch] remove buffer_head.b_inode
Date: Wed, 24 Apr 2002 01:52:59 -0700	[thread overview]
Message-ID: <3CC6726B.767B5E3E@zip.com.au> (raw)



Removal of buffer_head.b_inode.  The list_emptiness of b_inode_buffers
is used to indicate whether the buffer is on an inode's
i_dirty_buffers.


=====================================

--- 2.5.9/fs/buffer.c~cleanup-030-b_inode	Wed Apr 24 01:06:12 2002
+++ 2.5.9-akpm/fs/buffer.c	Wed Apr 24 01:44:59 2002
@@ -416,9 +416,7 @@ void buffer_insert_list(spinlock_t *lock
 	if (lock == NULL)
 		lock = &global_bufferlist_lock;
 	spin_lock(lock);
-	if (bh->b_inode)
-		list_del(&bh->b_inode_buffers);
-	bh->b_inode = 1;
+	list_del(&bh->b_inode_buffers);
 	list_add(&bh->b_inode_buffers, list);
 	spin_unlock(lock);
 }
@@ -428,10 +426,7 @@ void buffer_insert_list(spinlock_t *lock
  */
 static inline void __remove_inode_queue(struct buffer_head *bh)
 {
-	if (bh->b_inode) {
-		list_del(&bh->b_inode_buffers);
-		bh->b_inode = 0;
-	}
+	list_del_init(&bh->b_inode_buffers);
 }
 
 int inode_has_buffers(struct inode *inode)
@@ -656,11 +651,8 @@ int fsync_buffers_list(spinlock_t *lock,
 	spin_lock(lock);
 	while (!list_empty(list)) {
 		bh = BH_ENTRY(list->next);
-		list_del(&bh->b_inode_buffers);
-		if (!buffer_dirty(bh) && !buffer_locked(bh))
-			bh->b_inode = 0;
-		else {
-			bh->b_inode = 1;
+		list_del_init(&bh->b_inode_buffers);
+		if (buffer_dirty(bh) || buffer_locked(bh)) {
 			list_add(&bh->b_inode_buffers, &tmp);
 			if (buffer_dirty(bh)) {
 				get_bh(bh);
@@ -2237,8 +2229,7 @@ EXPORT_SYMBOL(alloc_buffer_head);
 
 void free_buffer_head(struct buffer_head *bh)
 {
-	if (bh->b_inode)
-		BUG();
+	BUG_ON(!list_empty(&bh->b_inode_buffers));
 	mempool_free(bh, bh_mempool);
 }
 EXPORT_SYMBOL(free_buffer_head);
@@ -2253,6 +2244,7 @@ static void init_buffer_head(void *data,
 		bh->b_dev = B_FREE;
 		bh->b_bdev = NULL;
 		bh->b_blocknr = -1;
+		INIT_LIST_HEAD(&bh->b_inode_buffers);
 		init_waitqueue_head(&bh->b_wait);
 	}
 }
--- 2.5.9/include/linux/fs.h~cleanup-030-b_inode	Wed Apr 24 01:06:12 2002
+++ 2.5.9-akpm/include/linux/fs.h	Wed Apr 24 01:44:59 2002
@@ -257,7 +257,6 @@ struct buffer_head {
 
 	wait_queue_head_t b_wait;
 
-	int b_inode;				/* will go away */
 	struct list_head     b_inode_buffers;	/* doubly linked list of inode dirty buffers */
 };

             reply	other threads:[~2002-04-24  8:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-24  8:52 Andrew Morton [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-11-29  3:38 [patch] remove buffer_head.b_inode Andrew Morton

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=3CC6726B.767B5E3E@zip.com.au \
    --to=akpm@zip.com.au \
    --cc=linux-kernel@vger.kernel.org \
    /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).