Whamcloud - gitweb
1. Bug fix for Bug #320, also needs repair of lconf, since it tries
[fs/lustre-release.git] / lustre / llite / super25.c
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * Lustre Light Super operations
5  *
6  * This code is issued under the GNU General Public License.
7  * See the file COPYING in this distribution
8  *
9  * Copryright (C) 2002 Cluster File Systems, Inc.
10  */
11
12 #define DEBUG_SUBSYSTEM S_LLITE
13
14 #include <linux/module.h>
15 #include <linux/random.h>
16 #include <linux/version.h>
17 #include <linux/lustre_lite.h>
18 #include <linux/lustre_ha.h>
19 #include <linux/obd_lov.h>
20 #include <linux/lustre_dlm.h>
21 #include <linux/init.h>
22 #include <linux/fs.h>
23 #include <linux/lprocfs_status.h>
24
25 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
26 kmem_cache_t *ll_file_data_slab;
27 extern struct address_space_operations ll_aops;
28 extern struct address_space_operations ll_dir_aops;
29 struct super_operations ll_super_operations;
30
31 extern int ll_init_inodecache(void);
32 extern void ll_destroy_inodecache(void);
33 extern int ll_recover(struct recovd_data *, int);
34 extern int ll_commitcbd_setup(struct ll_sb_info *);
35 extern int ll_commitcbd_cleanup(struct ll_sb_info *);
36 int ll_read_inode2(struct inode *inode, void *opaque);
37
38 extern void ll_proc_namespace(struct super_block* sb, char* osc, char* mdc)
39
40 static char *ll_read_opt(const char *opt, char *data)
41 {
42         char *value;
43         char *retval;
44         ENTRY;
45
46         CDEBUG(D_SUPER, "option: %s, data %s\n", opt, data);
47         if ( strncmp(opt, data, strlen(opt)) )
48                 RETURN(NULL);
49         if ( (value = strchr(data, '=')) == NULL )
50                 RETURN(NULL);
51
52         value++;
53         OBD_ALLOC(retval, strlen(value) + 1);
54         if ( !retval ) {
55                 CERROR("out of memory!\n");
56                 RETURN(NULL);
57         }
58
59         memcpy(retval, value, strlen(value)+1);
60         CDEBUG(D_SUPER, "Assigned option: %s, value %s\n", opt, retval);
61         RETURN(retval);
62 }
63
64 static int ll_set_opt(const char *opt, char *data, int fl)
65 {
66         ENTRY;
67
68         CDEBUG(D_SUPER, "option: %s, data %s\n", opt, data);
69         if ( strncmp(opt, data, strlen(opt)) )
70                 RETURN(0);
71         else
72                 RETURN(fl);
73 }
74
75 static void ll_options(char *options, char **ost, char **mds, int *flags)
76 {
77         char *opt_ptr = options;
78         char *this_char;
79         ENTRY;
80
81         if (!options) {
82                 EXIT;
83                 return;
84         }
85
86         while ((this_char = strsep (&opt_ptr, ",")) != NULL) {
87                 CDEBUG(D_SUPER, "this_char %s\n", this_char);
88                 if ( (!*ost && (*ost = ll_read_opt("osc", this_char)))||
89                      (!*mds && (*mds = ll_read_opt("mdc", this_char)))||
90                      (!(*flags & LL_SBI_NOLCK) && ((*flags) = (*flags) | 
91                       ll_set_opt("nolock", this_char, LL_SBI_NOLCK))) )
92                         continue;
93         }
94         EXIT;
95 }
96
97 #ifndef log2
98 #define log2(n) ffz(~(n))
99 #endif
100
101
102 static int ll_fill_super(struct super_block *sb, void *data, int silent)
103 {
104         struct inode *root = 0;
105         struct obd_device *obd;
106         struct ll_sb_info *sbi;
107         char *osc = NULL;
108         char *mdc = NULL;
109         int err;
110         struct ll_fid rootfid;
111         struct obd_statfs osfs;
112         struct ptlrpc_request *request = NULL;
113         struct ptlrpc_connection *mdc_conn;
114         struct ll_read_inode2_cookie lic;
115         class_uuid_t uuid;
116
117         ENTRY;
118         MOD_INC_USE_COUNT;
119
120         OBD_ALLOC(sbi, sizeof(*sbi));
121         if (!sbi) {
122                 MOD_DEC_USE_COUNT;
123                 RETURN(-ENOMEM);
124         }
125
126         INIT_LIST_HEAD(&sbi->ll_conn_chain);
127         generate_random_uuid(uuid);
128         class_uuid_unparse(uuid, sbi->ll_sb_uuid);
129
130         sb->s_fs_info = sbi;
131
132         ll_options(data, &osc, &mdc, &sbi->ll_flags);
133
134         if (!osc) {
135                 CERROR("no osc\n");
136                 GOTO(out_free, sb = NULL);
137         }
138
139         if (!mdc) {
140                 CERROR("no mdc\n");
141                 GOTO(out_free, sb = NULL);
142         }
143
144         obd = class_uuid2obd(mdc);
145         if (!obd) {
146                 CERROR("MDC %s: not setup or attached\n", mdc);
147                 GOTO(out_free, sb = NULL);
148         }
149
150         err = obd_connect(&sbi->ll_mdc_conn, obd, sbi->ll_sb_uuid,
151                           ptlrpc_recovd, ll_recover);
152         if (err) {
153                 CERROR("cannot connect to %s: rc = %d\n", mdc, err);
154                 GOTO(out_free, sb = NULL);
155         }
156
157 #warning Peter: is this the right place to raise the connection level?
158         mdc_conn = sbi2mdc(sbi)->cl_import.imp_connection;
159         mdc_conn->c_level = LUSTRE_CONN_FULL;
160         list_add(&mdc_conn->c_sb_chain, &sbi->ll_conn_chain);
161
162         obd = class_uuid2obd(osc);
163         if (!obd) {
164                 CERROR("OSC %s: not setup or attached\n", osc);
165                 GOTO(out_mdc, sb = NULL);
166         }
167
168         err = obd_connect(&sbi->ll_osc_conn, obd, sbi->ll_sb_uuid,
169                           ptlrpc_recovd, ll_recover);
170         if (err) {
171                 CERROR("cannot connect to %s: rc = %d\n", osc, err);
172                 GOTO(out_mdc, sb = NULL);
173         }
174
175         err = mdc_getstatus(&sbi->ll_mdc_conn, &rootfid);
176         if (err) {
177                 CERROR("cannot mds_connect: rc = %d\n", err);
178                 GOTO(out_mdc, sb = NULL);
179         }
180         CDEBUG(D_SUPER, "rootfid "LPU64"\n", rootfid.id);
181         sbi->ll_rootino = rootfid.id;
182
183         memset(&osfs, 0, sizeof(osfs));
184         err = mdc_statfs(&sbi->ll_mdc_conn, &osfs);
185         sb->s_blocksize = osfs.os_bsize;
186         sb->s_blocksize_bits = log2(osfs.os_bsize);
187         sb->s_magic = LL_SUPER_MAGIC;
188         sb->s_maxbytes = (1ULL << (32 + 9)) - osfs.os_bsize;
189
190         sb->s_op = &ll_super_operations;
191
192         /* make root inode */
193         err = mdc_getattr(&sbi->ll_mdc_conn, sbi->ll_rootino, S_IFDIR,
194                           OBD_MD_FLNOTOBD|OBD_MD_FLBLOCKS, 0, &request);
195         if (err) {
196                 CERROR("mdc_getattr failed for root: rc = %d\n", err);
197                 GOTO(out_request, sb = NULL);
198         }
199
200         /* initialize committed transaction callback daemon */
201         spin_lock_init(&sbi->ll_commitcbd_lock);
202         init_waitqueue_head(&sbi->ll_commitcbd_waitq);
203         init_waitqueue_head(&sbi->ll_commitcbd_ctl_waitq);
204         sbi->ll_commitcbd_flags = 0;
205         err = ll_commitcbd_setup(sbi);
206         if (err) {
207                 CERROR("failed to start commit callback daemon: rc = %d\n",err);
208                 GOTO(out_request, sb = NULL);
209         }
210
211         lic.lic_body = lustre_msg_buf(request->rq_repmsg, 0);
212         lic.lic_lmm = NULL;
213         root = iget5_locked(sb, sbi->ll_rootino, NULL,
214                             ll_read_inode2, &lic);
215
216         if (root) {
217                 sb->s_root = d_alloc_root(root);
218         } else {
219                 CERROR("lustre_lite: bad iget4 for root\n");
220                 GOTO(out_cdb, sb = NULL);
221         }
222
223         ptlrpc_req_finished(request);
224         request = NULL;
225         ll_proc_namespace(sb, osc, mdc)
226 out_dev:
227         if (mdc)
228                 OBD_FREE(mdc, strlen(mdc) + 1);
229         if (osc)
230                 OBD_FREE(osc, strlen(osc) + 1);
231
232         RETURN(0);
233
234 out_cdb:
235         ll_commitcbd_cleanup(sbi);
236 out_request:
237         ptlrpc_req_finished(request);
238         obd_disconnect(&sbi->ll_osc_conn);
239 out_mdc:
240         obd_disconnect(&sbi->ll_mdc_conn);
241 out_free:
242         OBD_FREE(sbi, sizeof(*sbi));
243
244         MOD_DEC_USE_COUNT;
245         goto out_dev;
246 } /* ll_fill_super */
247
248 struct super_block * ll_get_sb(struct file_system_type *fs_type, 
249                                    int flags, char *devname, void * data)
250 {
251         return get_sb_nodev(fs_type, flags, data, ll_fill_super);
252 }
253
254 static void ll_put_super(struct super_block *sb)
255 {
256         struct ll_sb_info *sbi = ll_s2sbi(sb);
257         struct ll_fid rootfid;
258         ENTRY;
259
260         list_del(&sbi->ll_conn_chain);
261         ll_commitcbd_cleanup(sbi);
262         obd_disconnect(&sbi->ll_osc_conn);
263
264         /* NULL request to force sync on the MDS, and get the last_committed
265          * value to flush remaining RPCs from the pending queue on client.
266          *
267          * XXX This should be an mdc_sync() call to sync the whole MDS fs,
268          *     which we can call for other reasons as well.
269          */
270         mdc_getstatus(&sbi->ll_mdc_conn, &rootfid);
271
272         lprocfs_dereg_mnt(sbi->ll_proc_root);
273         sbi->ll_proc_root=0;
274
275         obd_disconnect(&sbi->ll_mdc_conn);
276         OBD_FREE(sbi, sizeof(*sbi));
277
278         MOD_DEC_USE_COUNT;
279         EXIT;
280 } /* ll_put_super */
281
282 static void ll_clear_inode(struct inode *inode)
283 {
284         ENTRY;
285
286         if (atomic_read(&inode->i_count) == 0) {
287                 struct ll_inode_info *lli = ll_i2info(inode);
288                 struct lov_stripe_md *lsm = lli->lli_smd;
289                 char *symlink_name = lli->lli_symlink_name;
290
291                 if (lsm) {
292                         OBD_FREE(lsm, ll_ost_easize(inode->i_sb));
293                         lli->lli_smd = NULL;
294                 }
295                 if (symlink_name) {
296                         OBD_FREE(symlink_name, strlen(symlink_name) + 1);
297                         lli->lli_symlink_name = NULL;
298                 }
299         }
300         EXIT;
301 }
302
303 static void ll_delete_inode(struct inode *inode)
304 {
305         ENTRY;
306         if (S_ISREG(inode->i_mode)) {
307                 int err;
308                 struct obdo *oa;
309                 struct lov_stripe_md *lsm = ll_i2info(inode)->lli_smd;
310
311                 if (!lsm)
312                         GOTO(out, -EINVAL);
313
314                 if (lsm->lsm_object_id == 0) {
315                         CERROR("This really happens\n");
316                         /* No obdo was ever created */
317                         GOTO(out, 0);
318                 }
319
320                 oa = obdo_alloc();
321                 if (oa == NULL)
322                         GOTO(out, -ENOMEM);
323
324                 oa->o_id = lsm->lsm_object_id;
325                 oa->o_easize = ll_mds_easize(inode->i_sb);
326                 oa->o_mode = inode->i_mode;
327                 oa->o_valid = OBD_MD_FLID | OBD_MD_FLEASIZE | OBD_MD_FLTYPE;
328
329                 err = obd_destroy(ll_i2obdconn(inode), oa, lsm);
330                 obdo_free(oa);
331                 CDEBUG(D_SUPER, "obd destroy of objid "LPX64" error %d\n",
332                        lsm->lsm_object_id, err);
333         }
334 out:
335         clear_inode(inode);
336         EXIT;
337 }
338
339 /* like inode_setattr, but doesn't mark the inode dirty */
340 static int ll_attr2inode(struct inode * inode, struct iattr * attr, int trunc)
341 {
342         unsigned int ia_valid = attr->ia_valid;
343         int error = 0;
344
345         if ((ia_valid & ATTR_SIZE) && trunc) {
346                 error = vmtruncate(inode, attr->ia_size);
347                 if (error)
348                         goto out;
349         } else if (ia_valid & ATTR_SIZE)
350                 inode->i_size = attr->ia_size;
351
352         if (ia_valid & ATTR_UID)
353                 inode->i_uid = attr->ia_uid;
354         if (ia_valid & ATTR_GID)
355                 inode->i_gid = attr->ia_gid;
356         if (ia_valid & ATTR_ATIME)
357                 inode->i_atime = attr->ia_atime;
358         if (ia_valid & ATTR_MTIME)
359                 inode->i_mtime = attr->ia_mtime;
360         if (ia_valid & ATTR_CTIME)
361                 inode->i_ctime = attr->ia_ctime;
362         if (ia_valid & ATTR_MODE) {
363                 inode->i_mode = attr->ia_mode;
364                 if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID))
365                         inode->i_mode &= ~S_ISGID;
366         }
367 out:
368         return error;
369 }
370
371 int ll_inode_setattr(struct inode *inode, struct iattr *attr, int do_trunc)
372 {
373         struct ptlrpc_request *request = NULL;
374         struct ll_sb_info *sbi = ll_i2sbi(inode);
375         int err;
376
377         ENTRY;
378
379         /* change incore inode */
380         ll_attr2inode(inode, attr, do_trunc);
381
382         err = mdc_setattr(&sbi->ll_mdc_conn, inode, attr, &request);
383         if (err)
384                 CERROR("mdc_setattr fails (%d)\n", err);
385
386         ptlrpc_req_finished(request);
387
388         RETURN(err);
389 }
390
391 int ll_setattr(struct dentry *de, struct iattr *attr)
392 {
393         int rc = inode_change_ok(de->d_inode, attr);
394
395         if (rc)
396                 return rc;
397
398         return ll_inode_setattr(de->d_inode, attr, 1);
399 }
400
401 static int ll_statfs(struct super_block *sb, struct statfs *sfs)
402 {
403         struct ll_sb_info *sbi = ll_s2sbi(sb);
404         struct obd_statfs osfs;
405         int rc;
406         ENTRY;
407
408         memset(sfs, 0, sizeof(*sfs));
409         rc = obd_statfs(&sbi->ll_mdc_conn, &osfs);
410         statfs_unpack(sfs, &osfs);
411         if (rc)
412                 CERROR("mdc_statfs fails: rc = %d\n", rc);
413         else
414                 CDEBUG(D_SUPER, "mdc_statfs shows blocks "LPU64"/"LPU64
415                        " objects "LPU64"/"LPU64"\n",
416                        osfs.os_bavail, osfs.os_blocks,
417                        osfs.os_ffree, osfs.os_files);
418
419         /* temporary until mds_statfs returns statfs info for all OSTs */
420         if (!rc) {
421                 rc = obd_statfs(&sbi->ll_osc_conn, &osfs);
422                 if (rc) {
423                         CERROR("obd_statfs fails: rc = %d\n", rc);
424                         GOTO(out, rc);
425                 }
426                 CDEBUG(D_SUPER, "obd_statfs shows blocks "LPU64"/"LPU64
427                        " objects "LPU64"/"LPU64"\n",
428                        osfs.os_bavail, osfs.os_blocks,
429                        osfs.os_ffree, osfs.os_files);
430
431                 while (osfs.os_blocks > ~0UL) {
432                         sfs->f_bsize <<= 1;
433
434                         osfs.os_blocks >>= 1;
435                         osfs.os_bfree >>= 1;
436                         osfs.os_bavail >>= 1;
437                 }
438                 sfs->f_blocks = osfs.os_blocks;
439                 sfs->f_bfree = osfs.os_bfree;
440                 sfs->f_bavail = osfs.os_bavail;
441                 if (osfs.os_ffree < (__u64)sfs->f_ffree)
442                         sfs->f_ffree = osfs.os_ffree;
443         }
444
445 out:
446         RETURN(rc);
447 }
448
449 void ll_update_inode(struct inode *inode, struct mds_body *body)
450 {
451         if (body->valid & OBD_MD_FLID)
452                 inode->i_ino = body->ino;
453         if (body->valid & OBD_MD_FLATIME)
454                 inode->i_atime = body->atime;
455         if (body->valid & OBD_MD_FLMTIME)
456                 inode->i_mtime = body->mtime;
457         if (body->valid & OBD_MD_FLCTIME)
458                 inode->i_ctime = body->ctime;
459         if (body->valid & OBD_MD_FLMODE)
460                 inode->i_mode = (inode->i_mode & S_IFMT)|(body->mode & ~S_IFMT);
461         if (body->valid & OBD_MD_FLTYPE)
462                 inode->i_mode = (inode->i_mode & ~S_IFMT)|(body->mode & S_IFMT);
463         if (body->valid & OBD_MD_FLUID)
464                 inode->i_uid = body->uid;
465         if (body->valid & OBD_MD_FLGID)
466                 inode->i_gid = body->gid;
467         if (body->valid & OBD_MD_FLFLAGS)
468                 inode->i_flags = body->flags;
469         if (body->valid & OBD_MD_FLNLINK)
470                 inode->i_nlink = body->nlink;
471         if (body->valid & OBD_MD_FLGENER)
472                 inode->i_generation = body->generation;
473         if (body->valid & OBD_MD_FLRDEV)
474                 inode->i_rdev = to_kdev_t(body->rdev);
475         if (body->valid & OBD_MD_FLSIZE)
476                 inode->i_size = body->size;
477 }
478
479 int ll_read_inode2(struct inode *inode, void *opaque)
480 {
481         struct ll_read_inode2_cookie *lic = opaque;
482         struct mds_body *body = lic->lic_body;
483         struct ll_inode_info *lli = ll_i2info(inode);
484         ENTRY;
485
486         sema_init(&lli->lli_open_sem, 1);
487
488         /* core attributes first */
489         ll_update_inode(inode, body);
490
491         //if (body->valid & OBD_MD_FLEASIZE)
492         if (lic && lic->lic_lmm) {
493                 struct lov_mds_md *lmm = lic->lic_lmm;
494                 int size;
495
496                 /* XXX This should probably not be an error in the future,
497                  *     when we allow LOV OSTs to be added.
498                  */
499                 if (lmm->lmm_easize != ll_mds_easize(inode->i_sb)) {
500                         CERROR("Striping metadata size error %ld\n",
501                                inode->i_ino);
502                         LBUG();
503                 }
504                 size = ll_ost_easize(inode->i_sb);
505                 OBD_ALLOC(lli->lli_smd, size);
506                 if (!lli->lli_smd) {
507                         CERROR("No memory for %d\n", size);
508                         LBUG();
509                 }
510                 lov_unpackmd(lli->lli_smd, lmm);
511         } else {
512                 lli->lli_smd = NULL;
513         }
514
515         /* Get the authoritative file size */
516         if (lli->lli_smd && (inode->i_mode & S_IFREG)) {
517                 int rc;
518
519                 rc = ll_file_size(inode, lli->lli_smd);
520                 if (rc) {
521                         CERROR("ll_file_size: %d\n", rc);
522                         /* FIXME: need to somehow prevent inode creation */
523                         LBUG();
524                 }
525         }
526
527         /* OIDEBUG(inode); */
528
529         if (S_ISREG(inode->i_mode)) {
530                 inode->i_op = &ll_file_inode_operations;
531                 inode->i_fop = &ll_file_operations;
532                 inode->i_mapping->a_ops = &ll_aops;
533                 EXIT;
534         } else if (S_ISDIR(inode->i_mode)) {
535                 inode->i_op = &ll_dir_inode_operations;
536                 inode->i_fop = &ll_dir_operations;
537                 inode->i_mapping->a_ops = &ll_dir_aops;
538                 EXIT;
539         } else if (S_ISLNK(inode->i_mode)) {
540                 inode->i_op = &ll_fast_symlink_inode_operations;
541                 EXIT;
542         } else {
543                 init_special_inode(inode, inode->i_mode,
544                                    kdev_t_to_nr(inode->i_rdev));
545                 EXIT;
546         }
547         return 0;
548 }
549
550 static inline void invalidate_request_list(struct list_head *req_list)
551 {
552         struct list_head *tmp, *n;
553         list_for_each_safe(tmp, n, req_list) {
554                 struct ptlrpc_request *req = 
555                         list_entry(tmp, struct ptlrpc_request, rq_list);
556                 CERROR("invalidating req xid %d op %d to %s:%d\n",
557                        (unsigned long long)req->rq_xid, req->rq_reqmsg->opc,
558                        req->rq_connection->c_remote_uuid,
559                        req->rq_import->imp_client->cli_request_portal);
560                 req->rq_flags |= PTL_RPC_FL_ERR;
561                 wake_up(&req->rq_wait_for_rep);
562         }
563 }
564
565 void ll_umount_begin(struct super_block *sb)
566 {
567         struct ll_sb_info *sbi = ll_s2sbi(sb);
568         struct list_head *ctmp;
569
570         ENTRY;
571        
572         list_for_each(ctmp, &sbi->ll_conn_chain) {
573                 struct ptlrpc_connection *conn;
574                 conn = list_entry(ctmp, struct ptlrpc_connection, c_sb_chain);
575
576                 spin_lock(&conn->c_lock);
577                 conn->c_flags |= CONN_INVALID;
578                 invalidate_request_list(&conn->c_sending_head);
579                 invalidate_request_list(&conn->c_delayed_head);
580                 spin_unlock(&conn->c_lock);
581         }
582
583         EXIT;
584 }
585
586
587 static kmem_cache_t *ll_inode_cachep;
588
589 static struct inode *ll_alloc_inode(struct super_block *sb)
590 {
591         struct ll_inode_info *lli;
592         lli = kmem_cache_alloc(ll_inode_cachep, SLAB_KERNEL);
593         if (!lli)
594                 return NULL;
595
596         memset(lli, 0, (char *)&lli->lli_vfs_inode - (char *)lli);
597         sema_init(&lli->lli_open_sem, 1);
598
599         return &lli->lli_vfs_inode;
600 }
601
602 static void ll_destroy_inode(struct inode *inode)
603 {
604         kmem_cache_free(ll_inode_cachep, ll_i2info(inode));
605 }
606
607 static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags)
608 {
609         struct ll_inode_info *lli = foo;
610
611         if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
612             SLAB_CTOR_CONSTRUCTOR)
613                 inode_init_once(&lli->lli_vfs_inode);
614 }
615
616 int ll_init_inodecache(void)
617 {
618         ll_inode_cachep = kmem_cache_create("lustre_inode_cache",
619                                             sizeof(struct ll_inode_info),
620                                             0, SLAB_HWCACHE_ALIGN,
621                                             init_once, NULL);
622         if (ll_inode_cachep == NULL)
623                 return -ENOMEM;
624         return 0;
625 }
626
627 void ll_destroy_inodecache(void)
628 {
629         if (kmem_cache_destroy(ll_inode_cachep))
630                 CERROR("ll_inode_cache: not all structures were freed\n");
631 }
632
633
634
635 /* exported operations */
636 struct super_operations ll_super_operations =
637 {
638         alloc_inode: ll_alloc_inode,
639         destroy_inode: ll_destroy_inode,
640         clear_inode: ll_clear_inode,
641         delete_inode: ll_delete_inode,
642         put_super: ll_put_super,
643         statfs: ll_statfs,
644         umount_begin: ll_umount_begin
645 };
646
647 struct file_system_type lustre_lite_fs_type = {
648         .owner  = THIS_MODULE,
649         .name =   "lustre_lite", 
650         .get_sb = ll_get_sb,
651         .kill_sb = kill_litter_super,
652 };
653
654 static int __init init_lustre_lite(void)
655 {
656         int rc;
657         printk(KERN_INFO "Lustre Lite 0.5.14, info@clusterfs.com\n");
658         rc = ll_init_inodecache();
659         if (rc) 
660                 return -ENOMEM;
661         ll_file_data_slab = kmem_cache_create("ll_file_data",
662                                               sizeof(struct ll_file_data), 0,
663                                               SLAB_HWCACHE_ALIGN, NULL, NULL);
664         if (ll_file_data_slab == NULL) { 
665                 ll_destroy_inodecache();
666                 return -ENOMEM;
667         }
668         return register_filesystem(&lustre_lite_fs_type);
669 }
670
671 static void __exit exit_lustre_lite(void)
672 {
673         unregister_filesystem(&lustre_lite_fs_type);
674         ll_destroy_inodecache();
675         kmem_cache_destroy(ll_file_data_slab);
676 }
677
678 MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
679 MODULE_DESCRIPTION("Lustre Lite Client File System v1.0");
680 MODULE_LICENSE("GPL");
681
682 module_init(init_lustre_lite);
683 module_exit(exit_lustre_lite);
684 #endif