patch-2.4.21 linux-2.4.21/fs/buffer.c
Next file: linux-2.4.21/fs/dcache.c
Previous file: linux-2.4.21/fs/block_dev.c
Back to the patch index
Back to the overall index
- Lines: 146
- Date:
2003-06-13 07:51:37.000000000 -0700
- Orig file:
linux-2.4.20/fs/buffer.c
- Orig date:
2002-11-28 15:53:15.000000000 -0800
diff -urN linux-2.4.20/fs/buffer.c linux-2.4.21/fs/buffer.c
@@ -328,6 +328,8 @@
if (sb->s_dirt && sb->s_op && sb->s_op->write_super)
sb->s_op->write_super(sb);
unlock_super(sb);
+ if (sb->s_op && sb->s_op->sync_fs)
+ sb->s_op->sync_fs(sb);
unlock_kernel();
return sync_buffers(dev, 1);
@@ -346,7 +348,7 @@
lock_kernel();
sync_inodes(dev);
DQUOT_SYNC(dev);
- sync_supers(dev);
+ sync_supers(dev, 1);
unlock_kernel();
return sync_buffers(dev, 1);
@@ -583,37 +585,29 @@
return bh;
}
-void buffer_insert_inode_queue(struct buffer_head *bh, struct inode *inode)
+void buffer_insert_list(struct buffer_head *bh, struct list_head *list)
{
spin_lock(&lru_list_lock);
- if (bh->b_inode)
+ if (buffer_attached(bh))
list_del(&bh->b_inode_buffers);
- bh->b_inode = inode;
- list_add(&bh->b_inode_buffers, &inode->i_dirty_buffers);
+ set_buffer_attached(bh);
+ list_add(&bh->b_inode_buffers, list);
spin_unlock(&lru_list_lock);
}
-void buffer_insert_inode_data_queue(struct buffer_head *bh, struct inode *inode)
-{
- spin_lock(&lru_list_lock);
- if (bh->b_inode)
- list_del(&bh->b_inode_buffers);
- bh->b_inode = inode;
- list_add(&bh->b_inode_buffers, &inode->i_dirty_data_buffers);
- spin_unlock(&lru_list_lock);
-}
-
-/* The caller must have the lru_list lock before calling the
- remove_inode_queue functions. */
+/*
+ * The caller must have the lru_list lock before calling the
+ * remove_inode_queue functions.
+ */
static void __remove_inode_queue(struct buffer_head *bh)
{
- bh->b_inode = NULL;
list_del(&bh->b_inode_buffers);
+ clear_buffer_attached(bh);
}
static inline void remove_inode_queue(struct buffer_head *bh)
{
- if (bh->b_inode)
+ if (buffer_attached(bh))
__remove_inode_queue(bh);
}
@@ -695,13 +689,13 @@
/* All buffers in the lru lists are mapped */
if (!buffer_mapped(bh))
BUG();
- if (buffer_dirty(bh))
+ if (buffer_dirty(bh) && destroy_dirty_buffers)
printk("invalidate: dirty buffer\n");
if (!atomic_read(&bh->b_count)) {
if (destroy_dirty_buffers || !buffer_dirty(bh)) {
remove_inode_queue(bh);
}
- } else
+ } else if (!bdev->bd_openers)
printk("invalidate: busy buffer\n");
write_unlock(&hash_table_lock);
@@ -831,10 +825,10 @@
int fsync_buffers_list(struct list_head *list)
{
struct buffer_head *bh;
- struct inode tmp;
+ struct list_head tmp;
int err = 0, err2;
- INIT_LIST_HEAD(&tmp.i_dirty_buffers);
+ INIT_LIST_HEAD(&tmp);
spin_lock(&lru_list_lock);
@@ -842,10 +836,10 @@
bh = BH_ENTRY(list->next);
list_del(&bh->b_inode_buffers);
if (!buffer_dirty(bh) && !buffer_locked(bh))
- bh->b_inode = NULL;
+ clear_buffer_attached(bh);
else {
- bh->b_inode = &tmp;
- list_add(&bh->b_inode_buffers, &tmp.i_dirty_buffers);
+ set_buffer_attached(bh);
+ list_add(&bh->b_inode_buffers, &tmp);
if (buffer_dirty(bh)) {
get_bh(bh);
spin_unlock(&lru_list_lock);
@@ -865,8 +859,8 @@
}
}
- while (!list_empty(&tmp.i_dirty_buffers)) {
- bh = BH_ENTRY(tmp.i_dirty_buffers.prev);
+ while (!list_empty(&tmp)) {
+ bh = BH_ENTRY(tmp.prev);
remove_inode_queue(bh);
get_bh(bh);
spin_unlock(&lru_list_lock);
@@ -1032,6 +1026,7 @@
write_some_buffers(NODEV);
}
}
+EXPORT_SYMBOL(balance_dirty);
inline void __mark_dirty(struct buffer_head *bh)
{
@@ -1138,7 +1133,7 @@
*/
static void __put_unused_buffer_head(struct buffer_head * bh)
{
- if (bh->b_inode)
+ if (unlikely(buffer_attached(bh)))
BUG();
if (nr_unused_buffer_heads >= MAX_UNUSED_BUFFERS) {
kmem_cache_free(bh_cachep, bh);
@@ -2833,7 +2828,7 @@
{
lock_kernel();
sync_unlocked_inodes();
- sync_supers(0);
+ sync_supers(0, 0);
unlock_kernel();
for (;;) {
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)