GOTO(out_free, sb = NULL);
}
- /* First the MDS since an LOV requires an the MDC connection
- to find its descriptor */
#if 0
err = connmgr_connect(ptlrpc_connmgr, sbi->ll_mds_conn);
if (err) {
}
sbi2mdc(sbi)->mdc_conn->c_level = LUSTRE_CONN_FULL;
- /* now the OST, which could be an LOV */
-
obd = class_uuid2obd(ost);
if (!obd) {
CERROR("OST %s: not setup or attached\n", ost);
- GOTO(out_free, sb = NULL);
+ GOTO(out_mdc, sb = NULL);
}
err = obd_connect(&sbi->ll_osc_conn, obd);
if (err) {
CERROR("cannot connect to %s: rc = %d\n", ost, err);
- GOTO(out_free, sb = NULL);
+ GOTO(out_mdc, sb = NULL);
}
/* XXX: need to store the last_* values somewhere */
- err = mdc_getstatus(&sbi->ll_mdc_conn,
- &rootfid, &last_committed,
- &last_rcvd, &last_xid,
- &request);
+ err = mdc_getstatus(&sbi->ll_mdc_conn, &rootfid, &last_committed,
+ &last_rcvd, &last_xid, &request);
if (err) {
CERROR("cannot mds_connect: rc = %d\n", err);
- GOTO(out_disc, sb = NULL);
+ GOTO(out_request, sb = NULL);
}
CDEBUG(D_SUPER, "rootfid %Ld\n", (unsigned long long)rootfid.id);
sbi->ll_rootino = rootfid.id;
sb->s_blocksize_bits = log2(sfs.f_bsize);
sb->s_magic = LL_SUPER_MAGIC;
sb->s_maxbytes = (1ULL << (32 + 9)) - sfs.f_bsize;
+ ptlrpc_req_finished(request);
sb->s_op = &ll_super_operations;
/* make root inode */
- err = mdc_getattr(&sbi->ll_mdc_conn,
- sbi->ll_rootino, S_IFDIR, OBD_MD_FLNOTOBD|OBD_MD_FLBLOCKS, 0, &request);
+ err = mdc_getattr(&sbi->ll_mdc_conn, sbi->ll_rootino, S_IFDIR,
+ OBD_MD_FLNOTOBD|OBD_MD_FLBLOCKS, 0, &request);
if (err) {
CERROR("mdc_getattr failed for root: rc = %d\n", err);
- GOTO(out_mdc, sb = NULL);
+ GOTO(out_request, sb = NULL);
}
/* initialize committed transaction callback daemon */
- spin_lock_init(&sbi->ll_commitcbd_lock);
+ spin_lock_init(&sbi->ll_commitcbd_lock);
init_waitqueue_head(&sbi->ll_commitcbd_waitq);
init_waitqueue_head(&sbi->ll_commitcbd_ctl_waitq);
sbi->ll_commitcbd_flags = 0;
err = ll_commitcbd_setup(sbi);
if (err) {
CERROR("failed to start commit callback daemon: rc = %d\n",err);
- GOTO(out_mdc, sb = NULL);
+ GOTO(out_request, sb = NULL);
}
md.body = lustre_msg_buf(request->rq_repmsg, 0);
- md.obdo = NULL;
+ md.md = NULL;
root = iget4(sb, sbi->ll_rootino, NULL, &md);
-
+
if (root) {
sb->s_root = d_alloc_root(root);
} else {
out_cdb:
ll_commitcbd_cleanup(sbi);
-out_mdc:
- obd_disconnect(&sbi->ll_mdc_conn);
- obd_disconnect(&sbi->ll_osc_conn);
-out_disc:
+out_request:
ptlrpc_free_req(request);
obd_disconnect(&sbi->ll_osc_conn);
+out_mdc:
+ obd_disconnect(&sbi->ll_mdc_conn);
out_free:
OBD_FREE(sbi, sizeof(*sbi));
static void ll_clear_inode(struct inode *inode)
{
if (atomic_read(&inode->i_count) == 0) {
- struct obdo *oa = ll_i2info(inode)->lli_obdo;
- if (oa) {
- obdo_free(oa);
- ll_i2info(inode)->lli_obdo = NULL;
+ struct lov_stripe_md *md = ll_i2info(inode)->lli_smd;
+ if (md) {
+ OBD_FREE(md, md->lmd_size);
+ ll_i2info(inode)->lli_smd = NULL;
}
if (ll_i2info(inode)->lli_symlink_name) {
OBD_FREE(ll_i2info(inode)->lli_symlink_name,
{
if (S_ISREG(inode->i_mode)) {
int err;
- struct obdo *oa;
- oa = ll_i2info(inode)->lli_obdo;
-
- if (!oa)
+ struct obdo oa;
+ struct lov_stripe_md *md = ll_i2info(inode)->lli_smd;
+
+ if (!md)
GOTO(out, -EINVAL);
- if (oa->o_id == 0)
+ oa.o_id = md->lmd_object_id;
+ oa.o_easize = md->lmd_size;
+ if (oa.o_id == 0) {
+ CERROR("This really happens\n");
/* No obdo was ever created */
GOTO(out, 0);
+ }
- err = obd_destroy(ll_i2obdconn(inode), oa);
- CDEBUG(D_INODE, "obd destroy of %Ld error %d\n",
- (unsigned long long)oa->o_id, err);
+ err = obd_destroy(ll_i2obdconn(inode), &oa, md);
+ CDEBUG(D_SUPER, "obd destroy of %Ld error %d\n",
+ md->lmd_object_id, err);
}
out:
clear_inode(inode);
/* change incore inode */
ll_attr2inode(inode, attr, do_trunc);
- err = mdc_setattr(&sbi->ll_mdc_conn, inode, attr,
- &request);
+ err = mdc_setattr(&sbi->ll_mdc_conn, inode, attr, &request);
if (err)
CERROR("mdc_setattr fails (%d)\n", err);
RETURN(rc);
}
+inline int ll_stripe_md_size(struct super_block *sb)
+{
+ struct mdc_obd *mdc = sbi2mdc(ll_s2sbi(sb));
+ return mdc->mdc_max_mdsize;
+}
+
static void ll_to_inode(struct inode *dst, struct ll_inode_md *md)
{
struct mds_body *body = md->body;
dst->i_nlink = body->nlink;
if (body->valid & OBD_MD_FLGENER)
dst->i_generation = body->generation;
-
- /* this will become more elaborate for striping etc */
- if (md->obdo != NULL && md->obdo->o_valid != 0) {
- ii->lli_obdo = obdo_alloc();
- memcpy(ii->lli_obdo, md->obdo, sizeof(*md->obdo));
- }
-#if 0
-
- if (obdo_has_inline(oa)) {
- if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode) ||
- S_ISFIFO(inode->i_mode)) {
- obd_rdev rdev = *((obd_rdev *)oa->o_inline);
- CDEBUG(D_INODE,
- "copying device %x from obdo to inode\n", rdev);
- init_special_inode(inode, inode->i_mode, rdev);
- } else {
- CDEBUG(D_INFO, "copying inline from obdo to inode\n");
- memcpy(oinfo->lli_inline, oa->o_inline, OBD_INLINESZ);
+ if (body->valid & OBD_MD_FLRDEV)
+ dst->i_rdev = body->extra;
+ if (md && md->md && md->md->lmd_stripe_count) {
+ struct lov_stripe_md *smd = md->md;
+ int size = ll_stripe_md_size(dst->i_sb);
+ if (md->md->lmd_size != size) {
+ CERROR("Striping metadata size error %ld\n",
+ dst->i_ino);
+ LBUG();
+ }
+ OBD_ALLOC(ii->lli_smd, size);
+ if (!ii->lli_smd){
+ CERROR("No memory for %d\n", size);
+ LBUG();
}
- oinfo->lli_flags |= OBD_FL_INLINEDATA;
+ memcpy(ii->lli_smd, smd, size);
}
-#endif
} /* ll_to_inode */
static void ll_read_inode2(struct inode *inode, void *opaque)