Whamcloud - gitweb
fix liblustre build. use OBD_BRW macros instead of linux specific.
authorshadow <shadow>
Sat, 24 May 2008 08:52:17 +0000 (08:52 +0000)
committershadow <shadow>
Sat, 24 May 2008 08:52:17 +0000 (08:52 +0000)
b=14010
i=green

lustre/ldlm/ldlm_lock.c
lustre/llite/file.c

index b510df6..f76d547 100644 (file)
@@ -34,7 +34,6 @@
 # include <libcfs/kp30.h>
 #endif
 
-#include <linux/fs.h>
 #include <obd_class.h>
 #include "ldlm_internal.h"
 
@@ -992,12 +991,13 @@ int ldlm_lock_fast_match(struct ldlm_lock *lock, int rw,
                                 loff_t start, loff_t end,
                                 void **cookie)
 {
-        LASSERT(rw == READ || rw == WRITE);
+        LASSERT(rw == OBD_BRW_READ || rw == OBD_BRW_WRITE);
         /* should LCK_GROUP be handled in a special way? */
-        if (lock && (rw == READ || (lock->l_granted_mode & (LCK_PW|LCK_GROUP))) &&
+        if (lock && (rw == OBD_BRW_READ ||
+                     (lock->l_granted_mode & (LCK_PW|LCK_GROUP))) &&
             (lock->l_policy_data.l_extent.start <= start) &&
             (lock->l_policy_data.l_extent.end >= end)) {
-                ldlm_lock_addref_internal(lock, rw == WRITE ? LCK_PW : LCK_PR);
+                ldlm_lock_addref_internal(lock, rw == OBD_BRW_WRITE ? LCK_PW : LCK_PR);
                 *cookie = (void *)lock;
                 return 1; /* avoid using rc for stack relief */
         }
@@ -1009,9 +1009,9 @@ void ldlm_lock_fast_release(void *cookie, int rw)
         struct ldlm_lock *lock = (struct ldlm_lock *)cookie;
 
         LASSERT(lock != NULL);
-        LASSERT(rw == READ || rw == WRITE);
-        LASSERT(rw == READ || (lock->l_granted_mode & (LCK_PW | LCK_GROUP)));
-        ldlm_lock_decref_internal(lock, rw == WRITE ? LCK_PW : LCK_PR);
+        LASSERT(rw == OBD_BRW_READ || rw == OBD_BRW_WRITE);
+        LASSERT(rw == OBD_BRW_READ || (lock->l_granted_mode & (LCK_PW | LCK_GROUP)));
+        ldlm_lock_decref_internal(lock, rw == OBD_BRW_WRITE ? LCK_PW : LCK_PR);
 }
 
 /* Can be called in two ways:
index 4366c7c..4c42e52 100644 (file)
@@ -1179,7 +1179,7 @@ static int ll_file_get_tree_lock_iov(struct ll_lock_tree *tree,
                 if (file->f_flags & O_NONBLOCK)
                         ast_flags |= LDLM_FL_BLOCK_NOWAIT;
                 node = ll_node_from_inode(inode, start, end,
-                                          (rw == WRITE) ? LCK_PW : LCK_PR);
+                                          (rw == OBD_BRW_WRITE) ? LCK_PW : LCK_PR);
                 if (IS_ERR(node)) {
                         rc = PTR_ERR(node);
                         GOTO(out, rc);
@@ -1502,7 +1502,7 @@ repeat:
         }
 
         lock_style = ll_file_get_lock(file, *ppos, end, iov_copy, nrsegs_copy,
-                                      &cookie, &tree, READ);
+                                      &cookie, &tree, OBD_BRW_READ);
         if (lock_style < 0)
                 GOTO(out, retval = lock_style);
 
@@ -1537,7 +1537,7 @@ repeat:
                 if (retval) {
                         if (lock_style != LL_LOCK_STYLE_NOLOCK)
                                 ll_file_put_lock(inode, end, lock_style,
-                                                 cookie, &tree, READ);
+                                                 cookie, &tree, OBD_BRW_READ);
                         goto out;
                 }
         } else {
@@ -1579,7 +1579,7 @@ repeat:
                 retval = generic_file_aio_read(iocb, iov_copy, nrsegs_copy,
                                                *ppos);
 #endif
-                ll_file_put_lock(inode, end, lock_style, cookie, &tree, READ);
+                ll_file_put_lock(inode, end, lock_style, cookie, &tree, OBD_BRW_READ);
         } else {
                 retval = ll_file_lockless_io(file, iov_copy, nrsegs_copy, ppos,
                                              READ, chunk);
@@ -1722,7 +1722,7 @@ repeat:
 
         tree_locked = ll_file_get_tree_lock_iov(&tree, file, iov_copy,
                                                 nrsegs_copy, lock_start,
-                                                lock_end, WRITE);
+                                                lock_end, OBD_BRW_WRITE);
         if (tree_locked < 0)
                 GOTO(out, retval = tree_locked);