patch-2.2.18 linux/fs/ext2/fsync.c

Next file: linux/fs/ext2/ialloc.c
Previous file: linux/fs/ext2/file.c
Back to the patch index
Back to the overall index

diff -u --new-file --recursive --exclude-from /usr/src/exclude v2.2.17/fs/ext2/fsync.c linux/fs/ext2/fsync.c
@@ -39,40 +39,6 @@
 {
 	struct buffer_head * bh;
 	
-	if (!*block)
-		return 0;
-	bh = get_hash_table (inode->i_dev, *block, blocksize);
-	if (!bh)
-		return 0;
-	if (wait && buffer_req(bh) && !buffer_uptodate(bh)) {
-		/* There can be a parallell read(2) that started read-I/O
-		   on the buffer so we can't assume that there's been
-		   an I/O error without first waiting I/O completation. */
-		wait_on_buffer(bh);
-		if (!buffer_uptodate(bh))
-		{
-			brelse (bh);
-			return -1;
-		}
-	}
-	if (wait || !buffer_uptodate(bh) || !buffer_dirty(bh)) {
-		if (wait)
-			/* when we return from fsync all the blocks
-			   must be _just_ stored on disk */
-			wait_on_buffer(bh);
-		brelse (bh);
-		return 0;
-	}
-	ll_rw_block (WRITE, 1, &bh);
-	bh->b_count--;
-	return 0;
-}
-
-#ifndef __LITTLE_ENDIAN
-static int sync_block_swab32 (struct inode * inode, u32 * block, int wait)
-{
-	struct buffer_head * bh;
-	
 	if (!le32_to_cpu(*block))
 		return 0;
 	bh = get_hash_table (inode->i_dev, le32_to_cpu(*block), blocksize);
@@ -101,10 +67,6 @@
 	bh->b_count--;
 	return 0;
 }
-#else
-#define sync_block_swab32 sync_block
-#endif
-
 
 static int sync_iblock (struct inode * inode, u32 * iblock, 
 			struct buffer_head ** bh, int wait) 
@@ -112,29 +74,10 @@
 	int rc, tmp;
 	
 	*bh = NULL;
-	tmp = *iblock;
-	if (!tmp)
-		return 0;
-	rc = sync_block (inode, iblock, wait);
-	if (rc)
-		return rc;
-	*bh = bread (inode->i_dev, tmp, blocksize);
-	if (!*bh)
-		return -1;
-	return 0;
-}
-
-#ifndef __LITTLE_ENDIAN
-static int sync_iblock_swab32 (struct inode * inode, u32 * iblock, 
-			       struct buffer_head ** bh, int wait) 
-{
-	int rc, tmp;
-	
-	*bh = NULL;
 	tmp = le32_to_cpu(*iblock);
 	if (!tmp)
 		return 0;
-	rc = sync_block_swab32 (inode, iblock, wait);
+	rc = sync_block (inode, iblock, wait);
 	if (rc)
 		return rc;
 	*bh = bread (inode->i_dev, tmp, blocksize);
@@ -142,9 +85,6 @@
 		return -1;
 	return 0;
 }
-#else
-#define sync_iblock_swab32 sync_iblock
-#endif
 
 static int sync_direct (struct inode * inode, int wait)
 {
@@ -170,9 +110,7 @@
 		return rc;
 	
 	for (i = 0; i < addr_per_block; i++) {
-		rc = sync_block_swab32 (inode, 
-					((u32 *) ind_bh->b_data) + i,
-					wait);
+		rc = sync_block (inode, ((u32 *) ind_bh->b_data) + i, wait);
 		if (rc)
 			err = rc;
 	}
@@ -180,31 +118,6 @@
 	return err;
 }
 
-#ifndef __LITTLE_ENDIAN
-static __inline__ int sync_indirect_swab32 (struct inode * inode, u32 * iblock, int wait)
-{
-	int i;
-	struct buffer_head * ind_bh;
-	int rc, err = 0;
-
-	rc = sync_iblock_swab32 (inode, iblock, &ind_bh, wait);
-	if (rc || !ind_bh)
-		return rc;
-	
-	for (i = 0; i < addr_per_block; i++) {
-		rc = sync_block_swab32 (inode, 
-					((u32 *) ind_bh->b_data) + i,
-					wait);
-		if (rc)
-			err = rc;
-	}
-	brelse (ind_bh);
-	return err;
-}
-#else
-#define sync_indirect_swab32 sync_indirect
-#endif
-
 static int sync_dindirect (struct inode * inode, u32 * diblock, int wait)
 {
 	int i;
@@ -216,40 +129,13 @@
 		return rc;
 	
 	for (i = 0; i < addr_per_block; i++) {
-		rc = sync_indirect_swab32 (inode,
-					   ((u32 *) dind_bh->b_data) + i,
-					   wait);
-		if (rc)
-			err = rc;
-	}
-	brelse (dind_bh);
-	return err;
-}
-
-#ifndef __LITTLE_ENDIAN
-static __inline__ int sync_dindirect_swab32 (struct inode * inode, u32 * diblock, int wait)
-{
-	int i;
-	struct buffer_head * dind_bh;
-	int rc, err = 0;
-
-	rc = sync_iblock_swab32 (inode, diblock, &dind_bh, wait);
-	if (rc || !dind_bh)
-		return rc;
-	
-	for (i = 0; i < addr_per_block; i++) {
-		rc = sync_indirect_swab32 (inode,
-					   ((u32 *) dind_bh->b_data) + i,
-					   wait);
+		rc = sync_indirect(inode, ((u32 *) dind_bh->b_data) + i, wait);
 		if (rc)
 			err = rc;
 	}
 	brelse (dind_bh);
 	return err;
 }
-#else
-#define sync_dindirect_swab32 sync_dindirect
-#endif
 
 static int sync_tindirect (struct inode * inode, u32 * tiblock, int wait)
 {
@@ -262,9 +148,7 @@
 		return rc;
 	
 	for (i = 0; i < addr_per_block; i++) {
-		rc = sync_dindirect_swab32 (inode,
-					    ((u32 *) tind_bh->b_data) + i,
-					    wait);
+		rc = sync_dindirect(inode, ((u32 *)tind_bh->b_data) + i, wait);
 		if (rc)
 			err = rc;
 	}

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)