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