struct lookup_intent *it, int lock_mode, struct inode *dir,
struct dentry *de, struct lustre_handle *h, __u64 id,
char *tgt, int tgtlen, void *data, int datalen);
+int mdc_getlovinfo(struct obd_device *obd, struct lustre_handle *mdc_connh,
+ uuid_t **uuids, struct ptlrpc_request **request);
int mdc_getstatus(struct lustre_handle *conn,
struct ll_fid *rootfid, __u64 *last_committed, __u64 *last_rcvd,
__u32 *last_xid, struct ptlrpc_request **);
static struct inode *ll_create_node(struct inode *dir, const char *name,
int namelen, const char *tgt, int tgtlen,
int mode, __u64 extra,
- struct lookup_intent *it,
+ struct lookup_intent *it,
struct lov_stripe_md *smd)
{
struct inode *inode;
RETURN(rc);
}
- mode = mode | S_IFREG;
CDEBUG(D_DENTRY, "name %s mode %o o_id %lld\n",
dentry->d_name.name, mode, (unsigned long long)oa.o_id);
inode = ll_create_node(dir, dentry->d_name.name, dentry->d_name.len,
{
struct inode * inode = ll_create_node(dir, dentry->d_name.name,
dentry->d_name.len, NULL, 0,
- mode, rdev, NULL, NULL);
+ mode, rdev, dentry->d_it, NULL);
int err = PTR_ERR(inode);
if (!IS_ERR(inode))
err = ext2_add_nondir(dentry, inode);
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_mdc, sb = NULL);
}
- /* hack: pass in the MDC connection information to LOV via osc_conn */
- memcpy(&sbi->ll_osc_conn, &sbi->ll_mdc_conn, sizeof(sbi->ll_mdc_conn));
err = obd_connect(&sbi->ll_osc_conn, obd);
if (err) {
CERROR("cannot connect to %s: rc = %d\n", ost, err);
/* obd methods */
-static int lov_getinfo(struct obd_device *obd, struct lustre_handle *mdc_connh,
- struct lov_desc *desc, uuid_t **uuids,
- struct ptlrpc_request **request)
-{
- struct ptlrpc_request *req;
- struct mds_status_req *streq;
- struct lov_obd *lov = &obd->u.lov;
- struct mdc_obd *mdc = &lov->mdcobd->u.mdc;
- int rc, size[2] = {sizeof(*streq)};
- ENTRY;
-
- req = ptlrpc_prep_req2(mdc->mdc_client, mdc->mdc_conn, mdc_connh,
- MDS_LOVINFO, 1, size, NULL);
- if (!req)
- GOTO(out, rc = -ENOMEM);
-
- *request = req;
- streq = lustre_msg_buf(req->rq_reqmsg, 0);
- streq->flags = HTON__u32(MDS_STATUS_LOV);
- streq->repbuf = HTON__u32(8000);
-
- /* prepare for reply */
- req->rq_level = LUSTRE_CONN_CON;
- size[0] = sizeof(*desc);
- size[1] = 8000;
- req->rq_replen = lustre_msg_size(2, size);
-
- rc = ptlrpc_queue_wait(req);
- rc = ptlrpc_check_status(req, rc);
-
- if (!rc) {
- memcpy(desc, lustre_msg_buf(req->rq_repmsg, 0), sizeof(*desc));
- *uuids = lustre_msg_buf(req->rq_repmsg, 1);
- lov_unpackdesc(desc);
- }
- mdc->mdc_max_mdsize = sizeof(*desc) +
- desc->ld_tgt_count * sizeof(uuid_t);
-
- EXIT;
- out:
- return rc;
-}
-
static int lov_connect(struct lustre_handle *conn, struct obd_device *obd)
{
struct ptlrpc_request *req;
- struct lustre_handle mdc_conn;
struct lov_obd *lov = &obd->u.lov;
+ struct lustre_handle mdc_conn;
uuid_t *uuidarray;
int rc;
int i;
MOD_INC_USE_COUNT;
- memcpy(&mdc_conn, conn, sizeof(mdc_conn));
- conn->addr = -1;
- conn->cookie = 0;
rc = class_connect(conn, obd);
if (rc) {
MOD_DEC_USE_COUNT;
RETURN(rc);
}
- rc = lov_getinfo(obd, &mdc_conn, &lov->desc, &uuidarray, &req);
+ rc = obd_connect(&mdc_conn, lov->mdcobd);
+ if (rc) {
+ CERROR("cannot connect to mdc: rc = %d\n", rc);
+ GOTO(out, rc = -EINVAL);
+ }
+
+ rc = mdc_getlovinfo(obd, &mdc_conn, &uuidarray, &req);
+ obd_disconnect(&mdc_conn);
+
if (rc) {
CERROR("cannot get lov info %d\n", rc);
GOTO(out, rc);
}
+
if (lov->desc.ld_tgt_count > 1000) {
CERROR("configuration error: target count > 1000 (%d)\n",
lov->desc.ld_tgt_count);
modulefs_DATA = mdc.o
EXTRA_PROGRAMS = mdc
-LINX=mds_updates.c ll_pack.c
+LINX=mds_updates.c ll_pack.c lov_pack.c
mdc_SOURCES = mdc_request.c mdc_reint.c $(LINX)
+lov_pack.c:
+ test -e lov_pack.c || ln -sf $(top_srcdir)/lib/lov_pack.c .
+
ll_pack.c:
test -e ll_pack.c || ln -sf $(top_srcdir)/lib/ll_pack.c .
return rc;
}
+int mdc_getlovinfo(struct obd_device *obd, struct lustre_handle *mdc_connh,
+ uuid_t **uuids, struct ptlrpc_request **request)
+{
+ struct ptlrpc_request *req;
+ struct mds_status_req *streq;
+ struct lov_obd *lov = &obd->u.lov;
+ struct mdc_obd *mdc = &lov->mdcobd->u.mdc;
+ struct ptlrpc_client *cl;
+ struct ptlrpc_connection *connection;
+ struct lustre_handle *rconn;
+ struct lov_desc *desc = &lov->desc;
+ int rc, size[2] = {sizeof(*streq)};
+ ENTRY;
+
+ mdc_con2cl(mdc_connh, &cl, &connection, &rconn);
+ req = ptlrpc_prep_req2(cl, connection, rconn,
+ MDS_LOVINFO, 1, size, NULL);
+ if (!req)
+ GOTO(out, rc = -ENOMEM);
+
+ *request = req;
+ streq = lustre_msg_buf(req->rq_reqmsg, 0);
+ streq->flags = HTON__u32(MDS_STATUS_LOV);
+ streq->repbuf = HTON__u32(8000);
+
+ /* prepare for reply */
+ req->rq_level = LUSTRE_CONN_CON;
+ size[0] = sizeof(*desc);
+ size[1] = 8000;
+ req->rq_replen = lustre_msg_size(2, size);
+
+ rc = ptlrpc_queue_wait(req);
+ rc = ptlrpc_check_status(req, rc);
+
+ if (!rc) {
+ memcpy(desc, lustre_msg_buf(req->rq_repmsg, 0), sizeof(*desc));
+ *uuids = lustre_msg_buf(req->rq_repmsg, 1);
+ lov_unpackdesc(desc);
+ }
+ mdc->mdc_max_mdsize = sizeof(*desc) +
+ desc->ld_tgt_count * sizeof(uuid_t);
+
+ EXIT;
+ out:
+ return rc;
+}
+
int mdc_getattr(struct lustre_handle *conn,
obd_id ino, int type, unsigned long valid, size_t ea_size,
break;
case (IT_CREAT|IT_OPEN):
case IT_CREAT:
+ it->it_mode |= S_IFREG; /* no break */
case IT_MKNOD:
- it->it_mode = (it->it_mode | S_IFREG) & ~current->fs->umask;
+ it->it_mode &= ~current->fs->umask;
break;
case IT_SYMLINK:
it->it_mode = (it->it_mode | S_IFLNK) & ~current->fs->umask;
RETURN(-1);
}
#warning FIXME: the data here needs to be different if a lock was granted for a different inode
- rc = ldlm_cli_enqueue(cl, connection, NULL, req,
+ rc = ldlm_cli_enqueue(cl, connection, rconn, req,
obddev->obd_namespace, NULL, res_id, lock_type,
NULL, 0, lock_mode, &flags,
(void *)mdc_lock_callback, data, datalen, lockh);
MODULE_LICENSE("GPL");
EXPORT_SYMBOL(mdc_getstatus);
+EXPORT_SYMBOL(mdc_getlovinfo);
EXPORT_SYMBOL(mdc_enqueue);
EXPORT_SYMBOL(mdc_getattr);
EXPORT_SYMBOL(mdc_statfs);
break;
}
default:
- CERROR("bad file type %d for create of %s\n",type,rec->ur_name);
+ CERROR("bad file type %o for create of %s\n",type,rec->ur_name);
GOTO(out_create_dchild, rc = -EINVAL);
}