Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / llite / dir.c
index 4366c86..2549009 100644 (file)
@@ -221,7 +221,7 @@ static struct page *ll_dir_page_locate(struct inode *dir, __u64 hash,
          * radix_tree_gang_lookup() can be used to find a page with starting
          * hash _smaller_ than one we are looking for.
          */
-        unsigned long offset = hash_x_index((__u32)hash);
+        unsigned long offset = hash_x_index((unsigned long)hash);
         struct page *page;
         int found;
 
@@ -307,7 +307,8 @@ struct page *ll_get_dir_page(struct inode *dir, __u64 hash, int exact,
         } else {
                 /* for cross-ref object, l_ast_data of the lock may not be set,
                  * we reset it here */
-                md_set_lock_data(ll_i2sbi(dir)->ll_md_exp, &lockh.cookie, dir);
+                md_set_lock_data(ll_i2sbi(dir)->ll_md_exp, &lockh.cookie,
+                                 dir, NULL);
         }
         ldlm_lock_dump_handle(D_OTHER, &lockh);
 
@@ -345,7 +346,7 @@ struct page *ll_get_dir_page(struct inode *dir, __u64 hash, int exact,
                 }
         }
 
-        page = read_cache_page(mapping, hash_x_index((__u32)hash),
+        page = read_cache_page(mapping, hash_x_index((unsigned long)hash),
                                (filler_t*)mapping->a_ops->readpage, NULL);
         if (IS_ERR(page))
                 GOTO(out_unlock, page);
@@ -394,6 +395,7 @@ int ll_readdir(struct file *filp, void *cookie, filldir_t filldir)
         int rc;
         int done;
         int shift;
+        __u16 type;
         ENTRY;
 
         CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p) pos %lu/%llu\n",
@@ -419,7 +421,7 @@ int ll_readdir(struct file *filp, void *cookie, filldir_t filldir)
 
                 if (!IS_ERR(page)) {
                         /*
-                         * If page is empty (end of directoryis reached),
+                         * If page is empty (end of directory is reached),
                          * use this value.
                          */
                         __u64 hash = DIR_END_OFF;
@@ -457,9 +459,9 @@ int ll_readdir(struct file *filp, void *cookie, filldir_t filldir)
                                 name = ent->lde_name;
                                 fid_le_to_cpu(&fid, &fid);
                                 ino  = ll_fid_build_ino(sbi, &fid);
-
+                                type = ll_dirent_type_get(ent);
                                 done = filldir(cookie, name, namelen,
-                                               (loff_t)hash, ino, DT_UNKNOWN);
+                                               (loff_t)hash, ino, type);
                         }
                         next = le64_to_cpu(dp->ldp_hash_end);
                         ll_put_page(page);
@@ -491,7 +493,7 @@ int ll_readdir(struct file *filp, void *cookie, filldir_t filldir)
                 }
         }
 
-        filp->f_pos = (loff_t)(__s32)pos;
+        filp->f_pos = (loff_t)pos;
         filp->f_version = inode->i_version;
         touch_atime(filp->f_vfsmnt, filp->f_dentry);
 
@@ -1147,7 +1149,7 @@ static int ll_dir_ioctl(struct inode *inode, struct file *file,
                         QCTL_COPY(oqctl, qctl);
                         rc = obd_quotactl(sbi->ll_md_exp, oqctl);
                         if (rc) {
-                                if (rc != -EBUSY && cmd == Q_QUOTAON) {
+                                if (rc != -EALREADY && cmd == Q_QUOTAON) {
                                         oqctl->qc_cmd = Q_QUOTAOFF;
                                         obd_quotactl(sbi->ll_md_exp, oqctl);
                                 }
@@ -1214,6 +1216,30 @@ static int ll_dir_ioctl(struct inode *inode, struct file *file,
 
                 RETURN(0);
         }
+        case LL_IOC_PATH2FID:
+                if (copy_to_user((void *)arg, &ll_i2info(inode)->lli_fid,
+                                 sizeof(struct lu_fid)))
+                        RETURN(-EFAULT);
+                RETURN(0);
+        case OBD_IOC_CHANGELOG_CLEAR: {
+                struct ioc_changelog_clear *icc;
+                int rc;
+
+                OBD_ALLOC_PTR(icc);
+                if (icc == NULL)
+                        RETURN(-ENOMEM);
+                if (copy_from_user(icc, (void *)arg, sizeof(*icc)))
+                        GOTO(icc_free, rc = -EFAULT);
+
+                rc = obd_iocontrol(cmd, sbi->ll_md_exp, sizeof(*icc), icc,NULL);
+
+icc_free:
+                OBD_FREE_PTR(icc);
+                RETURN(rc);
+        }
+        case OBD_IOC_FID2PATH:
+                RETURN(ll_fid2path(ll_i2mdexp(inode), (void *)arg));
+
         default:
                 RETURN(obd_iocontrol(cmd, sbi->ll_dt_exp,0,NULL,(void *)arg));
         }