http://oss.sgi.com:8090/xfs-linux-2.6
nathans@sgi.com|ChangeSet|20050206235723|10100 nathans

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2005/02/07 22:37:02-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-xfs
# 
# fs/xfs/linux-2.6/xfs_file.c
#   2005/02/07 22:36:56-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/02/07 10:57:23+11:00 nathans@sgi.com 
#   [XFS] Prevent releasepage from releasing pages early, while they still
#   have delayed allocate buffers.	Affects filesystem blocksizes smaller
#   than the pagesize only.
#   
#   SGI-PV: 929309
#   SGI-Modid: xfs-linux-melb:xfs-kern:21409a
#   Signed-off-by: Nathan Scott <nathans@sgi.com>
# 
# fs/xfs/linux-2.6/xfs_aops.c
#   2005/02/07 10:56:54+11:00 nathans@sgi.com +19 -17
#   [XFS] Prevent releasepage from releasing pages early, while they still
#   have delayed allocate buffers.	Affects filesystem blocksizes smaller
#   than the pagesize only.
# 
# ChangeSet
#   2005/02/07 10:04:19+11:00 nathans@sgi.com 
#   [XFS] Reinstate missing frozen check on write, fixes snapshots and
#   xfs_freeze.
#   
#   SGI-PV: 925910
#   SGI-Modid: xfs-linux-melb:xfs-kern:21407a
#   Signed-off-by: Nathan Scott <nathans@sgi.com>
# 
# fs/xfs/linux-2.6/xfs_lrw.c
#   2005/02/07 10:03:45+11:00 nathans@sgi.com +2 -0
#   [XFS] Reinstate missing frozen check on write, fixes snapshots and
#   xfs_freeze.
# 
# ChangeSet
#   2005/02/05 00:16:33-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-xfs
# 
# fs/Kconfig
#   2005/02/05 00:16:29-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/02/03 18:42:59-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-xfs
# 
# include/linux/fs.h
#   2005/02/03 18:42:54-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/02/02 21:42:44-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-xfs
# 
# include/linux/fs.h
#   2005/02/02 21:42:39-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/01/28 14:50:51-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-xfs
# 
# include/linux/fs.h
#   2005/01/28 14:50:47-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/01/26 18:52:08-08:00 akpm@bix.(none) 
#   Merge http://oss.sgi.com:8090/xfs-linux-2.6
#   into bix.(none):/usr/src/bk-xfs
# 
# include/linux/fs.h
#   2005/01/26 18:52:04-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# fs/xfs/linux-2.6/xfs_vnode.c
#   2005/01/26 18:52:04-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# fs/xfs/linux-2.6/xfs_super.c
#   2005/01/26 18:52:04-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# fs/xfs/linux-2.6/xfs_file.c
#   2005/01/26 18:52:04-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# fs/xfs/linux-2.6/xfs_buf.c
#   2005/01/26 18:52:04-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/01/21 12:20:37-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-xfs
# 
# include/linux/fs.h
#   2005/01/21 12:20:31-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# fs/xfs/linux-2.6/xfs_vnode.c
#   2005/01/21 12:20:31-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# fs/xfs/linux-2.6/xfs_super.c
#   2005/01/21 12:20:31-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# fs/xfs/linux-2.6/xfs_file.c
#   2005/01/21 12:20:31-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# fs/xfs/linux-2.6/xfs_buf.c
#   2005/01/21 12:20:31-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/01/19 14:31:23-08:00 akpm@bix.(none) 
#   Merge http://oss.sgi.com:8090/xfs-linux-2.6
#   into bix.(none):/usr/src/bk-xfs
# 
# include/linux/fs.h
#   2005/01/19 14:31:19-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# fs/xfs/linux-2.6/xfs_super.c
#   2005/01/19 14:31:19-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# fs/xfs/linux-2.6/xfs_buf.c
#   2005/01/19 14:31:19-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# fs/Kconfig
#   2005/01/19 14:31:19-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/01/15 21:18:31-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-xfs
# 
# include/linux/fs.h
#   2005/01/15 21:18:27-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# fs/xfs/linux-2.6/xfs_super.c
#   2005/01/15 21:18:27-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# fs/xfs/linux-2.6/xfs_buf.c
#   2005/01/15 21:18:27-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# fs/Kconfig
#   2005/01/15 21:18:27-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/01/13 17:11:43-08:00 akpm@bix.(none) 
#   Merge http://oss.sgi.com:8090/xfs-linux-2.6
#   into bix.(none):/usr/src/bk-xfs
# 
# include/linux/fs.h
#   2005/01/13 17:11:39-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# fs/Kconfig
#   2005/01/13 17:11:39-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/01/11 22:23:39-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-xfs
# 
# include/linux/fs.h
#   2005/01/11 22:23:34-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/01/11 16:01:59-08:00 akpm@bix.(none) 
#   Merge http://oss.sgi.com:8090/xfs-linux-2.6
#   into bix.(none):/usr/src/bk-xfs
# 
# include/linux/fs.h
#   2005/01/11 16:01:55-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# fs/Kconfig
#   2005/01/11 16:01:55-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
diff -Nru a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
--- a/fs/xfs/linux-2.6/xfs_aops.c	2005-02-09 18:59:10 -08:00
+++ b/fs/xfs/linux-2.6/xfs_aops.c	2005-02-09 18:59:10 -08:00
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2005 Silicon Graphics, Inc.  All Rights Reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
@@ -156,9 +156,7 @@
 {
 	ASSERT(!private || inode == (struct inode *)private);
 
-	/* private indicates an unwritten extent lay beneath this IO,
-	 * see linvfs_get_block_core.
-	 */
+	/* private indicates an unwritten extent lay beneath this IO */
 	if (private && size > 0) {
 		vnode_t	*vp = LINVFS_GET_VP(inode);
 		int	error;
@@ -728,11 +726,9 @@
 	pgoff_t                 end_index, last_index, tlast;
 	int			len, err, i, cnt = 0, uptodate = 1;
 	int			flags = startio ? 0 : BMAPI_TRYLOCK;
-	int			page_dirty = 1;
-	int                     delalloc = 0;
-
+	int			page_dirty, delalloc = 0;
 
-	/* Are we off the end of the file ? */
+	/* Is this page beyond the end of the file? */
 	offset = i_size_read(inode);
 	end_index = offset >> PAGE_CACHE_SHIFT;
 	last_index = (offset - 1) >> PAGE_CACHE_SHIFT;
@@ -751,7 +747,13 @@
 	bh = head = page_buffers(page);
 	iomp = NULL;
 
+	/*
+	 * page_dirty is initially a count of buffers on the page and
+	 * is decrememted as we move each into a cleanable state.
+	 */
 	len = bh->b_size;
+	page_dirty = PAGE_CACHE_SIZE / len;
+
 	do {
 		if (offset >= end_offset)
 			break;
@@ -794,7 +796,7 @@
 				}
 				BUG_ON(!buffer_locked(bh));
 				bh_arr[cnt++] = bh;
-				page_dirty = 0;
+				page_dirty--;
 			}
 		/*
 		 * Second case, allocate space for a delalloc buffer.
@@ -821,7 +823,7 @@
 					unlock_buffer(bh);
 					mark_buffer_dirty(bh);
 				}
-				page_dirty = 0;
+				page_dirty--;
 			}
 		} else if ((buffer_uptodate(bh) || PageUptodate(page)) &&
 			   (unmapped || startio)) {
@@ -857,13 +859,13 @@
 						unlock_buffer(bh);
 						mark_buffer_dirty(bh);
 					}
-					page_dirty = 0;
+					page_dirty--;
 				}
 			} else if (startio) {
 				if (buffer_uptodate(bh) &&
 				    !test_and_set_bit(BH_Lock, &bh->b_state)) {
 					bh_arr[cnt++] = bh;
-					page_dirty = 0;
+					page_dirty--;
 				}
 			}
 		}
@@ -907,7 +909,7 @@
 }
 
 STATIC int
-linvfs_get_block_core(
+__linvfs_get_block(
 	struct inode		*inode,
 	sector_t		iblock,
 	unsigned long		blocks,
@@ -977,10 +979,10 @@
 	if (iomap.iomap_flags & IOMAP_DELAY) {
 		BUG_ON(direct);
 		if (create) {
-			set_buffer_mapped(bh_result);
 			set_buffer_uptodate(bh_result);
+			set_buffer_mapped(bh_result);
+			set_buffer_delay(bh_result);
 		}
-		set_buffer_delay(bh_result);
 	}
 
 	if (blocks) {
@@ -999,7 +1001,7 @@
 	struct buffer_head	*bh_result,
 	int			create)
 {
-	return linvfs_get_block_core(inode, iblock, 0, bh_result,
+	return __linvfs_get_block(inode, iblock, 0, bh_result,
 					create, 0, BMAPI_WRITE);
 }
 
@@ -1011,7 +1013,7 @@
 	struct buffer_head	*bh_result,
 	int			create)
 {
-	return linvfs_get_block_core(inode, iblock, max_blocks, bh_result,
+	return __linvfs_get_block(inode, iblock, max_blocks, bh_result,
 					create, 1, BMAPI_WRITE|BMAPI_DIRECT);
 }
 
diff -Nru a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c
--- a/fs/xfs/linux-2.6/xfs_lrw.c	2005-02-09 18:59:10 -08:00
+++ b/fs/xfs/linux-2.6/xfs_lrw.c	2005-02-09 18:59:10 -08:00
@@ -676,6 +676,8 @@
 	if (XFS_FORCED_SHUTDOWN(mp))
 		return -EIO;
 
+	fs_check_frozen(vp->v_vfsp, SB_FREEZE_WRITE);
+
 	if (ioflags & IO_ISDIRECT) {
 		xfs_buftarg_t	*target =
 			(xip->i_d.di_flags & XFS_DIFLAG_REALTIME) ?