1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2001, 2002 Cluster File Systems, Inc.
6 * This file is part of Lustre, http://www.sf.net/projects/lustre/
8 * Lustre is free software; you can redistribute it and/or
9 * modify it under the terms of version 2 of the GNU General Public
10 * License as published by the Free Software Foundation.
12 * Lustre is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Lustre; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #define DEBUG_SUBSYSTEM S_MDC
26 #include <linux/module.h>
27 #include <linux/miscdevice.h>
28 #include <linux/lustre_mds.h>
29 #include <linux/lustre_lite.h>
30 #include <linux/lustre_dlm.h>
31 #include <linux/init.h>
32 #include <linux/obd_lov.h>
34 #define REQUEST_MINOR 244
36 extern int mds_queue_req(struct ptlrpc_request *);
38 int mdc_getstatus(struct lustre_handle *conn, struct ll_fid *rootfid,
39 __u64 *last_committed, __u64 *last_xid,
40 struct ptlrpc_request **request)
42 struct ptlrpc_request *req;
43 struct mds_body *body;
44 int rc, size = sizeof(*body);
47 req = ptlrpc_prep_req(class_conn2cliimp(conn), MDS_GETSTATUS, 1, &size,
50 GOTO(out, rc = -ENOMEM);
52 body = lustre_msg_buf(req->rq_reqmsg, 0);
53 req->rq_level = LUSTRE_CONN_CON;
54 req->rq_replen = lustre_msg_size(1, &size);
56 mds_pack_req_body(req);
57 rc = ptlrpc_queue_wait(req);
58 rc = ptlrpc_check_status(req, rc);
61 body = lustre_msg_buf(req->rq_repmsg, 0);
62 mds_unpack_body(body);
63 memcpy(rootfid, &body->fid1, sizeof(*rootfid));
64 *last_committed = req->rq_repmsg->last_committed;
65 *last_xid = req->rq_repmsg->last_xid;
67 CDEBUG(D_NET,"root ino=%ld, last_committed=%Lu, last_xid=%Ld\n",
68 (unsigned long)rootfid->id,
69 (unsigned long long)*last_committed,
70 (unsigned long long)*last_xid);
75 ptlrpc_req_finished(req);
79 int mdc_getlovinfo(struct obd_device *obd, struct lustre_handle *mdc_connh,
80 struct ptlrpc_request **request)
82 struct ptlrpc_request *req;
83 struct mds_status_req *streq;
84 int rc, size[2] = {sizeof(*streq)};
87 req = ptlrpc_prep_req(class_conn2cliimp(mdc_connh), MDS_GETLOVINFO, 1,
90 GOTO(out, rc = -ENOMEM);
93 streq = lustre_msg_buf(req->rq_reqmsg, 0);
94 streq->flags = HTON__u32(MDS_STATUS_LOV);
95 streq->repbuf = HTON__u32(8192);
97 /* prepare for reply */
98 req->rq_level = LUSTRE_CONN_CON;
101 req->rq_replen = lustre_msg_size(2, size);
103 rc = ptlrpc_queue_wait(req);
104 rc = ptlrpc_check_status(req, rc);
111 int mdc_getattr(struct lustre_handle *conn,
112 obd_id ino, int type, unsigned long valid, size_t ea_size,
113 struct ptlrpc_request **request)
115 struct ptlrpc_request *req;
116 struct mds_body *body;
117 int rc, size[2] = {sizeof(*body), 0}, bufcount = 1;
120 req = ptlrpc_prep_req(class_conn2cliimp(conn), MDS_GETATTR, 1, size,
123 GOTO(out, rc = -ENOMEM);
125 body = lustre_msg_buf(req->rq_reqmsg, 0);
126 ll_ino2fid(&body->fid1, ino, 0, type);
130 struct client_obd *mdc = &class_conn2obd(conn)->u.cli;
132 size[1] = mdc->cl_max_mds_easize;
133 } else if (valid & OBD_MD_LINKNAME) {
136 body->size = ea_size;
137 CDEBUG(D_INODE, "allocating %d bytes for symlink in packet\n",
140 req->rq_replen = lustre_msg_size(bufcount, size);
141 mds_pack_req_body(req);
143 rc = ptlrpc_queue_wait(req);
144 rc = ptlrpc_check_status(req, rc);
147 body = lustre_msg_buf(req->rq_repmsg, 0);
148 mds_unpack_body(body);
149 CDEBUG(D_NET, "mode: %o\n", body->mode);
158 static void d_delete_aliases(struct inode *inode)
160 struct dentry *dentry = NULL;
161 struct list_head *tmp;
162 int dentry_count = 0;
165 spin_lock(&dcache_lock);
166 list_for_each(tmp, &inode->i_dentry) {
167 dentry = list_entry(tmp, struct dentry, d_alias);
171 /* XXX FIXME tell phil/peter that you see this -- unless you're playing
172 * with hard links, in which case, stop. */
173 LASSERT(dentry_count <= 1);
175 if (dentry_count == 0) {
176 spin_unlock(&dcache_lock);
181 CDEBUG(D_INODE, "d_deleting dentry %p\n", dentry);
183 spin_unlock(&dcache_lock);
189 static int mdc_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,
190 void *data, __u32 data_len, int flag)
193 struct lustre_handle lockh;
197 case LDLM_CB_BLOCKING:
198 ldlm_lock2handle(lock, &lockh);
199 rc = ldlm_cli_cancel(&lockh);
201 CDEBUG(D_INODE, "ldlm_cli_cancel: %d\n", rc);
205 case LDLM_CB_CANCELING: {
206 /* Invalidate all dentries associated with this inode */
207 struct inode *inode = data;
209 LASSERT(inode != NULL);
210 LASSERT(data_len == sizeof(*inode));
212 if (S_ISDIR(inode->i_mode)) {
213 CDEBUG(D_INODE, "invalidating inode %ld\n",
215 ll_invalidate_inode_pages(inode);
218 LASSERT(igrab(inode) == inode);
219 d_delete_aliases(inode);
230 struct create_replay_data {
231 struct super_block *sb;
235 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
236 static int create_replay_find_inode(struct inode *inode, unsigned long ino,
239 static int create_replay_find_inode(struct inode *inode, void *opaque)
242 struct ptlrpc_request *req = opaque;
243 struct create_replay_data *saved;
244 struct mds_body *body;
246 saved = lustre_msg_buf(req->rq_reqmsg, 5); /* lock with intent */
248 if (saved->generation != inode->i_generation) {
250 "generation mismatch for ino %u: saved %u != inode %u\n",
251 inode->i_ino, saved->generation, inode->i_generation);
255 body = lustre_msg_buf(req->rq_repmsg, 1);
257 /* XXX do I need more out of ll_update_inode? */
258 CDEBUG(D_HA, "updating inode %u generation %u to %u\n",
259 inode->i_ino, inode->i_generation, body->generation);
261 inode->i_generation = body->generation;
266 static void fixup_req_for_recreate(struct ptlrpc_request *fixreq,
267 struct ptlrpc_request *req,
270 struct ldlm_request *lockreq;
271 struct mds_rec_link *rec; /* representative, two-fid op structure */
274 if (fixreq->rq_import != req->rq_import) {
275 DEBUG_REQ(D_HA, fixreq, "import mismatch, skipping");
279 DEBUG_REQ(D_HA, fixreq, "fixing");
281 /* XXX check replay_state to see if we'll actually replay. */
283 /* We only care about LDLM_ENQUEUE and MDS_REINT requests. */
284 if (fixreq->rq_reqmsg->opc == LDLM_ENQUEUE) {
285 lockreq = lustre_msg_buf(fixreq->rq_reqmsg, 0);
287 if (lockreq->lock_desc.l_resource.lr_type != LDLM_PLAIN &&
288 !(lockreq->lock_flags & LDLM_FL_HAS_INTENT)) {
289 DEBUG_REQ(D_HA, fixreq, "non-intent lock, skipping");
293 if (fixreq->rq_reqmsg->bufcount < 2) {
294 DEBUG_REQ(D_HA, fixreq,
295 "short intent (probably readdir), skipping");
299 /* XXX endianness is probably very very wrong here. Very. */
300 rec = lustre_msg_buf(fixreq->rq_reqmsg, 2);
301 } else if (fixreq->rq_reqmsg->opc == MDS_REINT) {
302 rec = lustre_msg_buf(fixreq->rq_reqmsg, 0);
303 } else if (fixreq->rq_reqmsg->opc == MDS_OPEN) {
304 struct mds_body *body = lustre_msg_buf(fixreq->rq_reqmsg, 0);
305 DEBUG_REQ(D_HA, fixreq, "fixing fid1: %u -> %u",
306 body->fid1.generation, inode->i_generation);
307 body->fid1.generation = inode->i_generation;
310 DEBUG_REQ(D_HA, fixreq, "not a replayable request, skipping");
314 if (rec->lk_fid1.id == inode->i_ino) {
315 DEBUG_REQ(D_HA, fixreq, "fixing fid1: %u -> %u",
316 rec->lk_fid1.generation, inode->i_generation);
317 rec->lk_fid1.generation = inode->i_generation;
320 /* Some ops have two FIDs. ZZZ We rely on the identical
321 * placement of that second FID in all such ops' messages.
323 opc = rec->lk_opcode & REINT_OPCODE_MASK;
324 if ((opc == REINT_LINK || opc == REINT_UNLINK ||
325 opc == REINT_RENAME) &&
326 rec->lk_fid2.id == inode->i_ino) {
327 DEBUG_REQ(D_HA, fixreq, "fixing fid2: %u -> %u",
328 rec->lk_fid2.generation, inode->i_generation);
329 rec->lk_fid2.generation = inode->i_generation;
333 static void mdc_replay_create(struct ptlrpc_request *req)
335 struct create_replay_data *saved;
336 struct mds_body *body;
338 struct list_head *tmp;
340 if (req->rq_reqmsg->opc == MDS_REINT)
341 LBUG(); /* XXX don't handle the non-intent case yet */
343 body = lustre_msg_buf(req->rq_repmsg, 1);
344 saved = lustre_msg_buf(req->rq_reqmsg, 5); /* lock with intent */
346 CDEBUG(D_HA, "create of inode %d replayed; gen %u -> %u\n",
347 body->fid1.id, saved->generation, body->generation);
348 /* XXX cargo-culted right out of ll_iget */
349 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
350 inode = iget4(saved->sb, body->fid1.id, create_replay_find_inode, req);
354 extern int ll_read_inode2(struct inode *inode, void *opaque);
355 inode = iget5_locked(saved->sb, body->fid1.id,
356 create_replay_find_inode,
357 ll_read_inode2, req);
360 LBUG(); /* XXX ick */
362 if (inode->i_state & I_NEW)
363 unlock_new_inode(inode);
367 /* Now that we've updated the generation, we need to go and find all
368 * the other requests that refer to this file and will be replayed,
369 * and teach them about our new generation.
371 list_for_each(tmp, &req->rq_connection->c_sending_head) {
372 struct ptlrpc_request *fixreq =
373 list_entry(tmp, struct ptlrpc_request, rq_list);
375 fixup_req_for_recreate(fixreq, req, inode);
378 list_for_each(tmp, &req->rq_connection->c_delayed_head) {
379 struct ptlrpc_request *fixreq =
380 list_entry(tmp, struct ptlrpc_request, rq_list);
382 fixup_req_for_recreate(fixreq, req, inode);
386 void mdc_store_create_replay_data(struct ptlrpc_request *req,
387 struct super_block *sb)
389 struct create_replay_data *saved =
390 lustre_msg_buf(req->rq_reqmsg, 5);
391 struct mds_body *body = lustre_msg_buf(req->rq_repmsg, 1);
394 if (req->rq_reqmsg->opc == MDS_REINT)
395 LBUG(); /* XXX don't handle the non-intent case yet */
397 saved->generation = body->generation;
398 saved->sb = sb; /* XXX is this safe? */
400 req->rq_replay_cb = mdc_replay_create;
403 int mdc_enqueue(struct lustre_handle *conn, int lock_type,
404 struct lookup_intent *it, int lock_mode, struct inode *dir,
405 struct dentry *de, struct lustre_handle *lockh,
406 char *tgt, int tgtlen, void *data, int datalen)
408 struct ptlrpc_request *req;
409 struct obd_device *obddev = class_conn2obd(conn);
410 __u64 res_id[RES_NAME_SIZE] = {dir->i_ino, (__u64)dir->i_generation};
411 int size[6] = {sizeof(struct ldlm_request), sizeof(struct ldlm_intent)};
412 int rc, flags = LDLM_FL_HAS_INTENT;
413 int repsize[3] = {sizeof(struct ldlm_reply),
414 sizeof(struct mds_body),
415 obddev->u.cli.cl_max_mds_easize};
416 struct ldlm_reply *dlm_rep;
417 struct ldlm_intent *lit;
418 struct ldlm_request *lockreq;
421 LDLM_DEBUG_NOLOCK("mdsintent %s dir %ld", ldlm_it2str(it->it_op),
424 if (it->it_op & (IT_MKDIR | IT_CREAT | IT_SYMLINK | IT_MKNOD)) {
427 it->it_mode |= S_IFDIR;
429 case (IT_CREAT|IT_OPEN):
431 it->it_mode |= S_IFREG;
434 it->it_mode |= S_IFLNK;
437 it->it_mode &= ~current->fs->umask;
439 size[2] = sizeof(struct mds_rec_create);
440 size[3] = de->d_name.len + 1;
441 size[4] = tgtlen + 1;
442 size[5] = sizeof(struct create_replay_data);
443 req = ptlrpc_prep_req(class_conn2cliimp(conn), LDLM_ENQUEUE, 6,
448 /* pack the intent */
449 lit = lustre_msg_buf(req->rq_reqmsg, 1);
450 lit->opc = NTOH__u64((__u64)it->it_op);
452 /* pack the intended request */
453 mds_create_pack(req, 2, dir, it->it_mode, 0, current->fsuid,
454 current->fsgid, CURRENT_TIME, de->d_name.name,
455 de->d_name.len, tgt, tgtlen);
456 req->rq_replen = lustre_msg_size(3, repsize);
457 } else if (it->it_op == IT_RENAME2) {
458 struct dentry *old_de = it->it_data;
460 size[2] = sizeof(struct mds_rec_rename);
461 size[3] = old_de->d_name.len + 1;
462 size[4] = de->d_name.len + 1;
463 req = ptlrpc_prep_req(class_conn2cliimp(conn), LDLM_ENQUEUE, 5,
468 /* pack the intent */
469 lit = lustre_msg_buf(req->rq_reqmsg, 1);
470 lit->opc = NTOH__u64((__u64)it->it_op);
472 /* pack the intended request */
473 mds_rename_pack(req, 2, old_de->d_parent->d_inode, dir,
474 old_de->d_name.name, old_de->d_name.len,
475 de->d_name.name, de->d_name.len);
476 req->rq_replen = lustre_msg_size(3, repsize);
477 } else if (it->it_op == IT_LINK2) {
478 struct dentry *old_de = it->it_data;
480 size[2] = sizeof(struct mds_rec_link);
481 size[3] = de->d_name.len + 1;
482 req = ptlrpc_prep_req(class_conn2cliimp(conn), LDLM_ENQUEUE, 4,
487 /* pack the intent */
488 lit = lustre_msg_buf(req->rq_reqmsg, 1);
489 lit->opc = NTOH__u64((__u64)it->it_op);
491 /* pack the intended request */
492 mds_link_pack(req, 2, old_de->d_inode, dir,
493 de->d_name.name, de->d_name.len);
494 req->rq_replen = lustre_msg_size(3, repsize);
495 } else if (it->it_op == IT_UNLINK || it->it_op == IT_RMDIR) {
496 size[2] = sizeof(struct mds_rec_unlink);
497 size[3] = de->d_name.len + 1;
498 req = ptlrpc_prep_req(class_conn2cliimp(conn), LDLM_ENQUEUE, 4,
503 /* pack the intent */
504 lit = lustre_msg_buf(req->rq_reqmsg, 1);
505 lit->opc = NTOH__u64((__u64)it->it_op);
507 /* pack the intended request */
508 mds_unlink_pack(req, 2, dir, NULL,
509 it->it_op == IT_UNLINK ? S_IFREG : S_IFDIR,
510 de->d_name.name, de->d_name.len);
512 req->rq_replen = lustre_msg_size(3, repsize);
513 } else if (it->it_op & (IT_GETATTR | IT_RENAME | IT_LINK |
514 IT_OPEN | IT_SETATTR | IT_LOOKUP | IT_READLINK)) {
515 size[2] = sizeof(struct mds_body);
516 size[3] = de->d_name.len + 1;
518 req = ptlrpc_prep_req(class_conn2cliimp(conn), LDLM_ENQUEUE, 4,
523 /* pack the intent */
524 lit = lustre_msg_buf(req->rq_reqmsg, 1);
525 lit->opc = NTOH__u64((__u64)it->it_op);
527 /* pack the intended request */
528 mds_getattr_pack(req, 2, dir, de->d_name.name, de->d_name.len);
530 /* we need to replay opens */
531 if (it->it_op == IT_OPEN)
532 req->rq_flags |= PTL_RPC_FL_REPLAY;
534 /* get ready for the reply */
535 req->rq_replen = lustre_msg_size(3, repsize);
536 } else if (it->it_op == IT_READDIR) {
537 req = ptlrpc_prep_req(class_conn2cliimp(conn), LDLM_ENQUEUE, 1,
542 /* get ready for the reply */
543 req->rq_replen = lustre_msg_size(1, repsize);
548 #warning FIXME: the data here needs to be different if a lock was granted for a different inode
549 rc = ldlm_cli_enqueue(conn, req, obddev->obd_namespace, NULL, res_id,
550 lock_type, NULL, 0, lock_mode, &flags,
551 ldlm_completion_ast, mdc_blocking_ast, data,
554 /* This can go when we're sure that this can never happen */
557 if (rc == ELDLM_LOCK_ABORTED) {
559 memset(lockh, 0, sizeof(*lockh));
561 } else if (rc != 0) {
562 CERROR("ldlm_cli_enqueue: %d\n", rc);
566 /* On replay, we don't want the lock granted. */
567 lockreq = lustre_msg_buf(req->rq_reqmsg, 0);
568 lockreq->lock_flags |= LDLM_FL_INTENT_ONLY;
570 dlm_rep = lustre_msg_buf(req->rq_repmsg, 0);
571 it->it_disposition = (int) dlm_rep->lock_policy_res1;
572 it->it_status = (int) dlm_rep->lock_policy_res2;
573 it->it_lock_mode = lock_mode;
579 int mdc_cancel_unused(struct lustre_handle *conn, struct inode *inode,
582 __u64 res_id[RES_NAME_SIZE] = {inode->i_ino, inode->i_generation};
583 struct obd_device *obddev = class_conn2obd(conn);
585 RETURN(ldlm_cli_cancel_unused(obddev->obd_namespace, res_id, flags));
588 struct replay_open_data {
589 struct lustre_handle *fh;
592 static void mdc_replay_open(struct ptlrpc_request *req)
595 struct replay_open_data *saved;
596 struct mds_body *body = lustre_msg_buf(req->rq_repmsg, 0);
598 if (lustre_msg_get_op_flags(req->rq_reqmsg) & MDS_OPEN_HAS_EA)
603 saved = lustre_msg_buf(req->rq_reqmsg, offset);
604 mds_unpack_body(body);
605 CDEBUG(D_HA, "updating from "LPD64"/"LPD64" to "LPD64"/"LPD64"\n",
606 saved->fh->addr, saved->fh->cookie,
607 body->handle.addr, body->handle.cookie);
608 memcpy(saved->fh, &body->handle, sizeof(body->handle));
611 int mdc_open(struct lustre_handle *conn, obd_id ino, int type, int flags,
612 struct lov_stripe_md *lsm, struct lustre_handle *fh,
613 struct ptlrpc_request **request)
615 struct mds_body *body;
616 struct replay_open_data *replay_data;
617 int rc, size[3] = {sizeof(*body), sizeof(*replay_data)}, bufcount = 2;
618 struct ptlrpc_request *req;
623 size[2] = size[1]; /* shuffle the spare data along */
625 size[1] = lsm->lsm_mds_easize;
628 req = ptlrpc_prep_req(class_conn2cliimp(conn), MDS_OPEN, bufcount, size,
631 GOTO(out, rc = -ENOMEM);
634 lustre_msg_set_op_flags(req->rq_reqmsg, MDS_OPEN_HAS_EA);
637 req->rq_flags |= PTL_RPC_FL_REPLAY;
638 body = lustre_msg_buf(req->rq_reqmsg, 0);
640 ll_ino2fid(&body->fid1, ino, 0, type);
641 body->flags = HTON__u32(flags);
642 memcpy(&body->handle, fh, sizeof(body->handle));
645 lov_packmd(lustre_msg_buf(req->rq_reqmsg, 1), lsm);
647 req->rq_replen = lustre_msg_size(1, size);
649 rc = ptlrpc_queue_wait(req);
650 rc = ptlrpc_check_status(req, rc);
652 body = lustre_msg_buf(req->rq_repmsg, 0);
653 mds_unpack_body(body);
654 memcpy(fh, &body->handle, sizeof(*fh));
657 /* If open is replayed, we need to fix up the fh. */
658 req->rq_replay_cb = mdc_replay_open;
659 replay_data = lustre_msg_buf(req->rq_reqmsg, lsm ? 2 : 1);
660 replay_data->fh = fh;
668 int mdc_close(struct lustre_handle *conn, obd_id ino, int type,
669 struct lustre_handle *fh, struct ptlrpc_request **request)
671 struct mds_body *body;
672 int rc, size = sizeof(*body);
673 struct ptlrpc_request *req;
675 req = ptlrpc_prep_req(class_conn2cliimp(conn), MDS_CLOSE, 1, &size,
678 GOTO(out, rc = -ENOMEM);
680 body = lustre_msg_buf(req->rq_reqmsg, 0);
681 ll_ino2fid(&body->fid1, ino, 0, type);
682 memcpy(&body->handle, fh, sizeof(body->handle));
684 req->rq_replen = lustre_msg_size(0, NULL);
686 rc = ptlrpc_queue_wait(req);
687 rc = ptlrpc_check_status(req, rc);
695 int mdc_readpage(struct lustre_handle *conn, obd_id ino, int type, __u64 offset,
696 char *addr, struct ptlrpc_request **request)
698 struct ptlrpc_connection *connection =
699 client_conn2cli(conn)->cl_import.imp_connection;
700 struct ptlrpc_request *req = NULL;
701 struct ptlrpc_bulk_desc *desc = NULL;
702 struct ptlrpc_bulk_page *bulk = NULL;
703 struct mds_body *body;
704 int rc, size = sizeof(*body);
707 CDEBUG(D_INODE, "inode: %ld\n", (long)ino);
709 desc = ptlrpc_prep_bulk(connection);
711 GOTO(out, rc = -ENOMEM);
713 req = ptlrpc_prep_req(class_conn2cliimp(conn), MDS_READPAGE, 1, &size,
716 GOTO(out2, rc = -ENOMEM);
718 bulk = ptlrpc_prep_bulk_page(desc);
719 bulk->bp_buflen = PAGE_SIZE;
721 bulk->bp_xid = req->rq_xid;
722 desc->bd_portal = MDS_BULK_PORTAL;
724 rc = ptlrpc_register_bulk(desc);
726 CERROR("couldn't setup bulk sink: error %d.\n", rc);
730 body = lustre_msg_buf(req->rq_reqmsg, 0);
732 body->fid1.f_type = type;
735 req->rq_replen = lustre_msg_size(1, &size);
736 rc = ptlrpc_queue_wait(req);
737 rc = ptlrpc_check_status(req, rc);
739 ptlrpc_abort_bulk(desc);
742 body = lustre_msg_buf(req->rq_repmsg, 0);
743 mds_unpack_body(body);
748 ptlrpc_free_bulk(desc);
754 int mdc_statfs(struct lustre_handle *conn, struct obd_statfs *osfs,
755 struct ptlrpc_request **request)
757 struct ptlrpc_request *req;
758 int rc, size = sizeof(*osfs);
761 req = ptlrpc_prep_req(class_conn2cliimp(conn), MDS_STATFS, 0, NULL,
764 GOTO(out, rc = -ENOMEM);
765 req->rq_replen = lustre_msg_size(1, &size);
767 rc = ptlrpc_queue_wait(req);
768 rc = ptlrpc_check_status(req, rc);
773 obd_statfs_unpack(osfs, lustre_msg_buf(req->rq_repmsg, 0));
782 struct obd_ops mdc_obd_ops = {
783 o_setup: client_obd_setup,
784 o_cleanup: client_obd_cleanup,
785 o_connect: client_obd_connect,
786 o_disconnect: client_obd_disconnect,
789 static int __init ptlrpc_request_init(void)
791 return class_register_type(&mdc_obd_ops, LUSTRE_MDC_NAME);
794 static void __exit ptlrpc_request_exit(void)
796 class_unregister_type(LUSTRE_MDC_NAME);
799 MODULE_AUTHOR("Cluster File Systems <info@clusterfs.com>");
800 MODULE_DESCRIPTION("Lustre Metadata Client v1.0");
801 MODULE_LICENSE("GPL");
803 EXPORT_SYMBOL(mdc_getstatus);
804 EXPORT_SYMBOL(mdc_getlovinfo);
805 EXPORT_SYMBOL(mdc_enqueue);
806 EXPORT_SYMBOL(mdc_cancel_unused);
807 EXPORT_SYMBOL(mdc_getattr);
808 EXPORT_SYMBOL(mdc_statfs);
809 EXPORT_SYMBOL(mdc_create);
810 EXPORT_SYMBOL(mdc_unlink);
811 EXPORT_SYMBOL(mdc_rename);
812 EXPORT_SYMBOL(mdc_link);
813 EXPORT_SYMBOL(mdc_readpage);
814 EXPORT_SYMBOL(mdc_setattr);
815 EXPORT_SYMBOL(mdc_close);
816 EXPORT_SYMBOL(mdc_open);
818 EXPORT_SYMBOL(mdc_store_create_replay_data);
820 module_init(ptlrpc_request_init);
821 module_exit(ptlrpc_request_exit);