Commit 5dd16419 authored by Jinshan Xiong's avatar Jinshan Xiong Committed by Greg Kroah-Hartman
Browse files

staging/lustre/layout: introduce new layout for released files

Released files now have a standard layout (with generation, pool, ...)
and a stripe count 0 and lmm_pattern flag LOV_PATTERN_F_RELEASED.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2482
Lustre-change: http://review.whamcloud.com/4816


Signed-off-by: default avatarJinshan Xiong <jinshan.xiong@intel.com>
Signed-off-by: default avatarJohann Lombardi <johann.lombardi@intel.com>
Reviewed-by: default avatarKeith Mannthey <keith.mannthey@intel.com>
Reviewed-by: default avatarFan Yong <fan.yong@intel.com>
Reviewed-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Signed-off-by: default avatarPeng Tao <tao.peng@emc.com>
Signed-off-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b62b9c06
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -1551,6 +1551,12 @@ enum obdo_flags {
#define LOV_PATTERN_FIRST	0x100   /* first stripe is not in round-robin */
#define LOV_PATTERN_CMOBD	0x200

#define LOV_PATTERN_F_MASK	0xffff0000
#define LOV_PATTERN_F_RELEASED	0x80000000 /* HSM released file */

#define lov_pattern(pattern)		(pattern & ~LOV_PATTERN_F_MASK)
#define lov_pattern_flags(pattern)	(pattern & LOV_PATTERN_F_MASK)

#define lov_ost_data lov_ost_data_v1
struct lov_ost_data_v1 {	  /* per-stripe data structure (little-endian)*/
	struct ost_id l_ost_oi;	  /* OST object ID */
+14 −0
Original line number Diff line number Diff line
@@ -119,6 +119,20 @@ struct lov_stripe_md {
#define lsm_stripe_count lsm_wire.lw_stripe_count
#define lsm_pool_name    lsm_wire.lw_pool_name

static inline bool lsm_is_released(struct lov_stripe_md *lsm)
{
	return !!(lsm->lsm_pattern & LOV_PATTERN_F_RELEASED);
}

static inline bool lsm_has_objects(struct lov_stripe_md *lsm)
{
	if (lsm == NULL)
		return false;
	if (lsm_is_released(lsm))
		return false;
	return true;
}

struct obd_info;

typedef int (*obd_enqueue_update_f)(void *cookie, int rc);
+1 −1
Original line number Diff line number Diff line
@@ -1166,7 +1166,7 @@ int cl_file_inode_init(struct inode *inode, struct lustre_md *md)
			 * locked by I_NEW bit.
			 */
			lli->lli_clob = clob;
			lli->lli_has_smd = md->lsm != NULL;
			lli->lli_has_smd = lsm_has_objects(md->lsm);
			lu_object_ref_add(&clob->co_lu, "inode", inode);
		} else
			result = PTR_ERR(clob);
+16 −11
Original line number Diff line number Diff line
@@ -1143,7 +1143,7 @@ static int ll_lov_recreate(struct inode *inode, struct ost_id *oi,
		RETURN(-ENOMEM);

	lsm = ccc_inode_lsm_get(inode);
	if (lsm == NULL)
	if (!lsm_has_objects(lsm))
		GOTO(out, rc = -ENOENT);

	lsm_size = sizeof(*lsm) + (sizeof(struct lov_oinfo) *
@@ -1299,6 +1299,12 @@ int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename,
	 * passing it to userspace.
	 */
	if (LOV_MAGIC != cpu_to_le32(LOV_MAGIC)) {
		int stripe_count;

		stripe_count = le16_to_cpu(lmm->lmm_stripe_count);
		if (le32_to_cpu(lmm->lmm_pattern) & LOV_PATTERN_F_RELEASED)
			stripe_count = 0;

		/* if function called for directory - we should
		 * avoid swab not existent lsm objects */
		if (lmm->lmm_magic == cpu_to_le32(LOV_MAGIC_V1)) {
@@ -1306,13 +1312,13 @@ int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename,
			if (S_ISREG(body->mode))
				lustre_swab_lov_user_md_objects(
				 ((struct lov_user_md_v1 *)lmm)->lmm_objects,
				 ((struct lov_user_md_v1 *)lmm)->lmm_stripe_count);
				 stripe_count);
		} else if (lmm->lmm_magic == cpu_to_le32(LOV_MAGIC_V3)) {
			lustre_swab_lov_user_md_v3((struct lov_user_md_v3 *)lmm);
			if (S_ISREG(body->mode))
				lustre_swab_lov_user_md_objects(
				 ((struct lov_user_md_v3 *)lmm)->lmm_objects,
				 ((struct lov_user_md_v3 *)lmm)->lmm_stripe_count);
				 stripe_count);
		}
	}

@@ -1698,20 +1704,18 @@ int ll_data_version(struct inode *inode, __u64 *data_version,

	/* If no stripe, we consider version is 0. */
	lsm = ccc_inode_lsm_get(inode);
	if (lsm == NULL) {
	if (!lsm_has_objects(lsm)) {
		*data_version = 0;
		CDEBUG(D_INODE, "No object for inode\n");
		RETURN(0);
		GOTO(out, rc = 0);
	}

	OBD_ALLOC_PTR(obdo);
	if (obdo == NULL) {
		ccc_inode_lsm_put(inode, lsm);
		RETURN(-ENOMEM);
	}
	if (obdo == NULL)
		GOTO(out, rc = -ENOMEM);

	rc = ll_lsm_getattr(lsm, sbi->ll_dt_exp, NULL, obdo, 0, extent_lock);
	if (!rc) {
	if (rc == 0) {
		if (!(obdo->o_valid & OBD_MD_FLDATAVERSION))
			rc = -EOPNOTSUPP;
		else
@@ -1719,8 +1723,9 @@ int ll_data_version(struct inode *inode, __u64 *data_version,
	}

	OBD_FREE_PTR(obdo);
	EXIT;
out:
	ccc_inode_lsm_put(inode, lsm);

	RETURN(rc);
}

+13 −9
Original line number Diff line number Diff line
@@ -1282,13 +1282,6 @@ int ll_md_setattr(struct dentry *dentry, struct md_op_data *op_data,
		RETURN(rc);
	}

	ia_valid = op_data->op_attr.ia_valid;
	/* inode size will be in ll_setattr_ost, can't do it now since dirty
	 * cache is not cleared yet. */
	op_data->op_attr.ia_valid &= ~(TIMES_SET_FLAGS | ATTR_SIZE);
	rc = simple_setattr(dentry, &op_data->op_attr);
	op_data->op_attr.ia_valid = ia_valid;

	/* Extract epoch data if obtained. */
	op_data->op_handle = md.body->handle;
	op_data->op_ioepoch = md.body->ioepoch;
@@ -1371,6 +1364,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr)
	struct ll_inode_info *lli = ll_i2info(inode);
	struct md_op_data *op_data = NULL;
	struct md_open_data *mod = NULL;
	unsigned int valid = attr->ia_valid;
	int rc = 0, rc1 = 0;
	ENTRY;

@@ -1482,6 +1476,13 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr)
		rc = ll_setattr_ost(inode, attr);
	EXIT;
out:
	if (rc == 0) {
		/* Update inode attribute after dirty cache is cleaned
		 * by truncating OST objects. */
		attr->ia_valid |= ATTR_FORCE;
		rc = simple_setattr(dentry, attr);
		LASSERT(rc == 0);
	}
	if (op_data) {
		if (op_data->op_ioepoch) {
			rc1 = ll_setattr_done_writing(inode, op_data, mod);
@@ -1500,7 +1501,8 @@ out:
	ll_stats_ops_tally(ll_i2sbi(inode), (attr->ia_valid & ATTR_SIZE) ?
			LPROC_LL_TRUNC : LPROC_LL_SETATTR, 1);

	return rc;
	attr->ia_valid = valid;
	RETURN(rc);
}

int ll_setattr(struct dentry *de, struct iattr *attr)
@@ -1923,8 +1925,10 @@ int ll_iocontrol(struct inode *inode, struct file *file,
		inode->i_flags = ll_ext_to_inode_flags(flags);

		lsm = ccc_inode_lsm_get(inode);
		if (lsm == NULL)
		if (!lsm_has_objects(lsm)) {
			ccc_inode_lsm_put(inode, lsm);
			RETURN(0);
		}

		OBDO_ALLOC(oinfo.oi_oa);
		if (!oinfo.oi_oa) {
Loading