Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
- merge with 1_5,some fixes.
[fs/lustre-release.git]
/
lustre
/
mdt
/
mdt_lib.c
diff --git
a/lustre/mdt/mdt_lib.c
b/lustre/mdt/mdt_lib.c
index
a7254c4
..
6f53189
100644
(file)
--- a/
lustre/mdt/mdt_lib.c
+++ b/
lustre/mdt/mdt_lib.c
@@
-46,46
+46,42
@@
void mdt_dump_lmm(int level, struct lov_mds_md *lmm)
{
struct lov_ost_data_v1 *lod;
int i;
+ __s16 stripe_count =
+ le16_to_cpu(((struct lov_user_md*)lmm)->lmm_stripe_count);
- CDEBUG
_EX
(level, "objid "LPX64", magic 0x%08X, pattern %#X\n",
+ CDEBUG(level, "objid "LPX64", magic 0x%08X, pattern %#X\n",
le64_to_cpu(lmm->lmm_object_id), le32_to_cpu(lmm->lmm_magic),
le32_to_cpu(lmm->lmm_pattern));
- CDEBUG
_EX(level,"stripe_size %u, stripe_count %u
\n",
+ CDEBUG
(level,"stripe_size=0x%x, stripe_count=0x%x
\n",
le32_to_cpu(lmm->lmm_stripe_size),
le32_to_cpu(lmm->lmm_stripe_count));
-
for (i = 0, lod = lmm->lmm_objects
;
- i < le32_to_cpu(lmm->lmm_stripe_count); i++, lod++)
- CDEBUG
_EX
(level, "stripe %u idx %u subobj "LPX64"/"LPX64"\n",
+
LASSERT(stripe_count < (__s16)LOV_MAX_STRIPE_COUNT)
;
+ for (i = 0, lod = lmm->lmm_objects; i < stripe_count; i++, lod++) {
+ CDEBUG(level, "stripe %u idx %u subobj "LPX64"/"LPX64"\n",
i, le32_to_cpu(lod->l_ost_idx),
le64_to_cpu(lod->l_object_gr),
le64_to_cpu(lod->l_object_id));
+ }
}
-void mdt_shrink_reply(struct mdt_thread_info *info)
+void mdt_shrink_reply(struct mdt_thread_info *info
, int offset
)
{
struct ptlrpc_request *req = mdt_info_req(info);
struct mdt_body *body;
- struct lov_mds_md *lmm;
- int cookie_size = 0;
+ int acl_size = 0;
int md_size = 0;
body = req_capsule_server_get(&info->mti_pill, &RMF_MDT_BODY);
+ LASSERT(body != NULL);
- if (body && body->valid & OBD_MD_FLEASIZE) {
- md_size = body->eadatasize;
- }
- if (body && body->valid & OBD_MD_FLCOOKIE) {
- LASSERT(body->valid & OBD_MD_FLEASIZE);
- lmm = req_capsule_server_get(&info->mti_pill, &RMF_MDT_MD);
- cookie_size = le32_to_cpu(lmm->lmm_stripe_count) *
- sizeof(struct llog_cookie);
- }
+ md_size = body->eadatasize;
+ acl_size = body->aclsize;
CDEBUG(D_INFO, "Shrink to md_size %d cookie_size %d \n",
- md_size,
cookie
_size);
+ md_size,
acl
_size);
- lustre_shrink_reply(req,
1
, md_size, 1);
- lustre_shrink_reply(req, md_size
? 2:1, cookie
_size, 0);
+ lustre_shrink_reply(req,
offset
, md_size, 1);
+ lustre_shrink_reply(req, md_size
? offset + 1: offset, acl
_size, 0);
}
@@
-98,34
+94,73
@@
int mdt_handle_last_unlink(struct mdt_thread_info *info, struct mdt_object *mo,
const struct lu_attr *la = &ma->ma_attr;
ENTRY;
+ repbody = req_capsule_server_get(&info->mti_pill, &RMF_MDT_BODY);
- /* if this is the last unlinked object reference,
- * so client should destroy ost objects*/
- if (S_ISREG(la->la_mode) &&
- la->la_nlink == 0 && mo->mot_header.loh_ref == 1) {
+ if (ma->ma_valid & MA_INODE)
+ mdt_pack_attr2body(repbody, la, mdt_object_fid(mo));
- CDEBUG(D_INODE, "Last reference is released on "DFID"\n",
-
PFID(mdt_object_fid(mo)))
;
+ if (ma->ma_valid & MA_LOV) {
+
__u32 mode
;
- CDEBUG(D_INODE, "ma_valid = "LPX64"\n", ma->ma_valid);
- repbody = req_capsule_server_get(&info->mti_pill,
- &RMF_MDT_BODY);
- if (ma->ma_valid & MA_INODE)
- mdt_pack_attr2body(repbody, la, mdt_object_fid(mo));
- if (/*ma->ma_lmm_size && */(ma->ma_valid & MA_LOV)) {
- LASSERT(ma->ma_lmm_size);
- mdt_dump_lmm(D_INFO, ma->ma_lmm);
- repbody->eadatasize = ma->ma_lmm_size;
+ mode = lu_object_attr(&mo->mot_obj.mo_lu);
+ LASSERT(ma->ma_lmm_size);
+ mdt_dump_lmm(D_INFO, ma->ma_lmm);
+ repbody->eadatasize = ma->ma_lmm_size;
+ if (S_ISREG(mode))
repbody->valid |= OBD_MD_FLEASIZE;
- }
+ else if (S_ISDIR(mode))
+ repbody->valid |= OBD_MD_FLDIREA;
+ else
+ LBUG();
+ }
- if (ma->ma_cookie_size && (ma->ma_valid & MA_COOKIE))
- repbody->valid |= OBD_MD_FLCOOKIE;
+ if (ma->ma_cookie_size && (ma->ma_valid & MA_COOKIE)) {
+ repbody->aclsize = ma->ma_cookie_size;
+ repbody->valid |= OBD_MD_FLCOOKIE;
}
RETURN(0);
}
+static __u64 mdt_attr_valid_xlate(__u64 in, struct mdt_reint_record *rr,
+ struct md_attr *ma)
+{
+ __u64 out;
+
+ out = 0;
+ if (in & ATTR_MODE)
+ out |= LA_MODE;
+ if (in & ATTR_UID)
+ out |= LA_UID;
+ if (in & ATTR_GID)
+ out |= LA_GID;
+ if (in & ATTR_SIZE)
+ out |= LA_SIZE;
+
+ if (in & ATTR_FROM_OPEN)
+ rr->rr_flags |= MRF_SETATTR_LOCKED;
+
+ if (in & ATTR_ATIME_SET)
+ out |= LA_ATIME;
+
+ if (in & ATTR_CTIME_SET)
+ out |= LA_CTIME;
+
+ if (in & ATTR_MTIME_SET)
+ out |= LA_MTIME;
+
+ if (in & ATTR_ATTR_FLAG)
+ out |= LA_FLAGS;
+
+ /*XXX need ATTR_RAW?*/
+ in &= ~(ATTR_MODE|ATTR_UID|ATTR_GID|ATTR_SIZE|
+ ATTR_ATIME|ATTR_MTIME|ATTR_CTIME|ATTR_FROM_OPEN|
+ ATTR_ATIME_SET|ATTR_CTIME_SET|ATTR_MTIME_SET|
+ ATTR_ATTR_FLAG|ATTR_RAW);
+ if (in != 0)
+ CERROR("Unknown attr bits: %#llx\n", in);
+ return out;
+}
/* unpacking */
static int mdt_setattr_unpack(struct mdt_thread_info *info)
{
@@
-142,12
+177,12
@@
static int mdt_setattr_unpack(struct mdt_thread_info *info)
RETURN(-EFAULT);
rr->rr_fid1 = &rec->sa_fid;
- la->la_valid =
rec->sa_valid
;
+ la->la_valid =
mdt_attr_valid_xlate(rec->sa_valid, rr, ma)
;
la->la_mode = rec->sa_mode;
+ la->la_flags = rec->sa_attr_flags;
la->la_uid = rec->sa_uid;
la->la_gid = rec->sa_gid;
la->la_size = rec->sa_size;
- la->la_flags = rec->sa_attr_flags;
la->la_ctime = rec->sa_ctime;
la->la_atime = rec->sa_atime;
la->la_mtime = rec->sa_mtime;
@@
-191,6
+226,8
@@
static int mdt_create_unpack(struct mdt_thread_info *info)
attr->la_ctime = rec->cr_time;
attr->la_mtime = rec->cr_time;
attr->la_atime = rec->cr_time;
+ attr->la_valid = LA_MODE | LA_RDEV | LA_UID | LA_GID |
+ LA_CTIME | LA_MTIME | LA_ATIME;
info->mti_spec.sp_cr_flags = rec->cr_flags;
rr->rr_name = req_capsule_client_get(pill, &RMF_NAME);
@@
-227,7
+264,7
@@
static int mdt_link_unpack(struct mdt_thread_info *info)
rr->rr_fid2 = &rec->lk_fid2;
attr->la_ctime = rec->lk_time;
attr->la_mtime = rec->lk_time;
-
+ attr->la_valid = LA_UID | LA_GID | LA_CTIME | LA_MTIME;
rr->rr_name = req_capsule_client_get(pill, &RMF_NAME);
if (rr->rr_name == NULL)
result = -EFAULT;
@@
-255,6
+292,7
@@
static int mdt_unlink_unpack(struct mdt_thread_info *info)
attr->la_mtime = rec->ul_time;
attr->la_mode = rec->ul_mode;
+ attr->la_valid = LA_UID | LA_GID | LA_CTIME | LA_MTIME | LA_MODE;
rr->rr_name = req_capsule_client_get(pill, &RMF_NAME);
if (rr->rr_name == NULL)
result = -EFAULT;
@@
-280,7
+318,7
@@
static int mdt_rename_unpack(struct mdt_thread_info *info)
rr->rr_fid2 = &rec->rn_fid2;
attr->la_ctime = rec->rn_time;
attr->la_mtime = rec->rn_time;
-
+ attr->la_valid = LA_UID | LA_GID | LA_CTIME | LA_MTIME;
rr->rr_name = req_capsule_client_get(pill, &RMF_NAME);
rr->rr_tgt = req_capsule_client_get(pill, &RMF_SYMTGT);
if (rr->rr_name == NULL || rr->rr_tgt == NULL)
@@
-310,6
+348,8
@@
static int mdt_open_unpack(struct mdt_thread_info *info)
attr->la_ctime = rec->cr_time;
attr->la_mtime = rec->cr_time;
attr->la_atime = rec->cr_time;
+ attr->la_valid = LA_MODE | LA_RDEV | LA_UID | LA_GID | LA_CTIME
+ | LA_MTIME | LA_ATIME;
info->mti_spec.sp_cr_flags = rec->cr_flags;
rr->rr_name = req_capsule_client_get(pill, &RMF_NAME);
if (rr->rr_name == NULL)