[Ocfs2-commits] jlbec commits r1094 - branches/format-changes/src

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Mon Jun 14 12:09:17 CDT 2004


Author: jlbec
Date: 2004-06-14 11:09:16 -0500 (Mon, 14 Jun 2004)
New Revision: 1094

Modified:
   branches/format-changes/src/alloc.c
   branches/format-changes/src/buffer_head_io.c
   branches/format-changes/src/file.c
   branches/format-changes/src/inode.c
   branches/format-changes/src/journal.c
   branches/format-changes/src/namei.c
   branches/format-changes/src/ocfs.h
   branches/format-changes/src/ocfs_compat.h
   branches/format-changes/src/super.c
   branches/format-changes/src/volcfg.c
Log:

o Use sb_getblk instead of getblk(OCFS_GET_BLOCKDEV()).  From
  Christoph Hellwig <hch at lst.de>



Modified: branches/format-changes/src/alloc.c
===================================================================
--- branches/format-changes/src/alloc.c	2004-06-14 15:36:33 UTC (rev 1093)
+++ branches/format-changes/src/alloc.c	2004-06-14 16:09:16 UTC (rev 1094)
@@ -934,9 +934,7 @@
 	phys_blkno = physicalOffset >> osb->sb->s_blocksize_bits;
 
 	for (i = 0; i < numbhs; i++) {
-		bhs[i] = getblk(OCFS_GET_BLOCKDEV(osb->sb), 
-				phys_blkno + i,
-				osb->sb->s_blocksize);
+		bhs[i] = sb_getblk(osb->sb, phys_blkno + i);
 		if (bhs[i] == NULL) {
 			status = -EIO;
 			LOG_ERROR_STATUS(status);

Modified: branches/format-changes/src/buffer_head_io.c
===================================================================
--- branches/format-changes/src/buffer_head_io.c	2004-06-14 15:36:33 UTC (rev 1093)
+++ branches/format-changes/src/buffer_head_io.c	2004-06-14 16:09:16 UTC (rev 1094)
@@ -71,7 +71,6 @@
 	int status = 0;
 	int i;
 	struct super_block *sb;
-	ocfs_blockdev dev;
 	struct buffer_head *bh;
 
 #ifdef OCFS_DBG_TIMING
@@ -96,7 +95,6 @@
 		LOG_TRACE_ARGS ("Getting write for %d blocks\n", nr);
 
 	sb = osb->sb;
-	dev = OCFS_GET_BLOCKDEV(sb);
 
 	/* we don't ever want cached writes -- those should go to the
 	 * journal so we can control when they actually hit disk and
@@ -211,7 +209,6 @@
 	struct super_block *sb;
 	int nr, i, ignore_cache = 0;
 	__u64 blocknum;
-	ocfs_blockdev dev;
 	struct buffer_head *bh;
 
 #ifdef OCFS_DBG_TIMING
@@ -248,7 +245,6 @@
 	}
 
 	sb = osb->sb;
-	dev = OCFS_GET_BLOCKDEV(sb);
 	blocknum = off >> sb->s_blocksize_bits;
 
 	nr = (len + 511) >> 9;
@@ -263,7 +259,7 @@
 
 	for (i = 0 ; i < nr ; i++) {
 		if (bhs[i] == NULL) {
-			bhs[i] = getblk (dev, blocknum++, sb->s_blocksize);
+			bhs[i] = sb_getblk(sb, blocknum++);
 			if (bhs[i] == NULL) {
 				LOG_TRACE_STR("bh == NULL");
 				status = -EIO;

Modified: branches/format-changes/src/file.c
===================================================================
--- branches/format-changes/src/file.c	2004-06-14 15:36:33 UTC (rev 1093)
+++ branches/format-changes/src/file.c	2004-06-14 16:09:16 UTC (rev 1094)
@@ -1228,7 +1228,8 @@
 			     block < (unsigned long)((actualDiskOffset+actualLength) >> sb->s_blocksize_bits);
 			     block++) {
 				LOG_TRACE_ARGS("setting block %lu as new!\n", block);
-				alloc_bh = getblk(OCFS_GET_BLOCKDEV(sb), block, sb->s_blocksize);
+				alloc_bh = sb_getblk(sb, block);
+#warning unchecked allocation here
 				alloc_bh->b_state |= (1UL << BH_New);
 				brelse(alloc_bh);
 			}

Modified: branches/format-changes/src/inode.c
===================================================================
--- branches/format-changes/src/inode.c	2004-06-14 15:36:33 UTC (rev 1093)
+++ branches/format-changes/src/inode.c	2004-06-14 16:09:16 UTC (rev 1094)
@@ -1063,9 +1063,7 @@
 		goto fail;
 
 	if (new) {
-		bh = getblk(OCFS_GET_BLOCKDEV(osb->sb), 
-			    lbo >> osb->sb->s_blocksize_bits, 
-			    osb->sb->s_blocksize);
+		bh = sb_getblk(osb->sb, lbo >> osb->sb->s_blocksize_bits);
 		if (!bh) {
 			tmperr = -EIO;
 			goto fail;

Modified: branches/format-changes/src/journal.c
===================================================================
--- branches/format-changes/src/journal.c	2004-06-14 15:36:33 UTC (rev 1093)
+++ branches/format-changes/src/journal.c	2004-06-14 16:09:16 UTC (rev 1094)
@@ -540,9 +540,9 @@
 			 * turned off later. */
 			LOG_ERROR_ARGS("block %lu was modified but never "
 				       "dirtied!\n", co->blocknr);
-			bh = getblk(OCFS_GET_BLOCKDEV(osb->sb), co->blocknr,
-				    osb->sb->s_blocksize);
+			bh = sb_getblk(osb->sb, co->blocknr);
 			if (bh == NULL)
+#warning bingo, oops on oom
 				BUG();
 
 			dirtied = 0;

Modified: branches/format-changes/src/namei.c
===================================================================
--- branches/format-changes/src/namei.c	2004-06-14 15:36:33 UTC (rev 1093)
+++ branches/format-changes/src/namei.c	2004-06-14 16:09:16 UTC (rev 1094)
@@ -401,9 +401,7 @@
 		goto leave;
 	}
 
-	*new_fe_bh = getblk(OCFS_GET_BLOCKDEV(osb->sb), 
-			    disk_off >> osb->sb->s_blocksize_bits, 
-			    osb->sb->s_blocksize);
+	*new_fe_bh = sb_getblk(osb->sb, disk_off >> osb->sb->s_blocksize_bits);
 	if (!*new_fe_bh) {
 		status = -EIO;
 		LOG_ERROR_STATUS(status);

Modified: branches/format-changes/src/ocfs.h
===================================================================
--- branches/format-changes/src/ocfs.h	2004-06-14 15:36:33 UTC (rev 1093)
+++ branches/format-changes/src/ocfs.h	2004-06-14 16:09:16 UTC (rev 1094)
@@ -393,21 +393,16 @@
 #endif
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-typedef struct block_device * ocfs_blockdev;
 typedef dev_t ocfs_dev;
 #define OCFS_NODEV     0
-#define OCFS_GET_BLOCKDEV(sb)   ((sb)->s_bdev)
 #else /* 2.4 kernel */
-typedef kdev_t ocfs_blockdev;
 typedef int ocfs_dev;
 #define OCFS_NODEV     NODEV
-#define OCFS_GET_BLOCKDEV(sb)   ((sb)->s_dev)
 #endif
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 /* No longer exists in 2.5 */
 #define fsync_inode_buffers(inode) sync_mapping_buffers(inode->i_mapping)
-#define getblk(dev, blk, sz)	__getblk(dev, blk, sz)
 #endif /* >= 2.6.0  */
 
 #define OCFS_SB(sb)	    ((ocfs_super *)OCFS_GENERIC_SB_MEMBER(sb))
@@ -452,11 +447,7 @@
 	struct semaphore s_sem;
 	struct list_head s_list;
 	unsigned long s_blocknr;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 	dev_t s_dev;
-#else
-	kdev_t s_dev;
-#endif
 	atomic_t s_refcnt;
 	struct buffer_head *s_bh;
 	wait_queue_head_t s_wait;

Modified: branches/format-changes/src/ocfs_compat.h
===================================================================
--- branches/format-changes/src/ocfs_compat.h	2004-06-14 15:36:33 UTC (rev 1093)
+++ branches/format-changes/src/ocfs_compat.h	2004-06-14 16:09:16 UTC (rev 1094)
@@ -59,10 +59,16 @@
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,18)
 #define unlock_page(p)         UnlockPage(p)
+
+static inline struct buffer_head * sb_getblk(struct super_block *sb, int block)
+{
+	return getblk(sb->s_dev, block, sb->s_blocksize);
+}
 #endif
 
 #define io_schedule		schedule
 #define io_schedule_timeout	schedule_timeout
+#define bdev_hardsect_size(b)	get_hardsect_size((b)->bd_dev);
 
 #ifdef HAVE_NPTL
 static inline void dequeue_signal_lock(struct task_struct *task,

Modified: branches/format-changes/src/super.c
===================================================================
--- branches/format-changes/src/super.c	2004-06-14 15:36:33 UTC (rev 1093)
+++ branches/format-changes/src/super.c	2004-06-14 16:09:16 UTC (rev 1094)
@@ -840,19 +840,6 @@
 	OCFS_CLEAR_FLAG (OcfsGlobalCtxt.flags, OCFS_FLAG_MEM_LISTS_INITIALIZED);
 }				/* ocfs_free_mem_lists */
 
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-static inline int ocfs_hardsect_size(struct block_device *bdev)
-{
-        return bdev_hardsect_size(bdev);
-}
-#else
-static inline int ocfs_hardsect_size(dev_t dev)
-{
-        return get_hardsect_size(dev);
-}
-#endif /* 2.6.0 */
-
 static int ocfs2_sb_probe(struct super_block *sb,
 			  struct buffer_head **bh, 
 			  int *sector_size)
@@ -865,7 +852,7 @@
 	*bh = NULL;
 
 	/* may be > 512 */
-	*sector_size = ocfs_hardsect_size(OCFS_GET_BLOCKDEV(sb));
+	*sector_size = bdev_hardsect_size(sb->s_bdev);
 	if (*sector_size > 4096) {
 		LOG_ERROR_ARGS("Hardware sector size too large: %d (max=4096)\n", *sector_size);
 		status = -EINVAL;
@@ -947,7 +934,7 @@
 		return status;
 	}
 
-	*bh = getblk (OCFS_GET_BLOCKDEV(sb), block, sect_size);
+	*bh = sb_getblk(sb, block);
 	if (!*bh) {
 		LOG_ERROR_STATUS(-EIO);
 		return -EIO;

Modified: branches/format-changes/src/volcfg.c
===================================================================
--- branches/format-changes/src/volcfg.c	2004-06-14 15:36:33 UTC (rev 1093)
+++ branches/format-changes/src/volcfg.c	2004-06-14 16:09:16 UTC (rev 1094)
@@ -489,7 +489,7 @@
 	sb = osb->sb;
 
 	blocknum = lock_off >> sb->s_blocksize_bits;
-	bh = getblk(OCFS_GET_BLOCKDEV(sb), blocknum, sb->s_blocksize);
+	bh = sb_getblk(sb, blocknum);
 	if (bh == NULL) {
 		LOG_ERROR_STATUS (status = -EIO);
 		goto finally;
@@ -636,7 +636,7 @@
 	/* Write the node details */
 	blocknum = osb->autoconfig_blkno + OCFS_VOLCFG_HDR_SECTORS + node_num;
 
-	bh = getblk(OCFS_GET_BLOCKDEV(sb), blocknum, sb->s_blocksize);
+	bh = sb_getblk(sb, blocknum);
 	if (bh == NULL) {
 		status = -EIO;
 		LOG_ERROR_STATUS(status);



More information about the Ocfs2-commits mailing list