[Ocfs2-commits] khackel commits r1454 - trunk/src
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Fri Sep 10 17:09:03 CDT 2004
Author: khackel
Date: 2004-09-10 17:09:02 -0500 (Fri, 10 Sep 2004)
New Revision: 1454
Modified:
trunk/src/dir.c
trunk/src/dlm.h
trunk/src/journal.c
Log:
prepping for future readonly locking change
Modified: trunk/src/dir.c
===================================================================
--- trunk/src/dir.c 2004-09-10 21:35:22 UTC (rev 1453)
+++ trunk/src/dir.c 2004-09-10 22:09:02 UTC (rev 1454)
@@ -73,7 +73,6 @@
unsigned long offset, blk;
int i, num, stored;
struct buffer_head * bh, * tmp;
- struct buffer_head * lockbh = NULL;
struct ocfs2_dir_entry * de;
int err;
struct inode *inode = filp->f_dentry->d_inode;
@@ -92,13 +91,8 @@
* acquire_lock call. We should investigate whether taking a
* read lock is such a bad idea in this case... */
down_write(&OCFS_I(inode)->ip_io_sem);
-
- error = ocfs_acquire_lock(osb, OCFS_LKM_EXMODE,
- FLAG_READONLY, &lockbh, inode);
- if (lockbh) {
- brelse(lockbh);
- lockbh = NULL;
- }
+
+ error = ocfs_acquire_lock_ro(osb, inode);
if (error < 0) {
if (error != -EINTR)
LOG_ERROR_STATUS (error);
@@ -206,8 +200,7 @@
bail:
if (have_disk_lock) {
- error = ocfs_release_lock (osb, OCFS_LKM_EXMODE,
- FLAG_READONLY, inode);
+ error = ocfs_release_lock_ro (osb, inode);
if (error < 0)
LOG_ERROR_STATUS (error);
}
@@ -233,16 +226,13 @@
int status = -ENOENT;
int tmpstat;
int lock_acq = 0;
- struct buffer_head *bh = NULL;
LOG_ENTRY_ARGS ("(osb=%p, parent=%llu, name='%*s', blkno=%p, inode=%p)\n",
osb, OCFS_I(inode)->ip_blkno, namelen, name, blkno, inode);
if (take_lock) {
/* Get a lock on the directory... */
- status = ocfs_acquire_lock (osb, OCFS_LKM_EXMODE,
- FLAG_READONLY,
- &bh, inode);
+ status = ocfs_acquire_lock_ro (osb, inode);
if (status < 0) {
/* Volume should be disabled in this case */
if (status != -EINTR)
@@ -265,16 +255,13 @@
if (take_lock && lock_acq)
{
- tmpstat = ocfs_release_lock (osb, OCFS_LKM_EXMODE,
- FLAG_READONLY, inode);
+ tmpstat = ocfs_release_lock_ro (osb, inode);
if (tmpstat < 0) {
LOG_ERROR_STATUS (tmpstat);
/* Volume should be disabled in this case */
}
}
- if (bh != NULL)
- brelse(bh);
if (status < 0) {
*dirent = NULL;
if (*dirent_bh) {
Modified: trunk/src/dlm.h
===================================================================
--- trunk/src/dlm.h 2004-09-10 21:35:22 UTC (rev 1453)
+++ trunk/src/dlm.h 2004-09-10 22:09:02 UTC (rev 1454)
@@ -41,6 +41,20 @@
ocfs_release_lock_full(osb, lock_type, flags, inode, 1)
int ocfs_release_lock_full(ocfs_super *osb, __u32 lock_type,
__u32 flags, struct inode *inode, __u32 num_ident);
+
+#define ocfs_acquire_lock_ro(osb, inode) \
+({ \
+ int status; \
+ struct buffer_head *junkbh = NULL;\
+ status = ocfs_acquire_lock(osb, OCFS_LKM_EXMODE, FLAG_READONLY, &junkbh, inode);\
+ if (junkbh) \
+ brelse(junkbh);\
+ (status); \
+ })
+
+#define ocfs_release_lock_ro(osb, inode) ocfs_release_lock(osb, OCFS_LKM_EXMODE, FLAG_READONLY, inode)
+
+
void ocfs_get_publish_vote_map(ocfs_super *osb, ocfs_publish *publish,
ocfs_node_map *vote_map);
int ocfs_notify_cluster(ocfs_super *osb,
Modified: trunk/src/journal.c
===================================================================
--- trunk/src/journal.c 2004-09-10 21:35:22 UTC (rev 1453)
+++ trunk/src/journal.c 2004-09-10 22:09:02 UTC (rev 1454)
@@ -1670,7 +1670,6 @@
struct inode *orphan_dir_inode = NULL;
unsigned long offset, blk, local;
struct buffer_head *bh = NULL;
- struct buffer_head *lockbh = NULL;
struct ocfs2_dir_entry *de;
struct super_block *sb = osb->sb;
@@ -1686,15 +1685,7 @@
}
down_write(&OCFS_I(orphan_dir_inode)->ip_io_sem);
- status = ocfs_acquire_lock(osb,
- OCFS_LKM_EXMODE,
- FLAG_READONLY,
- &lockbh,
- orphan_dir_inode);
- if (lockbh) {
- brelse(lockbh);
- lockbh = NULL;
- }
+ status = ocfs_acquire_lock_ro(osb, orphan_dir_inode);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto bail;
@@ -1764,8 +1755,7 @@
brelse(bh);
}
- status = ocfs_release_lock (osb, OCFS_LKM_EXMODE,
- FLAG_READONLY, orphan_dir_inode);
+ status = ocfs_release_lock_ro(osb, orphan_dir_inode);
have_disk_lock = 0;
if (status < 0) {
LOG_ERROR_STATUS(status);
@@ -1786,9 +1776,7 @@
up(&osb->orphan_recovery_lock);
if (have_disk_lock) {
- tmpstat = ocfs_release_lock (osb, OCFS_LKM_EXMODE,
- FLAG_READONLY,
- orphan_dir_inode);
+ tmpstat = ocfs_release_lock_ro(osb, orphan_dir_inode);
if (tmpstat < 0)
LOG_ERROR_STATUS(tmpstat);
}
More information about the Ocfs2-commits
mailing list