Whamcloud - gitweb
- support for raw lookup in mds_getattr_name()
authoralex <alex>
Tue, 29 Jun 2004 16:55:53 +0000 (16:55 +0000)
committeralex <alex>
Tue, 29 Jun 2004 16:55:53 +0000 (16:55 +0000)
- configure script sets HAVE_LOOKUP_RAW if kernel has the feature

lnet/archdep.m4
lustre/mds/handler.c
lustre/portals/archdep.m4

index cb6e0a2..95f5ebe 100644 (file)
@@ -545,6 +545,17 @@ if test x$enable_modules != xno ; then
        fi # BACKINGFS = ext3
 fi
 
+# ---------- check ->lookup_raw() support --------
+
+AC_MSG_CHECKING([if kernel supports ->lookup_raw()])
+HAVE_LOOKUP_RAW="`grep -c 'lookup_raw.*struct inode' $LINUX/include/linux/proc_fs.h`"
+if test "$HAVE_LOOKUP_RAW" != 0 ; then
+       AC_DEFINE(HAVE_LOOKUP_RAW, 1, [the kernel supports ->lookup_raw()])
+       AC_MSG_RESULT([yes])
+else
+       AC_MSG_RESULT([no])
+fi
+
 CPPFLAGS="-include \$(top_builddir)/include/config.h $CPPFLAGS"
 EXTRA_KCFLAGS="-include $PWD/include/config.h $EXTRA_KCFLAGS"
 AC_SUBST(EXTRA_KCFLAGS)
index c1ba5f1..3457863 100644 (file)
@@ -913,21 +913,32 @@ static int mds_getattr_name(int offset, struct ptlrpc_request *req,
                 goto fill_inode;
         }
         
+#if HAVE_LOOKUP_RAW
         /* FIXME: handle raw lookup */
-#if 0
         if (body->valid == OBD_MD_FLID) {
+                struct mds_obd *mds = &obd->u.mds;
                 struct mds_body *mds_reply;
                 int size = sizeof(*mds_reply);
+                struct inode *dir;
                 ino_t inum;
+                dparent = mds_fid2dentry(mds, &body->fid1, NULL);
+                if (IS_ERR(dparent)) {
+                        rc = PTR_ERR(dparent);
+                        GOTO(cleanup, rc);
+                }
+                LASSERT(dparent != NULL);
+                LASSERT(dparent->d_inode != NULL);
                 // The user requested ONLY the inode number, so do a raw lookup
                 rc = lustre_pack_reply(req, 1, &size, NULL);
                 if (rc) {
                         CERROR("out of memory\n");
+                        l_dput(dparent);
                         GOTO(cleanup, rc);
                 }
-
+                dir  = dparent->d_inode;
+                LASSERT(dir->i_op->lookup_raw != NULL);
                 rc = dir->i_op->lookup_raw(dir, name, namesize - 1, &inum);
-
+                l_dput(dparent);
                 mds_reply = lustre_msg_buf(req->rq_repmsg, offset,
                                            sizeof(*mds_reply));
                 mds_reply->fid1.id = inum;
index cb6e0a2..95f5ebe 100644 (file)
@@ -545,6 +545,17 @@ if test x$enable_modules != xno ; then
        fi # BACKINGFS = ext3
 fi
 
+# ---------- check ->lookup_raw() support --------
+
+AC_MSG_CHECKING([if kernel supports ->lookup_raw()])
+HAVE_LOOKUP_RAW="`grep -c 'lookup_raw.*struct inode' $LINUX/include/linux/proc_fs.h`"
+if test "$HAVE_LOOKUP_RAW" != 0 ; then
+       AC_DEFINE(HAVE_LOOKUP_RAW, 1, [the kernel supports ->lookup_raw()])
+       AC_MSG_RESULT([yes])
+else
+       AC_MSG_RESULT([no])
+fi
+
 CPPFLAGS="-include \$(top_builddir)/include/config.h $CPPFLAGS"
 EXTRA_KCFLAGS="-include $PWD/include/config.h $EXTRA_KCFLAGS"
 AC_SUBST(EXTRA_KCFLAGS)