Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / liblustre / dir.c
index 8498d80..0f2bc90 100644 (file)
 #include <fcntl.h>
 #include <sys/queue.h>
 
+#include <sysio.h>
 #ifdef HAVE_XTIO_H
 #include <xtio.h>
 #endif
-#include <sysio.h>
 #include <fs.h>
 #include <mount.h>
 #include <inode.h>
@@ -74,24 +74,21 @@ static int llu_dir_do_readpage(struct inode *inode, struct page *page)
         struct mdt_body *body;
         struct lookup_intent it = { .it_op = IT_READDIR };
         struct md_op_data op_data;
-        struct obd_device *obddev = class_exp2obd(sbi->ll_md_exp);
-        struct ldlm_res_id res_id =
-                { .name = {fid_seq(&lli->lli_fid), 
-                           fid_oid(&lli->lli_fid), 
-                           fid_ver(&lli->lli_fid)} };
         ldlm_policy_data_t policy = { .l_inodebits = { MDS_INODELOCK_UPDATE } };
         ENTRY;
 
-        rc = ldlm_lock_match(obddev->obd_namespace, LDLM_FL_BLOCK_GRANTED,
-                             &res_id, LDLM_IBITS, &policy, LCK_CR, &lockh);
+        rc = md_lock_match(sbi->ll_md_exp, LDLM_FL_BLOCK_GRANTED,
+                           &lli->lli_fid, LDLM_IBITS, &policy, LCK_CR, &lockh);
         if (!rc) {
+                struct ldlm_enqueue_info einfo = {LDLM_IBITS, LCK_CR,
+                        llu_md_blocking_ast, ldlm_completion_ast, NULL, inode};
+
                 llu_prep_md_op_data(&op_data, inode, NULL, NULL, 0, 0,
                                     LUSTRE_OPC_ANY);
 
-                rc = md_enqueue(sbi->ll_md_exp, LDLM_IBITS, &it, LCK_CR,
+                rc = md_enqueue(sbi->ll_md_exp, &einfo, &it,
                                 &op_data, &lockh, NULL, 0,
-                                ldlm_completion_ast, llu_md_blocking_ast,
-                                inode, LDLM_FL_CANCEL_ON_BLOCK);
+                                LDLM_FL_CANCEL_ON_BLOCK);
                 request = (struct ptlrpc_request *)it.d.lustre.it_data;
                 if (request)
                         ptlrpc_req_finished(request);
@@ -110,7 +107,7 @@ static int llu_dir_do_readpage(struct inode *inode, struct page *page)
                                       sizeof(*body));
                 LASSERT(body != NULL);         /* checked by md_readpage() */
                 /* swabbed by md_readpage() */
-                LASSERT_REPSWABBED(request, REPLY_REC_OFF);
+                LASSERT(lustre_rep_swabbed(request, REPLY_REC_OFF));
 
                 st->st_size = body->size;
         } else {
@@ -129,7 +126,7 @@ static struct page *llu_dir_read_page(struct inode *ino, unsigned long pgidx)
         int rc;
         ENTRY;
 
-        page = alloc_page(0);
+        page = cfs_alloc_page(0);
         if (!page) {
                 CERROR("alloc page failed\n");
                 RETURN(ERR_PTR(-ENOMEM));