[Ocfs2-commits] jlbec commits r2401 - trunk/fs/ocfs2
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Thu Jun 16 23:04:36 CDT 2005
Author: jlbec
Signed-off-by: mfasheh
Date: 2005-06-16 23:04:34 -0500 (Thu, 16 Jun 2005)
New Revision: 2401
Added:
trunk/fs/ocfs2/ocfs2_lockid.h
Modified:
trunk/fs/ocfs2/Makefile
trunk/fs/ocfs2/dlmglue.c
trunk/fs/ocfs2/inode.c
trunk/fs/ocfs2/ocfs2.h
Log:
o Create ocfs2_lockid.h to share lock id formatting.
Signed-off-by: mfasheh
Modified: trunk/fs/ocfs2/Makefile
===================================================================
--- trunk/fs/ocfs2/Makefile 2005-06-17 01:53:52 UTC (rev 2400)
+++ trunk/fs/ocfs2/Makefile 2005-06-17 04:04:34 UTC (rev 2401)
@@ -64,6 +64,7 @@
HEADERS = \
ocfs2_fs.h \
ocfs1_fs_compat.h \
+ ocfs2_lockid.h \
ocfs2.h \
buffer_head_io.h \
aio.h \
Modified: trunk/fs/ocfs2/dlmglue.c
===================================================================
--- trunk/fs/ocfs2/dlmglue.c 2005-06-17 01:53:52 UTC (rev 2400)
+++ trunk/fs/ocfs2/dlmglue.c 2005-06-17 04:04:34 UTC (rev 2401)
@@ -54,24 +54,8 @@
#include "buffer_head_io.h"
-/* lock ids are made up in the following manner:
- * name[0] --> type
- * name[1-6] --> 6 pad characters, reserved for now
- * name[7-22] --> block number, expressed in hex as 16 chars
- * name[23-30] --> i_generation, expressed in hex 8 chars
- * name[31] --> '\0' */
-#define OCFS2_LOCK_ID_MAX_LEN 32
-#define OCFS2_LOCK_ID_PAD "000000"
-
static spinlock_t clean_buffer_lock = SPIN_LOCK_UNLOCKED;
-static char ocfs2_lock_type_char[OCFS2_NUM_LOCK_TYPES] = {
- [OCFS2_TYPE_META] = 'M',
- [OCFS2_TYPE_DATA] = 'D',
- [OCFS2_TYPE_SUPER] = 'S',
- [OCFS2_TYPE_RENAME] = 'R'
-};
-
static int ocfs2_build_lock_name(enum ocfs2_lock_type type,
u64 blkno,
u32 generation,
@@ -144,18 +128,18 @@
static inline int ocfs2_is_inode_lock(struct ocfs2_lock_res *lockres)
{
- return lockres->l_type == OCFS2_TYPE_META ||
- lockres->l_type == OCFS2_TYPE_DATA;
+ return lockres->l_type == OCFS2_LOCK_TYPE_META ||
+ lockres->l_type == OCFS2_LOCK_TYPE_DATA;
}
static inline int ocfs2_is_super_lock(struct ocfs2_lock_res *lockres)
{
- return lockres->l_type == OCFS2_TYPE_SUPER;
+ return lockres->l_type == OCFS2_LOCK_TYPE_SUPER;
}
static inline int ocfs2_is_rename_lock(struct ocfs2_lock_res *lockres)
{
- return lockres->l_type == OCFS2_TYPE_RENAME;
+ return lockres->l_type == OCFS2_LOCK_TYPE_RENAME;
}
static inline ocfs2_super *ocfs2_lock_res_super(struct ocfs2_lock_res *lockres)
@@ -278,7 +262,7 @@
mlog_entry_void();
- OCFS2_ASSERT(lockres->l_type == OCFS2_TYPE_META);
+ OCFS2_ASSERT(lockres->l_type == OCFS2_LOCK_TYPE_META);
spin_lock(&lockres->l_lock);
OCFS2_ASSERT(lockres->l_level > LKM_NLMODE);
@@ -311,7 +295,7 @@
}
len = snprintf(name, OCFS2_LOCK_ID_MAX_LEN, "%c%s%016"MLFx64"%08x",
- ocfs2_lock_type_char[type], OCFS2_LOCK_ID_PAD, blkno,
+ ocfs2_lock_type_char(type), OCFS2_LOCK_ID_PAD, blkno,
generation);
BUG_ON(len != (OCFS2_LOCK_ID_MAX_LEN - 1));
@@ -361,8 +345,8 @@
mlog_entry_void();
- OCFS2_ASSERT(type == OCFS2_TYPE_META ||
- type == OCFS2_TYPE_DATA);
+ OCFS2_ASSERT(type == OCFS2_LOCK_TYPE_META ||
+ type == OCFS2_LOCK_TYPE_DATA);
status = ocfs2_build_lock_name(type,
OCFS2_I(inode)->ip_blkno,
@@ -373,7 +357,7 @@
goto bail;
}
- if (type == OCFS2_TYPE_META)
+ if (type == OCFS2_LOCK_TYPE_META)
ops = &ocfs2_inode_meta_lops;
else
ops = &ocfs2_inode_data_lops;
@@ -388,7 +372,7 @@
int ocfs2_super_lock_res_init(struct ocfs2_lock_res *res,
ocfs2_super *osb)
{
- enum ocfs2_lock_type type = OCFS2_TYPE_SUPER;
+ enum ocfs2_lock_type type = OCFS2_LOCK_TYPE_SUPER;
int status;
mlog_entry_void();
@@ -416,7 +400,7 @@
int ocfs2_rename_lock_res_init(struct ocfs2_lock_res *res,
ocfs2_super *osb)
{
- enum ocfs2_lock_type type = OCFS2_TYPE_RENAME;
+ enum ocfs2_lock_type type = OCFS2_LOCK_TYPE_RENAME;
int status;
mlog_entry_void();
@@ -678,7 +662,7 @@
mlog(0, "AST fired for inode %"MLFu64", l_action = %u, type = %s\n",
OCFS2_I(inode)->ip_blkno, lockres->l_action,
- (lockres->l_type == OCFS2_TYPE_META) ? "Meta" : "Data");
+ (lockres->l_type == OCFS2_LOCK_TYPE_META) ? "Meta" : "Data");
OCFS2_ASSERT(ocfs2_is_inode_lock(lockres));
@@ -697,7 +681,7 @@
switch(lockres->l_action) {
case OCFS2_AST_ATTACH:
- if (lockres->l_type == OCFS2_TYPE_META &&
+ if (lockres->l_type == OCFS2_LOCK_TYPE_META &&
lockres->l_requested > LKM_NLMODE &&
!(lockres->l_flags & OCFS2_LOCK_LOCAL))
ocfs2_inc_inode_seq(osb, inode);
@@ -706,7 +690,7 @@
lockres_clear_flags(lockres, OCFS2_LOCK_LOCAL);
break;
case OCFS2_AST_CONVERT:
- if (lockres->l_type == OCFS2_TYPE_META)
+ if (lockres->l_type == OCFS2_LOCK_TYPE_META)
ocfs2_handle_meta_convert_action(inode, lockres);
else
ocfs2_generic_handle_convert_action(lockres);
@@ -724,7 +708,7 @@
}
/* data locking ignores refresh flag for now. */
- if (lockres->l_type == OCFS2_TYPE_DATA)
+ if (lockres->l_type == OCFS2_LOCK_TYPE_DATA)
lockres_clear_flags(lockres, OCFS2_LOCK_NEEDS_REFRESH);
/* set it to something invalid so if we get called again we
@@ -779,7 +763,7 @@
mlog(0, "BAST fired for inode %"MLFu64", blocking = %d, level = %d "
"type = %s\n", OCFS2_I(inode)->ip_blkno, level,
lockres->l_level,
- (lockres->l_type == OCFS2_TYPE_META) ? "Meta" : "Data");
+ (lockres->l_type == OCFS2_LOCK_TYPE_META) ? "Meta" : "Data");
OCFS2_ASSERT(level > LKM_NLMODE);
Modified: trunk/fs/ocfs2/inode.c
===================================================================
--- trunk/fs/ocfs2/inode.c 2005-06-17 01:53:52 UTC (rev 2400)
+++ trunk/fs/ocfs2/inode.c 2005-06-17 04:04:34 UTC (rev 2401)
@@ -304,13 +304,13 @@
}
status = ocfs2_inode_lock_res_init(&OCFS2_I(inode)->ip_meta_lockres,
- OCFS2_TYPE_META, inode);
+ OCFS2_LOCK_TYPE_META, inode);
if (status < 0) {
mlog_errno(status);
goto bail;
}
status = ocfs2_inode_lock_res_init(&OCFS2_I(inode)->ip_data_lockres,
- OCFS2_TYPE_DATA, inode);
+ OCFS2_LOCK_TYPE_DATA, inode);
if (status < 0)
mlog_errno(status);
bail:
@@ -561,6 +561,10 @@
if (!(fe->i_flags & OCFS2_ORPHANED_FL)) {
/* for lack of a better error? */
status = -EEXIST;
+ mlog(ML_ERROR,
+ "Inode %"MLFu64" (on-disk %"MLFu64") not orphaned!\n",
+ OCFS2_I(inode)->ip_blkno,
+ fe->i_blkno);
mlog_errno(status);
goto bail_unblock;
}
Modified: trunk/fs/ocfs2/ocfs2.h
===================================================================
--- trunk/fs/ocfs2/ocfs2.h 2005-06-17 01:53:52 UTC (rev 2400)
+++ trunk/fs/ocfs2/ocfs2.h 2005-06-17 04:04:34 UTC (rev 2401)
@@ -40,6 +40,7 @@
#include "dlm/dlmapi.h"
#include "ocfs2_fs.h"
+#include "ocfs2_lockid.h"
struct ocfs2_extent_map {
u32 em_clusters;
@@ -69,13 +70,6 @@
OCFS2_UNLOCK_DROP_LOCK,
};
-enum ocfs2_lock_type {
- OCFS2_TYPE_META = 0,
- OCFS2_TYPE_DATA,
- OCFS2_TYPE_SUPER,
- OCFS2_TYPE_RENAME,
- OCFS2_NUM_LOCK_TYPES
-};
/* ocfs2_lock_res->l_flags flags. */
#define OCFS2_LOCK_ATTACHED (0x00000001) /* have we initialized
Added: trunk/fs/ocfs2/ocfs2_lockid.h
===================================================================
--- trunk/fs/ocfs2/ocfs2_lockid.h 2005-06-17 01:53:52 UTC (rev 2400)
+++ trunk/fs/ocfs2/ocfs2_lockid.h 2005-06-17 04:04:34 UTC (rev 2401)
@@ -0,0 +1,69 @@
+/* -*- mode: c; c-basic-offset: 8; -*-
+ * vim: noexpandtab sw=8 ts=8 sts=0:
+ *
+ * ocfs2_lockid.h
+ *
+ * Defines OCFS2 lockid bits.
+ *
+ * Copyright (C) 2002, 2005 Oracle. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ */
+
+#ifndef OCFS2_LOCKID_H
+#define OCFS2_LOCKID_H
+
+/* lock ids are made up in the following manner:
+ * name[0] --> type
+ * name[1-6] --> 6 pad characters, reserved for now
+ * name[7-22] --> block number, expressed in hex as 16 chars
+ * name[23-30] --> i_generation, expressed in hex 8 chars
+ * name[31] --> '\0' */
+#define OCFS2_LOCK_ID_MAX_LEN 32
+#define OCFS2_LOCK_ID_PAD "000000"
+
+enum ocfs2_lock_type {
+ OCFS2_LOCK_TYPE_META = 0,
+ OCFS2_LOCK_TYPE_DATA,
+ OCFS2_LOCK_TYPE_SUPER,
+ OCFS2_LOCK_TYPE_RENAME,
+ OCFS2_NUM_LOCK_TYPES
+};
+
+static inline char ocfs2_lock_type_char(enum ocfs2_lock_type type)
+{
+ char c;
+ switch (type) {
+ case OCFS2_LOCK_TYPE_META:
+ c = 'M';
+ break;
+ case OCFS2_LOCK_TYPE_DATA:
+ c = 'D';
+ break;
+ case OCFS2_LOCK_TYPE_SUPER:
+ c = 'S';
+ break;
+ case OCFS2_LOCK_TYPE_RENAME:
+ c = 'R';
+
+ default:
+ c = '\0';
+ }
+
+ return c;
+}
+
+#endif /* OCFS2_LOCKID_H */
More information about the Ocfs2-commits
mailing list