[Ocfs2-commits] mfasheh commits r1542 - in branches/dlm-changes: . src

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Fri Oct 1 20:01:26 CDT 2004


Author: mfasheh
Date: 2004-10-01 20:01:24 -0500 (Fri, 01 Oct 2004)
New Revision: 1542

Modified:
   branches/dlm-changes/autogen.sh
   branches/dlm-changes/configure.in
   branches/dlm-changes/src/Makefile
   branches/dlm-changes/src/alloc.c
   branches/dlm-changes/src/dlm.c
   branches/dlm-changes/src/file.c
   branches/dlm-changes/src/lockres.c
   branches/dlm-changes/src/namei.c
   branches/dlm-changes/src/nm.c
   branches/dlm-changes/src/ocfs.h
   branches/dlm-changes/src/proc.c
   branches/dlm-changes/src/vote.c
Log:
* merge trunk changes up to r1523 into the dlm_changes branch
  -Fix s390x module building support
  -find_first_bit() replaced by find_next_bit(..., 0)
  -Assume any 2.6 kernel has generic_file_write_nolock
  -Blow away any autom4te.cache  
  -lockid now in units of blocks rather than bytes
  -Commit a patch to cleanup ocfs_file_open by Christoph Hellwig <hch at lst.de>
  -Make 2.6 source tree guessing smarter
  -Move definition of ocfs_wait_for_readonly_drop to where it actually can be
   inlined. Delete unused label "unlock"
  -Enable aio for 2.6
  -proc changes



Modified: branches/dlm-changes/autogen.sh
===================================================================
--- branches/dlm-changes/autogen.sh	2004-10-02 00:14:10 UTC (rev 1541)
+++ branches/dlm-changes/autogen.sh	2004-10-02 01:01:24 UTC (rev 1542)
@@ -1,4 +1,5 @@
 #!/bin/sh
 
+rm -rf autom4te.cache
 autoconf
 ./configure "$@"

Modified: branches/dlm-changes/configure.in
===================================================================
--- branches/dlm-changes/configure.in	2004-10-02 00:14:10 UTC (rev 1541)
+++ branches/dlm-changes/configure.in	2004-10-02 01:01:24 UTC (rev 1542)
@@ -193,13 +193,15 @@
 
 AC_MSG_CHECKING(for directory with kernel source)
 AC_ARG_WITH(kernel-source, [  --with-kernel-source=dir Path to the kernel source [[autodetect]]], kernelsrc="$withval", [
-  if test -r /etc/UnitedLinux-release -o -r /etc/SuSE-release ; then
+  guesskver=
+  if test -r /etc/UnitedLinux-release -o -r /etc/SuSE-release; then
     guesskver=`echo "$kversion" | sed 's/-[[^-]]*$//'`
-    if test -d "/usr/src/linux-${guesskver}"; then
-      kernelsrc="/usr/src/linux-${guesskver}"
-    else
-      kernelsrc="$kerneldir"
-    fi
+  elif test "x$KERNEL_26" = "xyes" -a -r /etc/redhat-release; then
+    guesskver="$kversion"
+  fi
+
+  if test -n "$guesskver" -a -d "/usr/src/linux-${guesskver}"; then
+    kernelsrc="/usr/src/linux-${guesskver}"
   else
     kernelsrc="$kerneldir"
   fi
@@ -243,8 +245,10 @@
 
 AC_MSG_CHECKING([whether to build aio])
 if test "x$OCFS_AIO" = "xyes"; then
-  if egrep "EXPORT_SYMBOL.*\(brw_kvec_async\);" "$kernelsrc/kernel/ksyms.c" "$kernelsrc/fs/buffer.c" >/dev/null 2>&1; then
+  if test "x$KERNEL_26" = "xyes"; then
     have_aio=yes
+  elif egrep "EXPORT_SYMBOL.*\(brw_kvec_async\);" "$kernelsrc/kernel/ksyms.c" "$kernelsrc/fs/buffer.c" >/dev/null 2>&1; then
+    have_aio=yes
   else
     have_aio=no
   fi
@@ -260,7 +264,7 @@
 
 COMPAT_SAFE_WRITE=
 AC_MSG_CHECKING([for safe write ordering])
-if egrep "EXPORT_SYMBOL.*\(generic_file_write_nolock\);" "$kernelsrc/mm/filemap.c" >/dev/null 2>&1; then
+if test "x$KERNEL_26" = "xyes"; then
   have_safe_write=yes
 elif egrep "EXPORT_SYMBOL.*\(generic_file_write_nolock\);" "$kernelsrc/kernel/ksyms.c" >/dev/null 2>&1; then
   have_safe_write=yes
@@ -293,7 +297,7 @@
 fi
 AC_SUBST(MODVERSIONS)
 
-CPPFLAGS="-I$KERNELSRC/include $saved_CPPFLAGS"
+CPPFLAGS="-I$KERNELSRC/include $CPPFLAGS"
 
 AC_MSG_CHECKING([for NPTL support])
 AC_TRY_COMPILE(

Modified: branches/dlm-changes/src/Makefile
===================================================================
--- branches/dlm-changes/src/Makefile	2004-10-02 00:14:10 UTC (rev 1541)
+++ branches/dlm-changes/src/Makefile	2004-10-02 01:01:24 UTC (rev 1542)
@@ -30,8 +30,12 @@
 endif
 
 ifdef OCFS_AIO
+ifeq ($(KERNELRELEASE),)
 GLOBAL_DEFINES += -DAIO_ENABLED
+else
+GLOBAL_DEFINES += -DAIO_26_ENABLED
 endif
+endif
 
 ifdef OCFS_TRACE
 GLOBAL_DEFINES += -DTRACE
@@ -180,11 +184,15 @@
 
 ifeq ($(OCFS_PROCESSOR),ppc64)
   MACH_CFLAGS += -m64 -fsigned-char -fno-builtin -msoft-float -mminimal-toc
-  LDADD += -m elf64ppc
+  MACH_LDADD += -m elf64ppc
 endif
 ifeq ($(OCFS_PROCESSOR),x86_64)
   MACH_CFLAGS += -m64 -mcmodel=kernel
 endif
+ifeq ($(OCFS_PROCESSOR),s390x)
+  MACH_CFLAGS += -fno-strength-reduce -fpic
+  MACH_LDADD += -m elf64_s390
+endif
 
 BASE_DEFINES = -DMODULE -DLINUX -D__KERNEL__ 
 DEFINES += $(BASE_DEFINES) $(GLOBAL_DEFINES)
@@ -193,7 +201,7 @@
 
 CFLAGS = $(OPTS) $(MACH_CFLAGS) -pipe -nostdinc -fno-strict-aliasing \
 	-fno-common -fomit-frame-pointer $(MODVERSIONS) $(WARNINGS)
-LDADD = -nostdlib
+LDADD = $(MACH_LDADD) -nostdlib
 
 OPTIMIZE = -O2
 

Modified: branches/dlm-changes/src/alloc.c
===================================================================
--- branches/dlm-changes/src/alloc.c	2004-10-02 00:14:10 UTC (rev 1541)
+++ branches/dlm-changes/src/alloc.c	2004-10-02 01:01:24 UTC (rev 1542)
@@ -1085,7 +1085,7 @@
 	LOG_TRACE_STR("Using NON-local extents");
 
 	/*** Nonlocal Extents ***/
-	/* This is now less likely with OCFSv2 extent lists */
+	/* This is now less likely with OCFS2 extent lists */
 	if (fel->l_tree_depth > 4)
 		LOG_ERROR_ARGS ("inode %llu, tree_depth=%u", 
 				OCFS_I(inode)->ip_blkno, fel->l_tree_depth);

Modified: branches/dlm-changes/src/dlm.c
===================================================================
--- branches/dlm-changes/src/dlm.c	2004-10-02 00:14:10 UTC (rev 1541)
+++ branches/dlm-changes/src/dlm.c	2004-10-02 01:01:24 UTC (rev 1542)
@@ -54,8 +54,18 @@
 /* Tracing */
 #define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_DLM
 
-static inline int ocfs_wait_for_readonly_drop(ocfs_super *osb, struct inode *inode);
+/* inode is definitely non NULL */
+static inline int ocfs_wait_for_readonly_drop(ocfs_super *osb, struct inode *inode)
+{
+	int status = 0;
+	ocfs_lock_res *lockres = GET_INODE_LOCKRES(inode);
 
+	if (ocfs_node_map_is_empty(&lockres->readonly_map))
+		return status;
+	status = ocfs_drop_readonly_cache_lock(osb, inode, 0);
+	return status;	
+}
+
 /*
  * ocfs_update_disk_lock()
  * inode is definitely non NULL
@@ -210,7 +220,7 @@
 	OCFS_ASSERT(bh);
 	OCFS_ASSERT(!journal_current_handle());
 
-	lock_id = OCFS_I(inode)->ip_blkno << inode->i_sb->s_blocksize_bits;
+	lock_id = OCFS_I(inode)->ip_blkno;
 	LOG_TRACE_ARGS("lock_id = %llu\n", lock_id);
 
 	flags |= FLAG_ACQUIRE_LOCK;
@@ -255,7 +265,7 @@
 	if (unlikely(lockres->master_node_num >= osb->max_nodes && !no_owner)) {
 		LOG_ERROR_ARGS("lockres: master_node=%d, owner=%s, lockid=%llu\n",
 			       lockres->master_node_num, no_owner?"no":"yes",
-			       OCFS_I(inode)->ip_blkno << inode->i_sb->s_blocksize_bits);
+			       lock_id);
 		LOG_ERROR_STATUS (status = -EINVAL);
 		ocfs_release_lockres_write (inode); // ocfs_acquire_lock
 		goto finally;
@@ -353,10 +363,8 @@
 
 #ifdef VERBOSE_LOCKING_TRACE
 	printk("acquire_lock: lockid=%llu, this=%d, master=%d, locktype=%d, "
-	       "flags=%08x, readonly=%s\n",
-	       OCFS_I(inode)->ip_blkno << inode->i_sb->s_blocksize_bits, 
-	       osb->node_num, lockres->master_node_num, lockres->lock_type, 
-	       flags|extra_lock_flags,
+	       "flags=%08x, readonly=%s\n", lock_id, osb->node_num,
+	       lockres->master_node_num, lockres->lock_type, flags|extra_lock_flags,
 	       test_bit(LOCK_STATE_READONLY, &lockres->readonly_state) ? "yes" : "no");
 #endif	
 	if (wait_on_recovery 
@@ -386,11 +394,8 @@
 		ocfs_release_lockres_write (inode); // ocfs_acquire_lock
 		if (status == -EAGAIN || status == -ETIMEDOUT) {
 			if (status == -ETIMEDOUT)
-				LOG_ERROR_ARGS("Timed out acquiring lock for "
-					       "inode %llu, (lockid = %llu) "
-					       "retrying...\n", 
-					       OCFS_I(inode)->ip_blkno, 
-					       lock_id);
+				LOG_ERROR_ARGS("Timed out acquiring lock for inode "
+					       "%llu, retrying...\n", OCFS_I(inode)->ip_blkno);
 			ocfs_sleep (50);
 			goto again;
 		}
@@ -444,7 +449,7 @@
 	OCFS_ASSERT(inode);
 	OCFS_ASSERT(num_ident);
 
-	lock_id = OCFS_I(inode)->ip_blkno << inode->i_sb->s_blocksize_bits;
+	lock_id = OCFS_I(inode)->ip_blkno;
 	LOG_TRACE_ARGS("lock_id = %llu", lock_id);
 
 	flags |= FLAG_RELEASE_LOCK;
@@ -546,7 +551,6 @@
 	lockres->lock_holders -= num_ident;
 	LOG_TRACE_ARGS("lockres->lock_holders = %u\n", lockres->lock_holders);
 
-unlock:
 	ocfs_release_lockres_write (inode);
   	LOG_EXIT_STATUS (status);
 	return (status);
@@ -566,7 +570,7 @@
 
 	LOG_ENTRY ();
 
-	lock_id = OCFS_I(inode)->ip_blkno << inode->i_sb->s_blocksize_bits;
+	lock_id = OCFS_I(inode)->ip_blkno;
 
 	if (flags & FLAG_READONLY) {
 		if (flags & (FLAG_CHANGE_MASTER | FLAG_REMASTER)) {
@@ -633,9 +637,9 @@
 		goto vote_success;
 	}
 
-	status = ocfs_send_dlm_request_msg (osb, lock_id, lock_type, 
-					    flags, &vote_map, 
-					    inode, 1, 
+	status = ocfs_send_dlm_request_msg (osb, lock_id, lock_type,
+					    flags, &vote_map,
+					    inode, 1,
 					    &vote_status);
 	if (status >= 0) {
 		status = vote_status;
@@ -681,7 +685,8 @@
 
 		/* want to refresh the lock from the latest on disk
 		 * state before writing it back out. */
-		status = ocfs_read_bh(osb, lock_id, &bh, 0, inode);
+		status = ocfs_read_bh(osb, lock_id << inode->i_sb->s_blocksize_bits,
+				      &bh, 0, inode);
 		if (!status)
 			ocfs_update_disk_lock(osb, bh, inode);
 
@@ -702,18 +707,6 @@
 	return status;
 }
 
-/* inode is definitely non NULL */
-static inline int ocfs_wait_for_readonly_drop(ocfs_super *osb, struct inode *inode)
-{
-	int status = 0;
-	ocfs_lock_res *lockres = GET_INODE_LOCKRES(inode);
-
-	if (ocfs_node_map_is_empty(&lockres->readonly_map))
-		return status;
-	status = ocfs_drop_readonly_cache_lock(osb, inode, 0);
-	return status;	
-}
-
 void ocfs_compute_dlm_stats(int status, int vote_status, ocfs_dlm_stats *stats)	
 {
 	atomic_inc (&stats->total);

Modified: branches/dlm-changes/src/file.c
===================================================================
--- branches/dlm-changes/src/file.c	2004-10-02 00:14:10 UTC (rev 1541)
+++ branches/dlm-changes/src/file.c	2004-10-02 01:01:24 UTC (rev 1542)
@@ -126,44 +126,35 @@
 {
 	int ret =0, err = 0, status = 0, first_open = 0;
 	int mode = file->f_flags;
-	ocfs_super *osb = NULL;
-	struct buffer_head *fe_bh = NULL;
+	ocfs_super *osb = OCFS_SB(inode->i_sb);
+	ocfs_inode_private *oip = OCFS_I(inode);
 
 	LOG_ENTRY_ARGS ("(0x%p, 0x%p, '%*s')\n", inode, file, 
 			file->f_dentry->d_name.len, 
 			file->f_dentry->d_name.name);
 
-	osb = OCFS_SB(inode->i_sb);
-
-#ifdef PURE_EVIL	
-	if (evil_filename_check(EVIL_FILE, file)) {
-		LOG_ERROR_ARGS("EVIL FOPEN: mode=%d\n", mode);
-	}
-#endif
-
 	if (osb->osb_flags & OCFS_OSB_FLAGS_SHUTDOWN) {
 		LOG_ERROR_STR ("Volume has been shutdown");
 		status = -EACCES;
 		goto leave;
 	}
 
-	if (atomic_read(&OCFS_I(inode)->ip_needs_verification)) {
-		down_read (&(OCFS_I(inode)->ip_io_sem));
+	if (atomic_read(&oip->ip_needs_verification)) {
+		down_read (&oip->ip_io_sem);
 		status = ocfs_verify_update_inode (osb, inode);
-		up_read (&(OCFS_I(inode)->ip_io_sem));
+		up_read(&oip->ip_io_sem);
 		if (status < 0) {
 			LOG_ERROR_STATUS (status);
 			goto leave;
 		}
 	}
 
-	down(&(OCFS_I(inode)->ip_sem));
-	if (!OCFS_I(inode)->ip_open_cnt) {
+	down(&oip->ip_sem);
+	if (!oip->ip_open_cnt++) {
 		first_open = 1;
-		OCFS_I(inode)->ip_open_flags |= OCFS_IN_FIRST_OPEN;
+		oip->ip_open_flags |= OCFS_IN_FIRST_OPEN;
 	}
-	OCFS_I(inode)->ip_open_cnt++;
-	up(&(OCFS_I(inode)->ip_sem));
+	up(&oip->ip_sem);
 
 	if (!first_open)
 		status = ocfs_wait_on_first_open(osb, inode);
@@ -171,8 +162,8 @@
 	if (status < 0) {
 		if (status != -EINTR)
 			LOG_ERROR_STATUS(status);
-		down(&(OCFS_I(inode)->ip_sem));
-		OCFS_I(inode)->ip_open_cnt--;
+		down(&oip->ip_sem);
+		oip->ip_open_cnt--;
 		goto leave_unlock;
 	}
 
@@ -185,37 +176,37 @@
 	    && (first_open || (mode & (O_WRONLY|O_RDWR))))
 		status = ocfs_notify_on_open(osb, inode);
 
-	down (&(OCFS_I(inode)->ip_sem));
+	down(&oip->ip_sem);
 	if (first_open) {
-		OCFS_I(inode)->ip_open_flags &= ~OCFS_IN_FIRST_OPEN;
+		oip->ip_open_flags &= ~OCFS_IN_FIRST_OPEN;
 		ocfs_notify_openers(osb);
 	}
 
 	if (status < 0) {
-		OCFS_I(inode)->ip_open_cnt--;
+		oip->ip_open_cnt--;
 		LOG_ERROR_STATUS(status);
 		goto leave_unlock;
 	}
 
-	if (OCFS_I(inode)->ip_open_cnt > 1) {
+	if (oip->ip_open_cnt > 1) {
 		/*  We're not the only person who has it open right
 		 *  now so lets check whether the requested
 		 *  access/share access conflicts with the existing
 		 *  open operations. */
 
 		LOG_TRACE_ARGS ("oin->ip_open_cnt > 0! : %u\n", 
-				OCFS_I(inode)->ip_open_cnt);
+				oip->ip_open_cnt);
 		if (!(mode & O_DIRECT)) {
-			if ((OCFS_I(inode)->ip_open_flags & OCFS_OIN_OPEN_FOR_DIRECTIO) && !(mode & O_RDONLY)) {
-				OCFS_I(inode)->ip_open_cnt--;
+			if ((oip->ip_open_flags & OCFS_OIN_OPEN_FOR_DIRECTIO) && !(mode & O_RDONLY)) {
+				oip->ip_open_cnt--;
 				status = -EACCES;
 				LOG_TRACE_STR("file is already open O_DIRECT, "
 						"cannot open non O_DIRECT");
 				goto leave_unlock;
 			}
 		} else if (mode & O_DIRECT) {
-			if (!(OCFS_I(inode)->ip_open_flags & OCFS_OIN_OPEN_FOR_DIRECTIO)) {
-				OCFS_I(inode)->ip_open_cnt--;
+			if (!(oip->ip_open_flags & OCFS_OIN_OPEN_FOR_DIRECTIO)) {
+				oip->ip_open_cnt--;
 				status = -EACCES;
 				LOG_TRACE_STR("file is already open non "  \
 					      "O_DIRECT, cannot open "     \
@@ -226,18 +217,14 @@
 		status = 0;
 	} else {
 		if (mode & O_DIRECT)
-			OCFS_SET_FLAG(OCFS_I(inode)->ip_open_flags, OCFS_OIN_OPEN_FOR_DIRECTIO);
+			OCFS_SET_FLAG(oip->ip_open_flags, OCFS_OIN_OPEN_FOR_DIRECTIO);
 		else
-			OCFS_CLEAR_FLAG(OCFS_I(inode)->ip_open_flags, OCFS_OIN_OPEN_FOR_DIRECTIO);
+			OCFS_CLEAR_FLAG(oip->ip_open_flags, OCFS_OIN_OPEN_FOR_DIRECTIO);
 	}
 
 leave_unlock:
-	up (&(OCFS_I(inode)->ip_sem));
+	up(&oip->ip_sem);
 leave:
-
-	if (fe_bh)
-		brelse(fe_bh);
-
 	if (status < 0) {
 		if (status != -ENOENT && status != -ENOMEM &&
 			status != -EACCES && status != -EINTR) {
@@ -812,12 +799,14 @@
 	.release = ocfs_file_release,
 	.open = ocfs_file_open,
 	.ioctl = ocfs_ioctl,
+#if defined(AIO_ENABLED) || defined(AIO_26_ENABLED)
+	.aio_read = generic_file_aio_read,
+	.aio_write = generic_file_aio_write,
 #ifdef AIO_ENABLED
 	.kvec_read = ocfs_kvec_read,
 	.kvec_write = ocfs_kvec_write,
-	.aio_read = generic_file_aio_read,
-	.aio_write = generic_file_aio_write,
 #endif
+#endif
 };
 
 struct file_operations ocfs_dops = {

Modified: branches/dlm-changes/src/lockres.c
===================================================================
--- branches/dlm-changes/src/lockres.c	2004-10-02 00:14:10 UTC (rev 1541)
+++ branches/dlm-changes/src/lockres.c	2004-10-02 01:01:24 UTC (rev 1542)
@@ -67,8 +67,7 @@
 	ocfs_lock_res *lockres = GET_INODE_LOCKRES(inode);
 
 	LOG_ENTRY_ARGS("(0x%p, %llu, 0x%p, 0x%p)\n", osb,
-		       OCFS_I(inode)->ip_blkno << inode->i_sb->s_blocksize_bits,
-		       lockres, bh);
+		       OCFS_I(inode)->ip_blkno, lockres, bh);
 
 	/* hey, you can't do that!  ;) */
 	if ((!bh) && !reread)

Modified: branches/dlm-changes/src/namei.c
===================================================================
--- branches/dlm-changes/src/namei.c	2004-10-02 00:14:10 UTC (rev 1541)
+++ branches/dlm-changes/src/namei.c	2004-10-02 01:01:24 UTC (rev 1542)
@@ -979,8 +979,8 @@
 
 	OCFS_ASSERT(handle);
 
-	id1 = OCFS_I(inode1)->ip_blkno << inode1->i_sb->s_blocksize_bits;
-	id2 = OCFS_I(inode2)->ip_blkno << inode2->i_sb->s_blocksize_bits;
+	id1 = OCFS_I(inode1)->ip_blkno;
+	id2 = OCFS_I(inode2)->ip_blkno;
 
 	if (*bh1)
 		*bh1 = NULL;

Modified: branches/dlm-changes/src/nm.c
===================================================================
--- branches/dlm-changes/src/nm.c	2004-10-02 00:14:10 UTC (rev 1541)
+++ branches/dlm-changes/src/nm.c	2004-10-02 01:01:24 UTC (rev 1542)
@@ -195,7 +195,7 @@
 	OCFS_ASSERT(inode);
 	OCFS_ASSERT(lockres);
 
-	lockid = OCFS_I(inode)->ip_blkno << inode->i_sb->s_blocksize_bits;
+	lockid = OCFS_I(inode)->ip_blkno;
 
 	*change_master = 0;
 	*write_lock = 0;
@@ -501,15 +501,13 @@
 	vote_response = FLAG_VOTE_UPDATE_RETRY;
 
 	if (flags & FLAG_TRUNCATE_PAGES) {
-		inode = ocfs_ilookup(osb, 
-				lock_id >> osb->sb->s_blocksize_bits);
+		inode = ocfs_ilookup(osb, lock_id);
 		if(!inode) {
 			vote_type = TRUNCATE_PAGES;
 			goto got_vote_type;
 		}
 	} else {
-		inode = ocfs_iget(osb, 
-				lock_id >> osb->sb->s_blocksize_bits);
+		inode = ocfs_iget(osb, lock_id);
 	}
 
 	if (!inode) {
@@ -541,7 +539,7 @@
 
 	if (status < 0) {
 		LOG_TRACE_ARGS("Timedout locking lockres for id: %llu\n",
-			       OCFS_I(inode)->ip_blkno << inode->i_sb->s_blocksize_bits);
+			       OCFS_I(inode)->ip_blkno);
 		goto vote;
 	} else
 		lockres_lock_held = (write_lock ? WRITE_LOCK : READ_LOCK);
@@ -728,8 +726,7 @@
 	/* requestor will need to retry if anyone is using the lockres */
 	if (lockres->lock_holders > 0) {
 		LOG_TRACE_PROCESS_VOTE("Lock id (%llu) has %u holders\n",
-		       OCFS_I(inode)->ip_blkno << inode->i_sb->s_blocksize_bits,
-		       lockres->lock_holders);
+		       OCFS_I(inode)->ip_blkno, lockres->lock_holders);
 		// kick the commit thread
 		atomic_set(&osb->flush_event_woken, 1);
 		wake_up(&osb->flush_event);
@@ -795,8 +792,8 @@
 		BUG();
 	}
 
-	*status = ocfs_read_bh(osb, lock_id, &fe_bh, OCFS_BH_CACHED, 
-			      inode);
+	*status = ocfs_read_bh(osb, (lock_id << osb->sb->s_blocksize_bits),
+			       &fe_bh, OCFS_BH_CACHED, inode);
 	if (*status < 0) {
 		LOG_ERROR_STATUS ((*status));
 		return *status;

Modified: branches/dlm-changes/src/ocfs.h
===================================================================
--- branches/dlm-changes/src/ocfs.h	2004-10-02 00:14:10 UTC (rev 1541)
+++ branches/dlm-changes/src/ocfs.h	2004-10-02 01:01:24 UTC (rev 1542)
@@ -591,6 +591,7 @@
 	int s_clustersize;
 	int s_clustersize_bits;
 	int needs_flush;
+	struct proc_dir_entry *proc_sub_dir; /* points to /proc/fs/ocfs2/<maj_min> */
 
 	ocfs_alloc_bm cluster_bitmap;
 	atomic_t vol_state;
@@ -662,6 +663,7 @@
 	__u64 comm_seq_num;		/* local node seq num used in ipcdlm */
 	ocfs_dlm_stats net_reqst_stats;	/* stats of netdlm vote requests */
 	ocfs_dlm_stats net_reply_stats;	/* stats of netdlm vote reponses */
+	struct proc_dir_entry *proc_root_dir; /* points to /proc/fs/ocfs2 */
 }
 ocfs_global_ctxt;
 

Modified: branches/dlm-changes/src/proc.c
===================================================================
--- branches/dlm-changes/src/proc.c	2004-10-02 00:14:10 UTC (rev 1541)
+++ branches/dlm-changes/src/proc.c	2004-10-02 01:01:24 UTC (rev 1542)
@@ -48,50 +48,69 @@
 /* Tracing */
 #define OCFS_DEBUG_CONTEXT      OCFS_DEBUG_CONTEXT_PROC
 
-#define OCFS2_PROC_BASENAME "fs/ocfs2"
+#define OCFS2_PROC_BASENAME	"fs/ocfs2"
 
 static int ocfs_proc_globalctxt(char *page, char **start, off_t off, int count, int *eof, void *data);
 static int ocfs_proc_dlm_stats(char *page, char **start, off_t off, int count, int *eof, void *data);
 static int ocfs_proc_version (char *page, char **start, off_t off, int count, int *eof, void *data);
+static int ocfs_proc_nodenum (char *page, char **start, off_t off, int count, int *eof, void *data);
 static int ocfs_proc_nodename (char *page, char **start, off_t off, int count, int *eof, void *data);
 static int ocfs_proc_mountpoint (char *page, char **start, off_t off, int count, int *eof, void *data);
 static int ocfs_proc_statistics (char *page, char **start, off_t off, int count, int *eof, void *data);
 static int ocfs_proc_device (char *page, char **start, off_t off, int count, int *eof, void *data);
 static int ocfs_proc_nodes (char *page, char **start, off_t off, int count, int *eof, void *data);
 static int ocfs_proc_net_vote_obj (char *page, char **start, off_t off, int count, int *eof, void *data);
-static int ocfs_proc_alloc_stat(char *page, char **start, off_t off,
-				int count, int *eof, void *data);
+static int ocfs_proc_alloc_stat(char *page, char **start, off_t off, int count, int *eof, void *data);
+static int ocfs_proc_guid (char *page, char **start, off_t off, int count, int *eof, void *data);
+static int ocfs_proc_label (char *page, char **start, off_t off, int count, int *eof, void *data);
 
+typedef struct _ocfs_proc_list
+{
+	char *name;
+	char *data;
+	int (*read_proc) (char *, char **, off_t, int, int *, void *);
+} ocfs_proc_list;
+
+ocfs_proc_list top_dir[] = {
+	{ "version", NULL, ocfs_proc_version },
+	{ "nodename", NULL, ocfs_proc_nodename },
+	{ "globalctxt", NULL, ocfs_proc_globalctxt },
+	{ "lockstat", NULL, ocfs_proc_dlm_stats },
+	{ NULL } };
+
+ocfs_proc_list sub_dir[] = {
+	{ "nodenum", NULL, ocfs_proc_nodenum },
+	{ "mountpoint", NULL, ocfs_proc_mountpoint },
+	{ "statistics", NULL, ocfs_proc_statistics },
+	{ "lockstat", NULL, ocfs_proc_dlm_stats },
+	{ "device", NULL, ocfs_proc_device },
+	{ "nodes", NULL, ocfs_proc_nodes },
+	{ "sent-votes", NULL, ocfs_proc_net_vote_obj },
+	{ "allocstat", NULL, ocfs_proc_alloc_stat },
+	{ "guid", NULL, ocfs_proc_guid },
+	{ "label", NULL, ocfs_proc_label },
+	{ NULL } };
+
 /*
  * ocfs_proc_init()
  *
  */
 int ocfs_proc_init (void)
 {
-	static struct
-	{
-		char *name;
-		char *data;
-		int (*read_proc) (char *, char **, off_t, int, int *, void *);
-	}
-	*p, ProcList[] =
-	{
-		{ OCFS2_PROC_BASENAME "/version", NULL, ocfs_proc_version },
-		{ OCFS2_PROC_BASENAME "/nodename", NULL, ocfs_proc_nodename },
-		{ OCFS2_PROC_BASENAME "/globalctxt", NULL, ocfs_proc_globalctxt },
-		{ OCFS2_PROC_BASENAME "/lockstat", NULL, ocfs_proc_dlm_stats },
-		{ NULL, }
-	};
+	struct proc_dir_entry *parent = NULL;
+	ocfs_proc_list *p;
 
 	LOG_ENTRY ();
 
-	proc_mkdir (OCFS2_PROC_BASENAME, 0);
+	parent = proc_mkdir (OCFS2_PROC_BASENAME, 0);
+	if (parent) {
+		OcfsGlobalCtxt.proc_root_dir = parent;
+		for (p = top_dir; p->name; p++)
+			create_proc_read_entry (p->name, 0, parent,
+						p->read_proc, p->data);
+	}
 
-	for (p = ProcList; p->name; p++)
-		create_proc_read_entry (p->name, 0, NULL, p->read_proc,
-					p->data);
-
-	LOG_EXIT_INT (0);
+	LOG_EXIT ();
 	return 0;
 }				/* ocfs_proc_init */
 
@@ -101,16 +120,19 @@
  */
 void ocfs_proc_deinit (void)
 {
+	struct proc_dir_entry *parent = OcfsGlobalCtxt.proc_root_dir;
+	ocfs_proc_list *p;
+
 	LOG_ENTRY ();
 
-	remove_proc_entry (OCFS2_PROC_BASENAME "/version", NULL);
-	remove_proc_entry (OCFS2_PROC_BASENAME "/nodename", NULL);
-	remove_proc_entry (OCFS2_PROC_BASENAME "/globalctxt", NULL);
-	remove_proc_entry (OCFS2_PROC_BASENAME "/lockstat", NULL);
-	remove_proc_entry (OCFS2_PROC_BASENAME, NULL);
+	if (parent) {
+		for (p = top_dir; p->name; p++)
+			remove_proc_entry (p->name, parent);
+		remove_proc_entry (OCFS2_PROC_BASENAME, 0);
+	}
 
 	LOG_EXIT ();
-	return;
+	return ;
 }				/* ocfs_proc_deinit */
 
 /*
@@ -332,71 +354,31 @@
 	return ret;
 }				/* ocfs_proc_nodename */
 
-typedef struct _ocfs_proc_list
-{
-	char *name;
-	char *data;
-	int (*read_proc) (char *, char **, off_t, int, int *, void *);
-} ocfs_proc_list;
-
-static ocfs_proc_list ProcList[] =
-{
-	{ "nodenum", NULL, ocfs_proc_nodenum },
-	{ "mountpoint", NULL, ocfs_proc_mountpoint },
-	{ "statistics", NULL, ocfs_proc_statistics },
-	{ "lockstat", NULL, ocfs_proc_dlm_stats },
-	{ "device", NULL, ocfs_proc_device },
-	{ "nodes", NULL, ocfs_proc_nodes },
-	{ "sent-votes", NULL, ocfs_proc_net_vote_obj },
-	{ "allocstat", NULL, ocfs_proc_alloc_stat }, 
-	{ NULL, }
-};
-
 /*
  * ocfs_proc_add_volume()
  *
  */
 void ocfs_proc_add_volume (ocfs_super * osb)
 {
-	char *newdir = NULL;
-	char *tmp = NULL;
+	char newdir[20];
+	struct proc_dir_entry *parent = NULL;
 	ocfs_proc_list *p;
 
 	LOG_ENTRY ();
 
-	newdir = ocfs_malloc (32);
-	tmp = ocfs_malloc (100);
-	if (!newdir || !tmp) {
-		LOG_ERROR_STATUS (-ENOMEM);
-		goto bail;
-	}
+	snprintf (newdir, sizeof(newdir), "%u_%u", MAJOR(osb->sb->s_dev),
+		  MINOR(osb->sb->s_dev));
+	parent = proc_mkdir (newdir, OcfsGlobalCtxt.proc_root_dir);
+	osb->proc_sub_dir = parent;
 
-	ProcList[0].data = (char *) osb;
-#warning fix proc mountpoint
-	ProcList[1].data = "unknown";
-	ProcList[2].data = (char *) osb;
-	ProcList[3].data = (char *) osb;
-	ProcList[4].data = (char *) osb;
-	ProcList[5].data = (char *) osb;
-	ProcList[6].data = (char *) osb;
-	ProcList[7].data = (char *) osb;
-	ProcList[8].data = (char *) osb;
-
-	sprintf (newdir, OCFS2_PROC_BASENAME "/%-d", osb->osb_id);
-	proc_mkdir (newdir, 0);
-
-	for (p = ProcList; p->name; p++) {
-		sprintf (tmp, "%s/%s", newdir, p->name);
-		create_proc_read_entry (tmp, 0, NULL, p->read_proc, p->data);
+	if (parent) {
+		for (p = sub_dir; p->name; p++)
+			create_proc_read_entry (p->name, 0, parent,
+						p->read_proc, (char *)osb);
 	}
 
-bail:
-	if (tmp)
-    		kfree(tmp);
-	if (newdir)
-    		kfree(newdir);
 	LOG_EXIT ();
-	return;
+	return ;
 }				/* ocfs_proc_add_volume */
 
 /*
@@ -405,28 +387,20 @@
  */
 void ocfs_proc_remove_volume (ocfs_super * osb)
 {
-	char *tmp = NULL;
 	ocfs_proc_list *p;
+	char dir[20];
 
 	LOG_ENTRY ();
 
-	tmp = ocfs_malloc (100);
-	if (!tmp) {
-		LOG_ERROR_STATUS (-ENOMEM);
-		goto bail;
+	if (osb->proc_sub_dir) {
+		for (p = sub_dir; p->name; p++)
+			remove_proc_entry (p->name, osb->proc_sub_dir);
+
+		snprintf (dir, sizeof(dir), "%u_%u", MAJOR(osb->sb->s_dev),
+			  MINOR(osb->sb->s_dev));
+		remove_proc_entry (dir, OcfsGlobalCtxt.proc_root_dir);
 	}
-	
-	for (p = ProcList; p->name; p++) {
-		sprintf (tmp, OCFS2_PROC_BASENAME "/%-d/%s", osb->osb_id, p->name);
-		remove_proc_entry (tmp, NULL);
-	}
 
-	sprintf (tmp, OCFS2_PROC_BASENAME "/%-d", osb->osb_id);
-	remove_proc_entry (tmp, NULL);
-
-bail:
-	if (tmp)
-		kfree(tmp);
 	LOG_EXIT ();
 	return;
 }				/* ocfs_proc_remove_volume */
@@ -443,9 +417,7 @@
 
 	LOG_ENTRY ();
 
-	strcpy (page, data);
-	strcat (page, "\n");
-	len = strlen (page);
+	len = sprintf (page, "%s\n", "unknown");
 
 	ret = ocfs_proc_calc_metrics (page, start, off, count, eof, len);
 
@@ -607,3 +579,56 @@
 	return ret;
 }				/* ocfs_proc_net_vote_obj */
 
+/*
+ * ocfs_proc_guid()
+ *
+ */
+static int ocfs_proc_guid (char *page, char **start, off_t off,
+			   int count, int *eof, void *data)
+{
+	int len;
+	int ret;
+	ocfs_super *osb;
+	char *p;
+	int i;
+
+	LOG_ENTRY ();
+
+	osb = (ocfs_super *) data;
+
+	for (i = 0, p = page; i < MAX_VOL_ID_LENGTH; i++, p += 2)
+		sprintf(p, "%02X", osb->uuid[i]);
+	*p = '\n'; ++p; *p = '\0';
+
+	len = strlen (page);
+
+	ret = ocfs_proc_calc_metrics (page, start, off, count, eof, len);
+
+	LOG_EXIT_INT (ret);
+	return ret;
+}				/* ocfs_proc_guid */
+
+
+/*
+ * ocfs_proc_label()
+ *
+ */
+static int ocfs_proc_label (char *page, char **start, off_t off,
+			    int count, int *eof, void *data)
+{
+	int len;
+	int ret;
+	ocfs_super *osb;
+
+	LOG_ENTRY ();
+
+	osb = (ocfs_super *) data;
+
+	len = sprintf (page, "%s\n", osb->vol_label);
+
+	ret = ocfs_proc_calc_metrics (page, start, off, count, eof, len);
+
+	LOG_EXIT_INT (ret);
+	return ret;
+}				/* ocfs_proc_label */
+

Modified: branches/dlm-changes/src/vote.c
===================================================================
--- branches/dlm-changes/src/vote.c	2004-10-02 00:14:10 UTC (rev 1541)
+++ branches/dlm-changes/src/vote.c	2004-10-02 01:01:24 UTC (rev 1542)
@@ -1040,7 +1040,7 @@
 {
 	int bit;
 	OCFS_ASSERT(map->num_nodes > 0);
-       	bit = find_first_bit(map->map, map->num_nodes);
+	bit = find_next_bit(map->map, map->num_nodes, 0);
 	if (bit < map->num_nodes)
 		return 0;
 	return 1;



More information about the Ocfs2-commits mailing list