@@ -452,32 +452,42 @@ static inline bool lmv_is_sane2(const struct lmv_mds_md_v1 *lmv)
static inline bool lmv_is_splitting(const struct lmv_mds_md_v1 *lmv)
{
- LASSERT(lmv_is_sane2(lmv));
+ if (!lmv_is_sane2(lmv))
+ return false;
+
return lmv_hash_is_splitting(cpu_to_le32(lmv->lmv_hash_type));
}
static inline bool lmv_is_merging(const struct lmv_mds_md_v1 *lmv)
{
- LASSERT(lmv_is_sane2(lmv));
+ if (!lmv_is_sane2(lmv))
+ return false;
+
return lmv_hash_is_merging(cpu_to_le32(lmv->lmv_hash_type));
}
static inline bool lmv_is_migrating(const struct lmv_mds_md_v1 *lmv)
{
- LASSERT(lmv_is_sane(lmv));
+ if (!lmv_is_sane(lmv))
+ return false;
+
return lmv_hash_is_migrating(cpu_to_le32(lmv->lmv_hash_type));
}
static inline bool lmv_is_restriping(const struct lmv_mds_md_v1 *lmv)
{
- LASSERT(lmv_is_sane2(lmv));
+ if (!lmv_is_sane2(lmv))
+ return false;
+
return lmv_hash_is_splitting(cpu_to_le32(lmv->lmv_hash_type)) ||
lmv_hash_is_merging(cpu_to_le32(lmv->lmv_hash_type));
}
static inline bool lmv_is_layout_changing(const struct lmv_mds_md_v1 *lmv)
{
- LASSERT(lmv_is_sane2(lmv));
+ if (!lmv_is_sane2(lmv))
+ return false;
+
return lmv_hash_is_splitting(cpu_to_le32(lmv->lmv_hash_type)) ||
lmv_hash_is_merging(cpu_to_le32(lmv->lmv_hash_type)) ||
lmv_hash_is_migrating(cpu_to_le32(lmv->lmv_hash_type));
@@ -48,6 +48,7 @@
#include <obd_support.h>
#include <obd_class.h>
+#include <uapi/linux/lustre/lustre_idl.h>
#include <uapi/linux/lustre/lustre_ioctl.h>
#include <lustre_lib.h>
#include <lustre_dlm.h>
@@ -174,28 +175,6 @@ void ll_release_page(struct inode *inode, struct page *page, bool remove)
put_page(page);
}
-/**
- * return IF_* type for given lu_dirent entry.
- * IF_* flag shld be converted to particular OS file type in
- * platform llite module.
- */
-static u16 ll_dirent_type_get(struct lu_dirent *ent)
-{
- u16 type = 0;
- struct luda_type *lt;
- int len = 0;
-
- if (le32_to_cpu(ent->lde_attrs) & LUDA_TYPE) {
- const unsigned int align = sizeof(struct luda_type) - 1;
-
- len = le16_to_cpu(ent->lde_namelen);
- len = (len + align) & ~align;
- lt = (void *)ent->lde_name + len;
- type = IFTODT(le16_to_cpu(lt->lt_type));
- }
- return type;
-}
-
int ll_dir_read(struct inode *inode, u64 *ppos, struct md_op_data *op_data,
struct dir_context *ctx)
{
@@ -246,7 +225,7 @@ int ll_dir_read(struct inode *inode, u64 *ppos, struct md_op_data *op_data,
lhash = hash;
fid_le_to_cpu(&fid, &ent->lde_fid);
ino = cl_fid_build_ino(&fid, is_api32);
- type = ll_dirent_type_get(ent);
+ type = IFTODT(lu_dirent_type_get(ent));
ctx->pos = lhash;
/* For 'll_nfs_get_name_filldir()', it will try
* to access the 'ent' through its 'lde_name',
@@ -492,6 +492,24 @@ static inline __kernel_size_t lu_dirent_calc_size(size_t namelen, __u16 attr)
return (size + 7) & ~7;
}
+static inline __u16 lu_dirent_type_get(struct lu_dirent *ent)
+{
+ __u16 type = 0;
+ struct luda_type *lt;
+ int len = 0;
+
+ if (__le32_to_cpu(ent->lde_attrs) & LUDA_TYPE) {
+ const unsigned int align = sizeof(struct luda_type) - 1;
+
+ len = __le16_to_cpu(ent->lde_namelen);
+ len = (len + align) & ~align;
+ lt = (void *)ent->lde_name + len;
+ type = __le16_to_cpu(lt->lt_type);
+ }
+
+ return type;
+}
+
#define MDS_DIR_END_OFF 0xfffffffffffffffeULL
/**