Whamcloud - gitweb
LU-4669 lmv: remove unused lmv_adjust_dirpages()
[fs/lustre-release.git] / lustre / llite / dir.c
index bfc75ea..3fcaa6b 100644 (file)
  * After client receives reply, several pages will be integrated into dir page
  * in PAGE_CACHE_SIZE (if PAGE_CACHE_SIZE greater than LU_PAGE_SIZE), and the
  * lu_dirpage for this integrated page will be adjusted. See
- * lmv_adjust_dirpages().
+ * mdc_adjust_dirpages().
  *
  */
 struct page *ll_get_dir_page(struct inode *dir, struct md_op_data *op_data,
@@ -246,8 +246,14 @@ int ll_dir_read(struct inode *inode, __u64 *ppos, struct md_op_data *op_data,
                         * to access the 'ent' through its 'lde_name',
                         * so the parameter 'name' for 'filldir()' must
                         * be part of the 'ent'. */
+#ifdef HAVE_DIR_CONTEXT
+                       ctx->pos = lhash;
+                       done = !dir_emit(ctx, ent->lde_name, namelen, ino,
+                                        type);
+#else
                        done = filldir(cookie, ent->lde_name, namelen, lhash,
                                       ino, type);
+#endif
                }
 
                if (done) {
@@ -277,8 +283,11 @@ int ll_dir_read(struct inode *inode, __u64 *ppos, struct md_op_data *op_data,
                                               &chain);
                }
        }
-
+#ifdef HAVE_DIR_CONTEXT
+       ctx->pos = pos;
+#else
        *ppos = pos;
+#endif
        ll_dir_chain_fini(&chain);
        RETURN(rc);
 }
@@ -386,7 +395,7 @@ static int ll_send_mgc_param(struct obd_export *mgc, char *string)
         if (!msp)
                 return -ENOMEM;
 
-        strncpy(msp->mgs_param, string, MGS_PARAM_MAXLEN);
+       strlcpy(msp->mgs_param, string, sizeof(msp->mgs_param));
         rc = obd_set_info_async(NULL, mgc, sizeof(KEY_SET_INFO), KEY_SET_INFO,
                                 sizeof(struct mgs_send_param), msp, NULL);
         if (rc)
@@ -1645,7 +1654,7 @@ out_rmdir:
                RETURN(ll_fid2path(inode, (void *)arg));
        case LL_IOC_HSM_REQUEST: {
                struct hsm_user_request *hur;
-               int                      totalsize;
+               ssize_t                  totalsize;
 
                OBD_ALLOC_PTR(hur);
                if (hur == NULL)
@@ -1660,6 +1669,8 @@ out_rmdir:
                /* Compute the whole struct size */
                totalsize = hur_len(hur);
                OBD_FREE_PTR(hur);
+               if (totalsize < 0)
+                       RETURN(-E2BIG);
 
                /* Final size will be more than double totalsize */
                if (totalsize >= MDS_MAXREQSIZE / 3)