1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
6 * Copyright (C) 2002 Cluster File Systems, Inc.
7 * Author: Phil Schwan <phil@off.net>
8 * Peter Braam <braam@clusterfs.com>
10 * This code is issued under the GNU General Public License.
11 * See the file COPYING in this distribution
15 #define DEBUG_SUBSYSTEM S_LOV
17 #include <linux/slab.h>
18 #include <linux/module.h>
19 #include <linux/obd_support.h>
20 #include <linux/lustre_lib.h>
21 #include <linux/lustre_net.h>
22 #include <linux/lustre_idl.h>
23 #include <linux/lustre_mds.h>
24 #include <linux/obd_class.h>
25 #include <linux/obd_lov.h>
26 #include <linux/init.h>
27 #include <asm/div64.h>
30 static int lov_connect(struct lustre_handle *conn, struct obd_device *obd,
33 struct ptlrpc_request *req;
34 struct lov_obd *lov = &obd->u.lov;
35 struct client_obd *mdc = &lov->mdcobd->u.cli;
36 struct lov_desc *desc = &lov->desc;
37 struct lustre_handle mdc_conn;
43 rc = class_connect(conn, obd, cluuid);
49 /* retrieve LOV metadata from MDS */
50 rc = obd_connect(&mdc_conn, lov->mdcobd, NULL);
52 CERROR("cannot connect to mdc: rc = %d\n", rc);
53 GOTO(out, rc = -EINVAL);
56 rc = mdc_getlovinfo(obd, &mdc_conn, &req);
57 rc2 = obd_disconnect(&mdc_conn);
59 CERROR("cannot get lov info or disconnect %d/%d\n", rc, rc2);
60 GOTO(out, (rc) ? rc : rc2 );
64 if (req->rq_repmsg->bufcount < 2 ||
65 req->rq_repmsg->buflens[0] < sizeof(*desc)) {
66 CERROR("LOV desc: invalid descriptor returned\n");
67 GOTO(out, rc = -EINVAL);
70 memcpy(desc, lustre_msg_buf(req->rq_repmsg, 0), sizeof(*desc));
73 if (req->rq_repmsg->buflens[1] < sizeof(*uuidarray)*desc->ld_tgt_count){
74 CERROR("LOV desc: invalid uuid array returned\n");
75 GOTO(out, rc = -EINVAL);
78 mdc->cl_max_mds_easize = lov_mds_md_size(desc->ld_tgt_count);
79 mdc->cl_max_ost_easize = lov_stripe_md_size(desc->ld_tgt_count);
81 if (memcmp(obd->obd_uuid, desc->ld_uuid, sizeof(desc->ld_uuid))) {
82 CERROR("LOV desc: uuid %s not on mds device (%s)\n",
83 obd->obd_uuid, desc->ld_uuid);
84 GOTO(out, rc = -EINVAL);
87 if (desc->ld_tgt_count > 1000) {
88 CERROR("LOV desc: target count > 1000 (%d)\n",
90 GOTO(out, rc = -EINVAL);
93 if (desc->ld_default_stripe_count == 0)
94 desc->ld_default_stripe_count = desc->ld_tgt_count;
96 /* Because of 64-bit divide/mod operations only work with a 32-bit
97 * divisor in a 32-bit kernel, we cannot support a stripe width
100 if (desc->ld_default_stripe_size * desc->ld_tgt_count > ~0UL) {
101 CERROR("LOV desc: stripe width > %lu on 32-bit system\n",
103 GOTO(out, rc = -EINVAL);
106 lov->bufsize = sizeof(struct lov_tgt_desc) * desc->ld_tgt_count;
107 OBD_ALLOC(lov->tgts, lov->bufsize);
109 CERROR("Out of memory\n");
110 GOTO(out, rc = -ENOMEM);
113 uuidarray = lustre_msg_buf(req->rq_repmsg, 1);
114 for (i = 0 ; i < desc->ld_tgt_count; i++)
115 memcpy(lov->tgts[i].uuid, uuidarray[i], sizeof(*uuidarray));
117 for (i = 0 ; i < desc->ld_tgt_count; i++) {
118 struct obd_device *tgt = class_uuid2obd(uuidarray[i]);
120 CERROR("Target %s not attached\n", uuidarray[i]);
121 GOTO(out_mem, rc = -EINVAL);
123 if (!(tgt->obd_flags & OBD_SET_UP)) {
124 CERROR("Target %s not set up\n", uuidarray[i]);
125 GOTO(out_mem, rc = -EINVAL);
127 rc = obd_connect(&lov->tgts[i].conn, tgt, NULL);
129 CERROR("Target %s connect error %d\n",
137 for (i = 0 ; i < desc->ld_tgt_count; i++) {
138 rc2 = obd_disconnect(&lov->tgts[i].conn);
140 CERROR("BAD: Target %s disconnect error %d\n",
143 OBD_FREE(lov->tgts, lov->bufsize);
147 class_disconnect(conn);
148 ptlrpc_free_req(req);
152 static int lov_disconnect(struct lustre_handle *conn)
154 struct obd_device *obd = class_conn2obd(conn);
155 struct lov_obd *lov = &obd->u.lov;
162 for (i = 0 ; i < lov->desc.ld_tgt_count; i++) {
163 rc = obd_disconnect(&lov->tgts[i].conn);
165 CERROR("Target %s disconnect error %d\n",
166 lov->tgts[i].uuid, rc);
170 OBD_FREE(lov->tgts, lov->bufsize);
175 rc = class_disconnect(conn);
181 static int lov_setup(struct obd_device *obd, obd_count len, void *buf)
183 struct obd_ioctl_data* data = buf;
184 struct lov_obd *lov = &obd->u.lov;
188 if (data->ioc_inllen1 < 1) {
189 CERROR("osc setup requires an MDC UUID\n");
193 if (data->ioc_inllen1 > 37) {
194 CERROR("mdc UUID must be 36 characters or less\n");
198 lov->mdcobd = class_uuid2obd(data->ioc_inlbuf1);
200 CERROR("LOV %s cannot locate MDC %s\n", obd->obd_uuid,
208 /* the LOV expects oa->o_id to be set to the LOV object id */
209 static int lov_create(struct lustre_handle *conn, struct obdo *oa,
210 struct lov_stripe_md **ea)
212 struct obd_export *export = class_conn2export(conn);
214 struct lov_stripe_md *lsm;
215 struct lov_oinfo *loi;
216 int sub_offset, stripe_offset;
222 CERROR("lov_create needs EA for striping information\n");
228 lov = &export->exp_obd->u.lov;
229 ost_count = lov->desc.ld_tgt_count;
230 oa->o_easize = lov_stripe_md_size(ost_count);
232 OBD_ALLOC(*ea, oa->o_easize);
238 LASSERT(oa->o_valid & OBD_MD_FLID);
239 lsm->lsm_mds_easize = lov_mds_md_size(ost_count);
240 lsm->lsm_object_id = oa->o_id;
241 if (!lsm->lsm_stripe_count)
242 lsm->lsm_stripe_count = lov->desc.ld_default_stripe_count;
244 if (!lsm->lsm_stripe_size)
245 lsm->lsm_stripe_size = lov->desc.ld_default_stripe_size;
247 lsm->lsm_ost_count = ost_count;
248 sub_offset = ((int)lsm->lsm_object_id / lsm->lsm_stripe_count) %
249 lsm->lsm_stripe_count;
250 stripe_offset = (((int)lsm->lsm_object_id * lsm->lsm_stripe_count) %
252 lsm->lsm_stripe_offset = stripe_offset + sub_offset;
254 CDEBUG(D_INODE, "allocating %d subobjs for objid "LPX64" at idx %d\n",
255 lsm->lsm_stripe_count,lsm->lsm_object_id,lsm->lsm_stripe_offset);
257 for (i = 0,loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; i++,loi++) {
258 struct lov_stripe_md obj_md;
259 struct lov_stripe_md *obj_mdp = &obj_md;
261 int ost_idx = (((sub_offset + i) % lsm->lsm_stripe_count) +
262 stripe_offset) % ost_count;
264 /* create data objects with "parent" OA */
265 memcpy(&tmp, oa, sizeof(tmp));
266 tmp.o_easize = sizeof(struct lov_stripe_md);
267 rc = obd_create(&lov->tgts[ost_idx].conn, &tmp, &obj_mdp);
269 CERROR("error creating objid "LPX64" sub-object on "
270 "OST idx %d: rc = %d\n", oa->o_id, ost_idx, rc);
271 GOTO(out_cleanup, rc);
273 loi->loi_id = tmp.o_id;
274 loi->loi_size = tmp.o_size;
275 loi->loi_ost_idx = ost_idx;
276 CDEBUG(D_INODE, "objid "LPX64" has subobj "LPX64" at idx %d\n",
277 lsm->lsm_object_id, loi->loi_id, ost_idx);
287 /* destroy already created objects here */
288 memcpy(&tmp, oa, sizeof(tmp));
289 tmp.o_id = loi->loi_id;
290 err = obd_destroy(&lov->tgts[loi->loi_ost_idx].conn,
293 CERROR("Failed to remove objid "LPX64" subobj "
294 LPX64" on OST idx %d: rc = %d\n",
295 oa->o_id, loi->loi_id, loi->loi_ost_idx,
302 static int lov_destroy(struct lustre_handle *conn, struct obdo *oa,
303 struct lov_stripe_md *lsm)
306 struct obd_export *export = class_conn2export(conn);
308 struct lov_oinfo *loi;
313 CERROR("LOV requires striping ea for destruction\n");
317 if (!export || !export->exp_obd)
320 lov = &export->exp_obd->u.lov;
321 for (i = 0,loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; i++,loi++) {
322 /* create data objects with "parent" OA */
323 memcpy(&tmp, oa, sizeof(tmp));
324 tmp.o_id = loi->loi_id;
325 rc = obd_destroy(&lov->tgts[loi->loi_ost_idx].conn, &tmp, NULL);
327 CERROR("Error destroying objid "LPX64" subobj "LPX64
328 " on OST idx %d\n: rc = %d",
329 oa->o_id, loi->loi_id, loi->loi_ost_idx, rc);
334 static int lov_getattr(struct lustre_handle *conn, struct obdo *oa,
335 struct lov_stripe_md *lsm)
338 struct obd_export *export = class_conn2export(conn);
340 struct lov_oinfo *loi;
346 CERROR("LOV requires striping ea\n");
350 if (!export || !export->exp_obd)
353 lov = &export->exp_obd->u.lov;
356 for (i = 0,loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; i++,loi++) {
359 if (loi->loi_id == 0)
362 /* create data objects with "parent" OA */
363 memcpy(&tmp, oa, sizeof(tmp));
364 tmp.o_id = loi->loi_id;
366 err = obd_getattr(&lov->tgts[loi->loi_ost_idx].conn, &tmp,NULL);
368 CERROR("Error getattr objid "LPX64" subobj "LPX64
369 " on OST idx %d: rc = %d\n",
370 oa->o_id, loi->loi_id, loi->loi_ost_idx, err);
373 continue; /* XXX or break? */
376 obdo_cpy_md(oa, &tmp, tmp.o_valid);
379 #warning FIXME: the size needs to be fixed for sparse files
380 if (tmp.o_valid & OBD_MD_FLSIZE)
381 oa->o_size += tmp.o_size;
382 if (tmp.o_valid & OBD_MD_FLBLOCKS)
383 oa->o_blocks += tmp.o_blocks;
384 if (tmp.o_valid & OBD_MD_FLCTIME &&
385 oa->o_ctime < tmp.o_ctime)
386 oa->o_ctime = tmp.o_ctime;
387 if (tmp.o_valid & OBD_MD_FLMTIME &&
388 oa->o_mtime < tmp.o_mtime)
389 oa->o_mtime = tmp.o_mtime;
395 static int lov_setattr(struct lustre_handle *conn, struct obdo *oa,
396 struct lov_stripe_md *lsm)
400 struct obd_export *export = class_conn2export(conn);
402 struct lov_oinfo *loi;
406 CERROR("LOV requires striping ea\n");
410 if (!export || !export->exp_obd)
413 if (oa->o_valid && OBD_MD_FLSIZE)
414 CERROR("setting size on an LOV object is totally broken\n");
416 lov = &export->exp_obd->u.lov;
417 for (i = 0,loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; i++,loi++) {
420 /* create data objects with "parent" OA */
421 memcpy(&tmp, oa, sizeof(tmp));
422 tmp.o_id = loi->loi_id;
424 err = obd_setattr(&lov->tgts[loi->loi_ost_idx].conn, &tmp,NULL);
426 CERROR("Error setattr objid "LPX64" subobj "LPX64
427 " on OST idx %d: rc = %d\n",
428 oa->o_id, loi->loi_id, loi->loi_ost_idx, err);
436 static int lov_open(struct lustre_handle *conn, struct obdo *oa,
437 struct lov_stripe_md *lsm)
440 struct obd_export *export = class_conn2export(conn);
442 struct lov_oinfo *loi;
447 CERROR("LOV requires striping ea for opening\n");
451 if (!export || !export->exp_obd)
454 lov = &export->exp_obd->u.lov;
455 for (i = 0,loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; i++,loi++) {
458 /* create data objects with "parent" OA */
459 memcpy(&tmp, oa, sizeof(tmp));
460 tmp.o_id = loi->loi_id;
462 err = obd_open(&lov->tgts[loi->loi_ost_idx].conn, &tmp, NULL);
464 CERROR("Error open objid "LPX64" subobj "LPX64
465 " on OST idx %d: rc = %d\n",
466 oa->o_id, lsm->lsm_oinfo[i].loi_id,
467 loi->loi_ost_idx, rc);
472 /* FIXME: returning an error, but having opened some objects is a bad
473 * idea, since they will likely never be closed. We either
474 * need to not return an error if _some_ objects could be
475 * opened, and leave it to read/write to return -EIO (with
476 * hopefully partial error status) or close all opened objects
477 * and return an error.
482 static int lov_close(struct lustre_handle *conn, struct obdo *oa,
483 struct lov_stripe_md *lsm)
486 struct obd_export *export = class_conn2export(conn);
488 struct lov_oinfo *loi;
493 CERROR("LOV requires striping ea\n");
497 if (!export || !export->exp_obd)
500 lov = &export->exp_obd->u.lov;
501 for (i = 0,loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; i++,loi++) {
504 /* create data objects with "parent" OA */
505 memcpy(&tmp, oa, sizeof(tmp));
506 tmp.o_id = loi->loi_id;
508 err = obd_close(&lov->tgts[loi->loi_ost_idx].conn, &tmp, NULL);
510 CERROR("Error close objid "LPX64" subobj "LPX64
511 " on OST idx %d: rc = %d\n",
512 oa->o_id, loi->loi_id, loi->loi_ost_idx, err);
521 #define log2(n) ffz(~(n))
524 #warning FIXME: merge these two functions now that they are nearly the same
526 /* compute ost offset in stripe "stripeno" corresponding to offset "lov_off" */
527 static __u64 lov_offset(struct lov_stripe_md *lsm, __u64 lov_off, int stripeno)
529 unsigned long ssize = lsm->lsm_stripe_size;
530 unsigned long swidth = ssize * lsm->lsm_stripe_count;
531 unsigned long stripe_off;
533 if (lov_off == OBD_PUNCH_EOF)
534 return OBD_PUNCH_EOF;
536 /* do_div(a, b) returns a % b, and a = a / b */
537 stripe_off = do_div(lov_off, swidth);
539 if (stripe_off < stripeno * ssize)
542 stripe_off -= stripeno * ssize;
544 return lov_off + stripe_off;
547 /* compute which stripe offset "lov_off" will be written into */
548 static int lov_stripe_which(struct lov_stripe_md *lsm, __u64 lov_off)
550 unsigned long ssize = lsm->lsm_stripe_size;
551 unsigned long swidth = ssize * lsm->lsm_stripe_count;
552 unsigned long stripe_off;
554 stripe_off = do_div(lov_off, swidth);
556 return stripe_off / ssize;
560 /* FIXME: maybe we'll just make one node the authoritative attribute node, then
561 * we can send this 'punch' to just the authoritative node and the nodes
562 * that the punch will affect. */
563 static int lov_punch(struct lustre_handle *conn, struct obdo *oa,
564 struct lov_stripe_md *lsm,
565 obd_off start, obd_off end)
568 struct obd_export *export = class_conn2export(conn);
570 struct lov_oinfo *loi;
575 CERROR("LOV requires striping ea for desctruction\n");
579 if (!export || !export->exp_obd)
582 lov = &export->exp_obd->u.lov;
583 for (i = 0,loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; i++,loi++) {
584 __u64 starti = lov_offset(lsm, start, i);
585 __u64 endi = lov_offset(lsm, end, i);
590 /* create data objects with "parent" OA */
591 memcpy(&tmp, oa, sizeof(tmp));
592 tmp.o_id = loi->loi_id;
594 err = obd_punch(&lov->tgts[loi->loi_ost_idx].conn, &tmp, NULL,
597 CERROR("Error punch objid "LPX64" subobj "LPX64
598 " on OST idx %d: rc = %d\n",
599 oa->o_id, loi->loi_id, loi->loi_ost_idx, err);
607 static int lov_osc_brw_callback(struct io_cb_data *cbd, int err, int phase)
612 if (phase == CB_PHASE_START)
615 if (phase == CB_PHASE_FINISH) {
618 if (atomic_dec_and_test(&cbd->refcount))
619 ret = cbd->cb(cbd->data, cbd->err, phase);
627 static inline int lov_brw(int cmd, struct lustre_handle *conn,
628 struct lov_stripe_md *lsm, obd_count oa_bufs,
629 struct brw_page *pga,
630 brw_callback_t callback, struct io_cb_data *cbd)
632 int stripe_count = lsm->lsm_stripe_count;
633 struct obd_export *export = class_conn2export(conn);
639 struct lov_stripe_md lsm;
641 } *stripeinfo, *si, *si_last;
642 struct brw_page *ioarr;
644 struct io_cb_data *our_cb;
645 struct lov_oinfo *loi;
649 lov = &export->exp_obd->u.lov;
651 our_cb = ll_init_cb();
655 OBD_ALLOC(stripeinfo, stripe_count * sizeof(*stripeinfo));
657 GOTO(out_cbdata, rc = -ENOMEM);
659 OBD_ALLOC(where, sizeof(*where) * oa_bufs);
661 GOTO(out_sinfo, rc = -ENOMEM);
663 OBD_ALLOC(ioarr, sizeof(*ioarr) * oa_bufs);
665 GOTO(out_where, rc = -ENOMEM);
667 /* This is the only race-free way I can think of to get the refcount
669 atomic_set(&our_cb->refcount, 0);
670 our_cb->cb = callback;
673 for (i = 0; i < oa_bufs; i++) {
674 where[i] = lov_stripe_which(lsm, pga[i].off);
675 if (stripeinfo[where[i]].bufct++ == 0)
676 atomic_inc(&our_cb->refcount);
679 for (i = 0, loi = lsm->lsm_oinfo, si = si_last = stripeinfo;
681 i++, loi++, si_last = si, si++) {
683 si->index = si_last->index + si_last->bufct;
684 si->lsm.lsm_object_id = loi->loi_id;
685 si->ost_idx = loi->loi_ost_idx;
688 for (i = 0; i < oa_bufs; i++) {
689 int which = where[i];
692 shift = stripeinfo[which].index + stripeinfo[which].subcount;
693 LASSERT(shift < oa_bufs);
694 ioarr[shift] = pga[i];
695 ioarr[shift].off = lov_offset(lsm, pga[i].off, which);
696 stripeinfo[which].subcount++;
699 for (i = 0, si = stripeinfo; i < stripe_count; i++) {
700 int shift = si->index;
703 LASSERT(shift < oa_bufs);
704 obd_brw(cmd, &lov->tgts[si->ost_idx].conn,
705 &si->lsm, si->bufct, &ioarr[shift],
706 lov_osc_brw_callback, our_cb);
710 rc = callback(cbd, 0, CB_PHASE_START);
712 OBD_FREE(ioarr, sizeof(*ioarr) * oa_bufs);
714 OBD_FREE(where, sizeof(*where) * oa_bufs);
716 OBD_FREE(stripeinfo, stripe_count * sizeof(*stripeinfo));
718 OBD_FREE(our_cb, sizeof(*our_cb));
722 static int lov_enqueue(struct lustre_handle *conn, struct lov_stripe_md *lsm,
723 struct lustre_handle *parent_lock,
724 __u32 type, void *cookie, int cookielen, __u32 mode,
725 int *flags, void *cb, void *data, int datalen,
726 struct lustre_handle *lockhs)
728 struct obd_export *export = class_conn2export(conn);
730 struct lov_oinfo *loi;
735 CERROR("LOV requires striping ea for desctruction\n");
739 if (!export || !export->exp_obd)
742 lov = &export->exp_obd->u.lov;
743 for (i = 0,loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; i++,loi++) {
744 struct ldlm_extent *extent = (struct ldlm_extent *)cookie;
745 struct ldlm_extent sub_ext;
746 struct lov_stripe_md submd;
748 sub_ext.start = lov_offset(lsm, extent->start, i);
749 sub_ext.end = lov_offset(lsm, extent->end, i);
750 if (sub_ext.start == sub_ext.end)
753 submd.lsm_object_id = loi->loi_id;
754 /* XXX submd lsm_mds_easize should be that from the subobj,
755 * and the subobj should get it opaquely from the LOV.
757 submd.lsm_mds_easize = lov_mds_md_size(lsm->lsm_ost_count);
758 submd.lsm_stripe_count = 0;
759 /* XXX submd is not fully initialized here */
760 rc = obd_enqueue(&(lov->tgts[loi->loi_ost_idx].conn), &submd,
761 parent_lock, type, &sub_ext, sizeof(sub_ext),
762 mode, flags, cb, data, datalen, &(lockhs[i]));
763 // XXX add a lock debug statement here
765 CERROR("Error enqueue objid "LPX64" subobj "LPX64
766 " on OST idx %d: rc = %d\n", lsm->lsm_object_id,
767 loi->loi_id, loi->loi_ost_idx, rc);
772 static int lov_cancel(struct lustre_handle *conn, struct lov_stripe_md *lsm,
773 __u32 mode, struct lustre_handle *lockhs)
775 struct obd_export *export = class_conn2export(conn);
777 struct lov_oinfo *loi;
782 CERROR("LOV requires striping ea for lock cancellation\n");
786 if (!export || !export->exp_obd)
789 lov = &export->exp_obd->u.lov;
790 for (i = 0,loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; i++,loi++) {
791 struct lov_stripe_md submd;
793 if (lockhs[i].addr == 0)
796 submd.lsm_object_id = loi->loi_id;
797 submd.lsm_mds_easize = lov_mds_md_size(lsm->lsm_ost_count);
798 submd.lsm_stripe_count = 0;
799 rc = obd_cancel(&lov->tgts[loi->loi_ost_idx].conn, &submd,
802 CERROR("Error cancel objid "LPX64" subobj "LPX64
803 " on OST idx %d: rc = %d\n", lsm->lsm_object_id,
804 loi->loi_id, loi->loi_ost_idx, rc);
809 static int lov_statfs(struct lustre_handle *conn, struct obd_statfs *osfs)
811 struct obd_export *export = class_conn2export(conn);
813 struct obd_statfs lov_sfs;
819 if (!export || !export->exp_obd)
822 lov = &export->exp_obd->u.lov;
824 /* We only get block data from the OBD */
825 for (i = 0 ; i < lov->desc.ld_tgt_count; i++) {
828 err = obd_statfs(&lov->tgts[i].conn, &lov_sfs);
830 CERROR("Error statfs OSC %s idx %d: err = %d\n",
831 lov->tgts[i].uuid, i, err);
834 continue; /* XXX or break? - probably OK to continue */
837 memcpy(osfs, &lov_sfs, sizeof(lov_sfs));
840 osfs->os_bfree += lov_sfs.os_bfree;
841 osfs->os_bavail += lov_sfs.os_bavail;
842 osfs->os_blocks += lov_sfs.os_blocks;
843 /* XXX not sure about this one - depends on policy.
844 * - could be minimum if we always stripe on all OBDs
845 * (but that would be wrong for any other policy,
846 * if one of the OBDs has no more objects left)
847 * - could be sum if we stripe whole objects
848 * - could be average, just to give a nice number
849 * - we just pick first OST and hope it is enough
850 sfs->f_ffree += lov_sfs.f_ffree;
858 struct obd_ops lov_obd_ops = {
860 o_connect: lov_connect,
861 o_disconnect: lov_disconnect,
862 o_create: lov_create,
863 o_destroy: lov_destroy,
864 o_getattr: lov_getattr,
865 o_setattr: lov_setattr,
866 o_statfs: lov_statfs,
871 o_enqueue: lov_enqueue,
876 #define LOV_VERSION "v0.1"
878 static int __init lov_init(void)
880 printk(KERN_INFO "Lustre Logical Object Volume driver " LOV_VERSION
881 ", info@clusterfs.com\n");
882 return class_register_type(&lov_obd_ops, OBD_LOV_DEVICENAME);
885 static void __exit lov_exit(void)
887 class_unregister_type(OBD_LOV_DEVICENAME);
890 MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
891 MODULE_DESCRIPTION("Lustre Logical Object Volume OBD driver v0.1");
892 MODULE_LICENSE("GPL");
894 module_init(lov_init);
895 module_exit(lov_exit);