Linux Headquarters
[ Register ]
[ About us ] [ Home Page ]

Advertisement
[ Kernel ] [ Documentation ] [ Links ] [ Books ]

Advertisement

Kernel v2.1.107 /fs/buffer.c

Filename:/fs/buffer.c
Lines Added:15
Lines Deleted:12
Also changed in: (Previous) 2.1.104  2.1.102  2.1.101  2.1.100  2.1.94  2.1.92 
(Following) 2.1.118  2.1.126  2.1.129  2.1.132 

Location
[  2.1.107
  [  fs
     o  buffer.c

Patch

diff -u --recursive --new-file v2.1.106/linux/fs/buffer.c linux/fs/buffer.c
--- v2.1.106/linux/fs/buffer.c   Sun Jun  7 11:16:35 1998
+++ linux/fs/buffer.c   Wed Jun 24 14:30:09 1998
@@ -1053,10 +1053,13 @@
    wait_on_buffer(buf);
    mark_buffer_clean(buf);
    clear_bit(BH_Protected, &buf->b_state);
-   buf->b_count--;
    remove_from_hash_queue(buf);
    buf->b_dev = NODEV;
    refile_buffer(buf);
+   if (!--buf->b_count)
+      return;
+   printk("VFS: forgot an in-use buffer! (count=%d)\n",
+      buf->b_count);
 }
 
 /*
@@ -1065,19 +1068,19 @@
  */
 struct buffer_head * bread(kdev_t dev, int block, int size)
 {
-   struct buffer_head * bh;
+   struct buffer_head * bh = getblk(dev, block, size);
 
-   if (!(bh = getblk(dev, block, size))) {
-      printk("VFS: bread: impossible error\n");
+   if (bh) {
+      if (buffer_uptodate(bh))
+         return bh;
+      ll_rw_block(READ, 1, &bh);
+      wait_on_buffer(bh);
+      if (buffer_uptodate(bh))
+         return bh;
+      brelse(bh);
       return NULL;
    }
-   if (buffer_uptodate(bh))
-      return bh;
-   ll_rw_block(READ, 1, &bh);
-   wait_on_buffer(bh);
-   if (buffer_uptodate(bh))
-      return bh;
-   brelse(bh);
+   printk("VFS: bread: impossible error\n");
    return NULL;
 }
 
@@ -1308,7 +1311,7 @@
    if (!async)
       return NULL;
 
-   /* Uhhuh. We're _really_ low on memory. Now we just
+   /* We're _really_ low on memory. Now we just
     * wait for old buffer heads to become free due to
     * finishing IO.  Since this is an async request and
     * the reserve list is empty, we're sure there are 


Comments: webmaster (at) linuxhq.com.
Advertising: banners (at) linuxhq.com.
Compilation ©1998-2008 Linux Headquarters, Inc.