2 * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README
4 * Trivial changes by Alan Cox to add the LFS fixes
7 * Rights granted to Hans Reiser to redistribute under other terms providing
8 * he accepts all liability including but not limited to patent, fitness
9 * for purpose, and direct or indirect claims arising from failure to perform.
14 #include <linux/module.h>
15 #include <linux/vmalloc.h>
16 #include <linux/time.h>
17 #include <asm/uaccess.h>
18 #include <linux/reiserfs_fs.h>
19 #include <linux/reiserfs_acl.h>
20 #include <linux/reiserfs_xattr.h>
21 #include <linux/smp_lock.h>
22 #include <linux/init.h>
23 #include <linux/blkdev.h>
24 #include <linux/buffer_head.h>
25 #include <linux/vfs.h>
26 #include <linux/namespace.h>
27 #include <linux/mount.h>
28 #include <linux/namei.h>
29 #include <linux/quotaops.h>
31 struct file_system_type reiserfs_fs_type;
33 static const char reiserfs_3_5_magic_string[] = REISERFS_SUPER_MAGIC_STRING;
34 static const char reiserfs_3_6_magic_string[] = REISER2FS_SUPER_MAGIC_STRING;
35 static const char reiserfs_jr_magic_string[] = REISER2FS_JR_SUPER_MAGIC_STRING;
37 int is_reiserfs_3_5(struct reiserfs_super_block *rs)
39 return !strncmp(rs->s_v1.s_magic, reiserfs_3_5_magic_string,
40 strlen(reiserfs_3_5_magic_string));
43 int is_reiserfs_3_6(struct reiserfs_super_block *rs)
45 return !strncmp(rs->s_v1.s_magic, reiserfs_3_6_magic_string,
46 strlen(reiserfs_3_6_magic_string));
49 int is_reiserfs_jr(struct reiserfs_super_block *rs)
51 return !strncmp(rs->s_v1.s_magic, reiserfs_jr_magic_string,
52 strlen(reiserfs_jr_magic_string));
55 static int is_any_reiserfs_magic_string(struct reiserfs_super_block *rs)
57 return (is_reiserfs_3_5(rs) || is_reiserfs_3_6(rs) ||
61 static int reiserfs_remount(struct super_block *s, int *flags, char *data);
62 static int reiserfs_statfs(struct dentry *dentry, struct kstatfs *buf);
64 static int reiserfs_sync_fs(struct super_block *s, int wait)
66 if (!(s->s_flags & MS_RDONLY)) {
67 struct reiserfs_transaction_handle th;
68 reiserfs_write_lock(s);
69 if (!journal_begin(&th, s, 1))
70 if (!journal_end_sync(&th, s, 1))
71 reiserfs_flush_old_commits(s);
72 s->s_dirt = 0; /* Even if it's not true.
73 * We'll loop forever in sync_supers otherwise */
74 reiserfs_write_unlock(s);
81 static void reiserfs_write_super(struct super_block *s)
83 reiserfs_sync_fs(s, 1);
86 static void reiserfs_write_super_lockfs(struct super_block *s)
88 struct reiserfs_transaction_handle th;
89 reiserfs_write_lock(s);
90 if (!(s->s_flags & MS_RDONLY)) {
91 int err = journal_begin(&th, s, 1);
93 reiserfs_block_writes(&th);
95 reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s),
97 journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB(s));
98 reiserfs_block_writes(&th);
99 journal_end_sync(&th, s, 1);
103 reiserfs_write_unlock(s);
106 static void reiserfs_unlockfs(struct super_block *s)
108 reiserfs_allow_writes(s);
111 extern const struct in_core_key MAX_IN_CORE_KEY;
113 /* this is used to delete "save link" when there are no items of a
114 file it points to. It can either happen if unlink is completed but
115 "save unlink" removal, or if file has both unlink and truncate
116 pending and as unlink completes first (because key of "save link"
117 protecting unlink is bigger that a key lf "save link" which
118 protects truncate), so there left no items to make truncate
120 static int remove_save_link_only(struct super_block *s,
121 struct reiserfs_key *key, int oid_free)
123 struct reiserfs_transaction_handle th;
126 /* we are going to do one balancing */
127 err = journal_begin(&th, s, JOURNAL_PER_BALANCE_CNT);
131 reiserfs_delete_solid_item(&th, NULL, key);
133 /* removals are protected by direct items */
134 reiserfs_release_objectid(&th, le32_to_cpu(key->k_objectid));
136 return journal_end(&th, s, JOURNAL_PER_BALANCE_CNT);
140 static int reiserfs_quota_on_mount(struct super_block *, int);
143 /* look for uncompleted unlinks and truncates and complete them */
144 static int finish_unfinished(struct super_block *s)
146 INITIALIZE_PATH(path);
147 struct cpu_key max_cpu_key, obj_key;
148 struct reiserfs_key save_link_key;
150 struct item_head *ih;
151 struct buffer_head *bh;
162 /* compose key to look for "save" links */
163 max_cpu_key.version = KEY_FORMAT_3_5;
164 max_cpu_key.on_disk_key.k_dir_id = ~0U;
165 max_cpu_key.on_disk_key.k_objectid = ~0U;
166 set_cpu_key_k_offset(&max_cpu_key, ~0U);
167 max_cpu_key.key_length = 3;
170 /* Needed for iput() to work correctly and not trash data */
171 if (s->s_flags & MS_ACTIVE) {
175 s->s_flags |= MS_ACTIVE;
177 /* Turn on quotas so that they are updated correctly */
178 for (i = 0; i < MAXQUOTAS; i++) {
179 if (REISERFS_SB(s)->s_qf_names[i]) {
180 int ret = reiserfs_quota_on_mount(s, i);
183 "reiserfs: cannot turn on journalled quota: error %d",
190 REISERFS_SB(s)->s_is_unlinked_ok = 1;
192 retval = search_item(s, &max_cpu_key, &path);
193 if (retval != ITEM_NOT_FOUND) {
195 "vs-2140: finish_unfinished: search_by_key returned %d",
200 bh = get_last_bh(&path);
201 item_pos = get_item_pos(&path);
202 if (item_pos != B_NR_ITEMS(bh)) {
204 "vs-2060: finish_unfinished: wrong position found");
208 ih = B_N_PITEM_HEAD(bh, item_pos);
210 if (le32_to_cpu(ih->ih_key.k_dir_id) != MAX_KEY_OBJECTID)
211 /* there are no "save" links anymore */
214 save_link_key = ih->ih_key;
215 if (is_indirect_le_ih(ih))
220 /* reiserfs_iget needs k_dirid and k_objectid only */
221 item = B_I_PITEM(bh, ih);
222 obj_key.on_disk_key.k_dir_id = le32_to_cpu(*(__le32 *) item);
223 obj_key.on_disk_key.k_objectid =
224 le32_to_cpu(ih->ih_key.k_objectid);
225 obj_key.on_disk_key.k_offset = 0;
226 obj_key.on_disk_key.k_type = 0;
230 inode = reiserfs_iget(s, &obj_key);
232 /* the unlink almost completed, it just did not manage to remove
233 "save" link and release objectid */
235 "vs-2180: finish_unfinished: iget failed for %K",
237 retval = remove_save_link_only(s, &save_link_key, 1);
241 if (!truncate && inode->i_nlink) {
242 /* file is not unlinked */
244 "vs-2185: finish_unfinished: file %K is not unlinked",
246 retval = remove_save_link_only(s, &save_link_key, 0);
251 if (truncate && S_ISDIR(inode->i_mode)) {
252 /* We got a truncate request for a dir which is impossible.
253 The only imaginable way is to execute unfinished truncate request
254 then boot into old kernel, remove the file and create dir with
257 "green-2101: impossible truncate on a directory %k. Please report",
259 retval = remove_save_link_only(s, &save_link_key, 0);
266 REISERFS_I(inode)->i_flags |=
267 i_link_saved_truncate_mask;
268 /* not completed truncate found. New size was committed together
270 reiserfs_info(s, "Truncating %k to %Ld ..",
271 INODE_PKEY(inode), inode->i_size);
272 reiserfs_truncate_file(inode,
274 /*don't update modification time */
276 retval = remove_save_link(inode, truncate);
278 REISERFS_I(inode)->i_flags |= i_link_saved_unlink_mask;
279 /* not completed unlink (rmdir) found */
280 reiserfs_info(s, "Removing %k..", INODE_PKEY(inode));
281 /* removal gets completed in iput */
289 REISERFS_SB(s)->s_is_unlinked_ok = 0;
292 /* Turn quotas off */
293 for (i = 0; i < MAXQUOTAS; i++) {
294 if (sb_dqopt(s)->files[i])
295 vfs_quota_off_mount(s, i);
298 /* Restore the flag back */
299 s->s_flags &= ~MS_ACTIVE;
303 reiserfs_info(s, "There were %d uncompleted unlinks/truncates. "
304 "Completed\n", done);
308 /* to protect file being unlinked from getting lost we "safe" link files
309 being unlinked. This link will be deleted in the same transaction with last
310 item of file. mounting the filesytem we scan all these links and remove
311 files which almost got lost */
312 void add_save_link(struct reiserfs_transaction_handle *th,
313 struct inode *inode, int truncate)
315 INITIALIZE_PATH(path);
321 BUG_ON(!th->t_trans_id);
323 /* file can only get one "save link" of each kind */
325 (REISERFS_I(inode)->i_flags & i_link_saved_truncate_mask),
326 "saved link already exists for truncated inode %lx",
329 (REISERFS_I(inode)->i_flags & i_link_saved_unlink_mask),
330 "saved link already exists for unlinked inode %lx",
333 /* setup key of "save" link */
334 key.version = KEY_FORMAT_3_5;
335 key.on_disk_key.k_dir_id = MAX_KEY_OBJECTID;
336 key.on_disk_key.k_objectid = inode->i_ino;
338 /* unlink, rmdir, rename */
339 set_cpu_key_k_offset(&key, 1 + inode->i_sb->s_blocksize);
340 set_cpu_key_k_type(&key, TYPE_DIRECT);
342 /* item head of "safe" link */
343 make_le_item_head(&ih, &key, key.version,
344 1 + inode->i_sb->s_blocksize, TYPE_DIRECT,
345 4 /*length */ , 0xffff /*free space */ );
348 if (S_ISDIR(inode->i_mode))
349 reiserfs_warning(inode->i_sb,
350 "green-2102: Adding a truncate savelink for a directory %k! Please report",
352 set_cpu_key_k_offset(&key, 1);
353 set_cpu_key_k_type(&key, TYPE_INDIRECT);
355 /* item head of "safe" link */
356 make_le_item_head(&ih, &key, key.version, 1, TYPE_INDIRECT,
357 4 /*length */ , 0 /*free space */ );
361 /* look for its place in the tree */
362 retval = search_item(inode->i_sb, &key, &path);
363 if (retval != ITEM_NOT_FOUND) {
364 if (retval != -ENOSPC)
365 reiserfs_warning(inode->i_sb, "vs-2100: add_save_link:"
366 "search_by_key (%K) returned %d", &key,
372 /* body of "save" link */
373 link = INODE_PKEY(inode)->k_dir_id;
375 /* put "save" link inot tree, don't charge quota to anyone */
377 reiserfs_insert_item(th, &path, &key, &ih, NULL, (char *)&link);
379 if (retval != -ENOSPC)
380 reiserfs_warning(inode->i_sb,
381 "vs-2120: add_save_link: insert_item returned %d",
385 REISERFS_I(inode)->i_flags |=
386 i_link_saved_truncate_mask;
388 REISERFS_I(inode)->i_flags |= i_link_saved_unlink_mask;
392 /* this opens transaction unlike add_save_link */
393 int remove_save_link(struct inode *inode, int truncate)
395 struct reiserfs_transaction_handle th;
396 struct reiserfs_key key;
399 /* we are going to do one balancing only */
400 err = journal_begin(&th, inode->i_sb, JOURNAL_PER_BALANCE_CNT);
404 /* setup key of "save" link */
405 key.k_dir_id = cpu_to_le32(MAX_KEY_OBJECTID);
406 key.k_objectid = INODE_PKEY(inode)->k_objectid;
408 /* unlink, rmdir, rename */
409 set_le_key_k_offset(KEY_FORMAT_3_5, &key,
410 1 + inode->i_sb->s_blocksize);
411 set_le_key_k_type(KEY_FORMAT_3_5, &key, TYPE_DIRECT);
414 set_le_key_k_offset(KEY_FORMAT_3_5, &key, 1);
415 set_le_key_k_type(KEY_FORMAT_3_5, &key, TYPE_INDIRECT);
419 (REISERFS_I(inode)->i_flags & i_link_saved_truncate_mask)) ||
421 (REISERFS_I(inode)->i_flags & i_link_saved_unlink_mask)))
422 /* don't take quota bytes from anywhere */
423 reiserfs_delete_solid_item(&th, NULL, &key);
425 reiserfs_release_objectid(&th, inode->i_ino);
426 REISERFS_I(inode)->i_flags &= ~i_link_saved_unlink_mask;
428 REISERFS_I(inode)->i_flags &= ~i_link_saved_truncate_mask;
430 return journal_end(&th, inode->i_sb, JOURNAL_PER_BALANCE_CNT);
433 static void reiserfs_put_super(struct super_block *s)
436 struct reiserfs_transaction_handle th;
439 if (REISERFS_SB(s)->xattr_root) {
440 d_invalidate(REISERFS_SB(s)->xattr_root);
441 dput(REISERFS_SB(s)->xattr_root);
444 if (REISERFS_SB(s)->priv_root) {
445 d_invalidate(REISERFS_SB(s)->priv_root);
446 dput(REISERFS_SB(s)->priv_root);
449 /* change file system state to current state if it was mounted with read-write permissions */
450 if (!(s->s_flags & MS_RDONLY)) {
451 if (!journal_begin(&th, s, 10)) {
452 reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s),
454 set_sb_umount_state(SB_DISK_SUPER_BLOCK(s),
455 REISERFS_SB(s)->s_mount_state);
456 journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB(s));
460 /* note, journal_release checks for readonly mount, and can decide not
461 ** to do a journal_end
463 journal_release(&th, s);
465 for (i = 0; i < SB_BMAP_NR(s); i++)
466 brelse(SB_AP_BITMAP(s)[i].bh);
468 vfree(SB_AP_BITMAP(s));
470 brelse(SB_BUFFER_WITH_SB(s));
474 if (REISERFS_SB(s)->reserved_blocks != 0) {
476 "green-2005: reiserfs_put_super: reserved blocks left %d",
477 REISERFS_SB(s)->reserved_blocks);
480 reiserfs_proc_info_done(s);
488 static kmem_cache_t *reiserfs_inode_cachep;
490 static struct inode *reiserfs_alloc_inode(struct super_block *sb)
492 struct reiserfs_inode_info *ei;
493 ei = (struct reiserfs_inode_info *)
494 kmem_cache_alloc(reiserfs_inode_cachep, SLAB_KERNEL);
497 return &ei->vfs_inode;
500 static void reiserfs_destroy_inode(struct inode *inode)
502 kmem_cache_free(reiserfs_inode_cachep, REISERFS_I(inode));
505 static void init_once(void *foo, kmem_cache_t * cachep, unsigned long flags)
507 struct reiserfs_inode_info *ei = (struct reiserfs_inode_info *)foo;
509 if ((flags & (SLAB_CTOR_VERIFY | SLAB_CTOR_CONSTRUCTOR)) ==
510 SLAB_CTOR_CONSTRUCTOR) {
511 INIT_LIST_HEAD(&ei->i_prealloc_list);
512 inode_init_once(&ei->vfs_inode);
513 ei->i_acl_access = NULL;
514 ei->i_acl_default = NULL;
518 static int init_inodecache(void)
520 reiserfs_inode_cachep = kmem_cache_create("reiser_inode_cache",
522 reiserfs_inode_info),
523 0, (SLAB_RECLAIM_ACCOUNT|
526 if (reiserfs_inode_cachep == NULL)
531 static void destroy_inodecache(void)
533 if (kmem_cache_destroy(reiserfs_inode_cachep))
534 reiserfs_warning(NULL,
535 "reiserfs_inode_cache: not all structures were freed");
538 /* we don't mark inodes dirty, we just log them */
539 static void reiserfs_dirty_inode(struct inode *inode)
541 struct reiserfs_transaction_handle th;
544 if (inode->i_sb->s_flags & MS_RDONLY) {
545 reiserfs_warning(inode->i_sb,
546 "clm-6006: writing inode %lu on readonly FS",
550 reiserfs_write_lock(inode->i_sb);
552 /* this is really only used for atime updates, so they don't have
553 ** to be included in O_SYNC or fsync
555 err = journal_begin(&th, inode->i_sb, 1);
557 reiserfs_write_unlock(inode->i_sb);
560 reiserfs_update_sd(&th, inode);
561 journal_end(&th, inode->i_sb, 1);
562 reiserfs_write_unlock(inode->i_sb);
565 static void reiserfs_clear_inode(struct inode *inode)
567 struct posix_acl *acl;
569 acl = REISERFS_I(inode)->i_acl_access;
570 if (acl && !IS_ERR(acl))
571 posix_acl_release(acl);
572 REISERFS_I(inode)->i_acl_access = NULL;
574 acl = REISERFS_I(inode)->i_acl_default;
575 if (acl && !IS_ERR(acl))
576 posix_acl_release(acl);
577 REISERFS_I(inode)->i_acl_default = NULL;
581 static ssize_t reiserfs_quota_write(struct super_block *, int, const char *,
583 static ssize_t reiserfs_quota_read(struct super_block *, int, char *, size_t,
587 static struct super_operations reiserfs_sops = {
588 .alloc_inode = reiserfs_alloc_inode,
589 .destroy_inode = reiserfs_destroy_inode,
590 .write_inode = reiserfs_write_inode,
591 .dirty_inode = reiserfs_dirty_inode,
592 .delete_inode = reiserfs_delete_inode,
593 .clear_inode = reiserfs_clear_inode,
594 .put_super = reiserfs_put_super,
595 .write_super = reiserfs_write_super,
596 .sync_fs = reiserfs_sync_fs,
597 .write_super_lockfs = reiserfs_write_super_lockfs,
598 .unlockfs = reiserfs_unlockfs,
599 .statfs = reiserfs_statfs,
600 .remount_fs = reiserfs_remount,
602 .quota_read = reiserfs_quota_read,
603 .quota_write = reiserfs_quota_write,
608 #define QTYPE2NAME(t) ((t)==USRQUOTA?"user":"group")
610 static int reiserfs_dquot_initialize(struct inode *, int);
611 static int reiserfs_dquot_drop(struct inode *);
612 static int reiserfs_write_dquot(struct dquot *);
613 static int reiserfs_acquire_dquot(struct dquot *);
614 static int reiserfs_release_dquot(struct dquot *);
615 static int reiserfs_mark_dquot_dirty(struct dquot *);
616 static int reiserfs_write_info(struct super_block *, int);
617 static int reiserfs_quota_on(struct super_block *, int, int, char *);
619 static struct dquot_operations reiserfs_quota_operations = {
620 .initialize = reiserfs_dquot_initialize,
621 .drop = reiserfs_dquot_drop,
622 .alloc_space = dquot_alloc_space,
623 .alloc_inode = dquot_alloc_inode,
624 .free_space = dquot_free_space,
625 .free_inode = dquot_free_inode,
626 .transfer = dquot_transfer,
627 .write_dquot = reiserfs_write_dquot,
628 .acquire_dquot = reiserfs_acquire_dquot,
629 .release_dquot = reiserfs_release_dquot,
630 .mark_dirty = reiserfs_mark_dquot_dirty,
631 .write_info = reiserfs_write_info,
634 static struct quotactl_ops reiserfs_qctl_operations = {
635 .quota_on = reiserfs_quota_on,
636 .quota_off = vfs_quota_off,
637 .quota_sync = vfs_quota_sync,
638 .get_info = vfs_get_dqinfo,
639 .set_info = vfs_set_dqinfo,
640 .get_dqblk = vfs_get_dqblk,
641 .set_dqblk = vfs_set_dqblk,
645 static struct export_operations reiserfs_export_ops = {
646 .encode_fh = reiserfs_encode_fh,
647 .decode_fh = reiserfs_decode_fh,
648 .get_parent = reiserfs_get_parent,
649 .get_dentry = reiserfs_get_dentry,
652 /* this struct is used in reiserfs_getopt () for containing the value for those
653 mount options that have values rather than being toggles. */
656 int setmask; /* bitmask which is to set on mount_options bitmask when this
657 value is found, 0 is no bits are to be changed. */
658 int clrmask; /* bitmask which is to clear on mount_options bitmask when this
659 value is found, 0 is no bits are to be changed. This is
660 applied BEFORE setmask */
663 /* Set this bit in arg_required to allow empty arguments */
664 #define REISERFS_OPT_ALLOWEMPTY 31
666 /* this struct is used in reiserfs_getopt() for describing the set of reiserfs
670 int arg_required; /* 0 if argument is not required, not 0 otherwise */
671 const arg_desc_t *values; /* list of values accepted by an option */
672 int setmask; /* bitmask which is to set on mount_options bitmask when this
673 value is found, 0 is no bits are to be changed. */
674 int clrmask; /* bitmask which is to clear on mount_options bitmask when this
675 value is found, 0 is no bits are to be changed. This is
676 applied BEFORE setmask */
679 /* possible values for -o data= */
680 static const arg_desc_t logging_mode[] = {
681 {"ordered", 1 << REISERFS_DATA_ORDERED,
682 (1 << REISERFS_DATA_LOG | 1 << REISERFS_DATA_WRITEBACK)},
683 {"journal", 1 << REISERFS_DATA_LOG,
684 (1 << REISERFS_DATA_ORDERED | 1 << REISERFS_DATA_WRITEBACK)},
685 {"writeback", 1 << REISERFS_DATA_WRITEBACK,
686 (1 << REISERFS_DATA_ORDERED | 1 << REISERFS_DATA_LOG)},
690 /* possible values for -o barrier= */
691 static const arg_desc_t barrier_mode[] = {
692 {"none", 1 << REISERFS_BARRIER_NONE, 1 << REISERFS_BARRIER_FLUSH},
693 {"flush", 1 << REISERFS_BARRIER_FLUSH, 1 << REISERFS_BARRIER_NONE},
697 /* possible values for "-o block-allocator=" and bits which are to be set in
698 s_mount_opt of reiserfs specific part of in-core super block */
699 static const arg_desc_t balloc[] = {
700 {"noborder", 1 << REISERFS_NO_BORDER, 0},
701 {"border", 0, 1 << REISERFS_NO_BORDER},
702 {"no_unhashed_relocation", 1 << REISERFS_NO_UNHASHED_RELOCATION, 0},
703 {"hashed_relocation", 1 << REISERFS_HASHED_RELOCATION, 0},
704 {"test4", 1 << REISERFS_TEST4, 0},
705 {"notest4", 0, 1 << REISERFS_TEST4},
709 static const arg_desc_t tails[] = {
710 {"on", 1 << REISERFS_LARGETAIL, 1 << REISERFS_SMALLTAIL},
711 {"off", 0, (1 << REISERFS_LARGETAIL) | (1 << REISERFS_SMALLTAIL)},
712 {"small", 1 << REISERFS_SMALLTAIL, 1 << REISERFS_LARGETAIL},
716 static const arg_desc_t error_actions[] = {
717 {"panic", 1 << REISERFS_ERROR_PANIC,
718 (1 << REISERFS_ERROR_RO | 1 << REISERFS_ERROR_CONTINUE)},
719 {"ro-remount", 1 << REISERFS_ERROR_RO,
720 (1 << REISERFS_ERROR_PANIC | 1 << REISERFS_ERROR_CONTINUE)},
721 #ifdef REISERFS_JOURNAL_ERROR_ALLOWS_NO_LOG
722 {"continue", 1 << REISERFS_ERROR_CONTINUE,
723 (1 << REISERFS_ERROR_PANIC | 1 << REISERFS_ERROR_RO)},
728 int reiserfs_default_io_size = 128 * 1024; /* Default recommended I/O size is 128k.
729 There might be broken applications that are
730 confused by this. Use nolargeio mount option
731 to get usual i/o size = PAGE_SIZE.
734 /* proceed only one option from a list *cur - string containing of mount options
735 opts - array of options which are accepted
736 opt_arg - if option is found and requires an argument and if it is specifed
737 in the input - pointer to the argument is stored here
738 bit_flags - if option requires to set a certain bit - it is set here
739 return -1 if unknown option is found, opt->arg_required otherwise */
740 static int reiserfs_getopt(struct super_block *s, char **cur, opt_desc_t * opts,
741 char **opt_arg, unsigned long *bit_flags)
750 const opt_desc_t *opt;
751 const arg_desc_t *arg;
755 /* assume argument cannot contain commas */
756 *cur = strchr(p, ',');
762 if (!strncmp(p, "alloc=", 6)) {
763 /* Ugly special case, probably we should redo options parser so that
764 it can understand several arguments for some options, also so that
765 it can fill several bitfields with option values. */
766 if (reiserfs_parse_alloc_options(s, p + 6)) {
773 /* for every option in the list */
774 for (opt = opts; opt->option_name; opt++) {
775 if (!strncmp(p, opt->option_name, strlen(opt->option_name))) {
778 (1 << REISERFS_UNSUPPORTED_OPT))
779 reiserfs_warning(s, "%s not supported.",
782 *bit_flags &= ~opt->clrmask;
784 (1 << REISERFS_UNSUPPORTED_OPT))
785 reiserfs_warning(s, "%s not supported.",
788 *bit_flags |= opt->setmask;
793 if (!opt->option_name) {
794 reiserfs_warning(s, "unknown mount option \"%s\"", p);
798 p += strlen(opt->option_name);
801 if (!opt->arg_required) {
803 "the option \"%s\" does not require an argument",
810 if (opt->arg_required) {
812 "the option \"%s\" requires an argument",
818 reiserfs_warning(s, "head of option \"%s\" is only correct",
823 /* move to the argument, or to next option if argument is not required */
826 if (opt->arg_required
827 && !(opt->arg_required & (1 << REISERFS_OPT_ALLOWEMPTY))
829 /* this catches "option=," if not allowed */
830 reiserfs_warning(s, "empty argument for \"%s\"",
836 /* *=NULLopt_arg contains pointer to argument */
838 return opt->arg_required & ~(1 << REISERFS_OPT_ALLOWEMPTY);
841 /* values possible for this option are listed in opt->values */
842 for (arg = opt->values; arg->value; arg++) {
843 if (!strcmp(p, arg->value)) {
845 *bit_flags &= ~arg->clrmask;
846 *bit_flags |= arg->setmask;
848 return opt->arg_required;
852 reiserfs_warning(s, "bad value \"%s\" for option \"%s\"", p,
857 /* returns 0 if something is wrong in option string, 1 - otherwise */
858 static int reiserfs_parse_options(struct super_block *s, char *options, /* string given via mount's -o */
859 unsigned long *mount_options,
860 /* after the parsing phase, contains the
861 collection of bitflags defining what
862 mount options were selected. */
863 unsigned long *blocks, /* strtol-ed from NNN of resize=NNN */
865 unsigned int *commit_max_age)
870 opt_desc_t opts[] = {
871 /* Compatibility stuff, so that -o notail for old setups still work */
872 {"tails",.arg_required = 't',.values = tails},
874 (1 << REISERFS_LARGETAIL) | (1 << REISERFS_SMALLTAIL)},
875 {"conv",.setmask = 1 << REISERFS_CONVERT},
876 {"attrs",.setmask = 1 << REISERFS_ATTRS},
877 {"noattrs",.clrmask = 1 << REISERFS_ATTRS},
878 #ifdef CONFIG_REISERFS_FS_XATTR
879 {"user_xattr",.setmask = 1 << REISERFS_XATTRS_USER},
880 {"nouser_xattr",.clrmask = 1 << REISERFS_XATTRS_USER},
882 {"user_xattr",.setmask = 1 << REISERFS_UNSUPPORTED_OPT},
883 {"nouser_xattr",.clrmask = 1 << REISERFS_UNSUPPORTED_OPT},
885 #ifdef CONFIG_REISERFS_FS_POSIX_ACL
886 {"acl",.setmask = 1 << REISERFS_POSIXACL},
887 {"noacl",.clrmask = 1 << REISERFS_POSIXACL},
889 {"acl",.setmask = 1 << REISERFS_UNSUPPORTED_OPT},
890 {"noacl",.clrmask = 1 << REISERFS_UNSUPPORTED_OPT},
892 {.option_name = "nolog"},
893 {"replayonly",.setmask = 1 << REPLAYONLY},
894 {"block-allocator",.arg_required = 'a',.values = balloc},
895 {"data",.arg_required = 'd',.values = logging_mode},
896 {"barrier",.arg_required = 'b',.values = barrier_mode},
897 {"resize",.arg_required = 'r',.values = NULL},
898 {"jdev",.arg_required = 'j',.values = NULL},
899 {"nolargeio",.arg_required = 'w',.values = NULL},
900 {"commit",.arg_required = 'c',.values = NULL},
901 {"usrquota",.setmask = 1 << REISERFS_QUOTA},
902 {"grpquota",.setmask = 1 << REISERFS_QUOTA},
903 {"noquota",.clrmask = 1 << REISERFS_QUOTA},
904 {"errors",.arg_required = 'e',.values = error_actions},
905 {"usrjquota",.arg_required =
906 'u' | (1 << REISERFS_OPT_ALLOWEMPTY),.values = NULL},
907 {"grpjquota",.arg_required =
908 'g' | (1 << REISERFS_OPT_ALLOWEMPTY),.values = NULL},
909 {"jqfmt",.arg_required = 'f',.values = NULL},
910 {.option_name = NULL}
914 if (!options || !*options)
915 /* use default configuration: create tails, journaling on, no
916 conversion to newest format */
919 for (pos = options; pos;) {
920 c = reiserfs_getopt(s, &pos, opts, &arg, mount_options);
922 /* wrong option is given */
929 /* "resize=NNN" or "resize=auto" */
931 if (!strcmp(arg, "auto")) {
932 /* From JFS code, to auto-get the size. */
934 s->s_bdev->bd_inode->i_size >> s->
937 *blocks = simple_strtoul(arg, &p, 0);
939 /* NNN does not look like a number */
941 "reiserfs_parse_options: bad value %s",
950 unsigned long val = simple_strtoul(arg, &p, 0);
951 /* commit=NNN (time in seconds) */
952 if (*p != '\0' || val >= (unsigned int)-1) {
954 "reiserfs_parse_options: bad value %s",
958 *commit_max_age = (unsigned int)val;
963 int val = simple_strtoul(arg, &p, 0);
967 "reiserfs_parse_options: non-numeric value %s for nolargeio option",
972 reiserfs_default_io_size = PAGE_SIZE;
974 reiserfs_default_io_size = 128 * 1024;
978 if (arg && *arg && jdev_name) {
979 if (*jdev_name) { //Hm, already assigned?
981 "reiserfs_parse_options: journal device was already specified to be %s",
989 if (c == 'u' || c == 'g') {
990 int qtype = c == 'u' ? USRQUOTA : GRPQUOTA;
992 if (sb_any_quota_enabled(s)) {
994 "reiserfs_parse_options: cannot change journalled quota options when quota turned on.");
997 if (*arg) { /* Some filename specified? */
998 if (REISERFS_SB(s)->s_qf_names[qtype]
999 && strcmp(REISERFS_SB(s)->s_qf_names[qtype],
1002 "reiserfs_parse_options: %s quota file already specified.",
1006 if (strchr(arg, '/')) {
1008 "reiserfs_parse_options: quotafile must be on filesystem root.");
1011 REISERFS_SB(s)->s_qf_names[qtype] =
1012 kmalloc(strlen(arg) + 1, GFP_KERNEL);
1013 if (!REISERFS_SB(s)->s_qf_names[qtype]) {
1015 "reiserfs_parse_options: not enough memory for storing quotafile name.");
1018 strcpy(REISERFS_SB(s)->s_qf_names[qtype], arg);
1019 *mount_options |= 1 << REISERFS_QUOTA;
1021 kfree(REISERFS_SB(s)->s_qf_names[qtype]);
1022 REISERFS_SB(s)->s_qf_names[qtype] = NULL;
1026 if (!strcmp(arg, "vfsold"))
1027 REISERFS_SB(s)->s_jquota_fmt = QFMT_VFS_OLD;
1028 else if (!strcmp(arg, "vfsv0"))
1029 REISERFS_SB(s)->s_jquota_fmt = QFMT_VFS_V0;
1032 "reiserfs_parse_options: unknown quota format specified.");
1037 if (c == 'u' || c == 'g' || c == 'f') {
1039 "reiserfs_parse_options: journalled quota options not supported.");
1046 if (!REISERFS_SB(s)->s_jquota_fmt
1047 && (REISERFS_SB(s)->s_qf_names[USRQUOTA]
1048 || REISERFS_SB(s)->s_qf_names[GRPQUOTA])) {
1050 "reiserfs_parse_options: journalled quota format not specified.");
1053 /* This checking is not precise wrt the quota type but for our purposes it is sufficient */
1054 if (!(*mount_options & (1 << REISERFS_QUOTA))
1055 && sb_any_quota_enabled(s)) {
1057 "reiserfs_parse_options: quota options must be present when quota is turned on.");
1065 static void switch_data_mode(struct super_block *s, unsigned long mode)
1067 REISERFS_SB(s)->s_mount_opt &= ~((1 << REISERFS_DATA_LOG) |
1068 (1 << REISERFS_DATA_ORDERED) |
1069 (1 << REISERFS_DATA_WRITEBACK));
1070 REISERFS_SB(s)->s_mount_opt |= (1 << mode);
1073 static void handle_data_mode(struct super_block *s, unsigned long mount_options)
1075 if (mount_options & (1 << REISERFS_DATA_LOG)) {
1076 if (!reiserfs_data_log(s)) {
1077 switch_data_mode(s, REISERFS_DATA_LOG);
1078 reiserfs_info(s, "switching to journaled data mode\n");
1080 } else if (mount_options & (1 << REISERFS_DATA_ORDERED)) {
1081 if (!reiserfs_data_ordered(s)) {
1082 switch_data_mode(s, REISERFS_DATA_ORDERED);
1083 reiserfs_info(s, "switching to ordered data mode\n");
1085 } else if (mount_options & (1 << REISERFS_DATA_WRITEBACK)) {
1086 if (!reiserfs_data_writeback(s)) {
1087 switch_data_mode(s, REISERFS_DATA_WRITEBACK);
1088 reiserfs_info(s, "switching to writeback data mode\n");
1093 static void handle_barrier_mode(struct super_block *s, unsigned long bits)
1095 int flush = (1 << REISERFS_BARRIER_FLUSH);
1096 int none = (1 << REISERFS_BARRIER_NONE);
1097 int all_barrier = flush | none;
1099 if (bits & all_barrier) {
1100 REISERFS_SB(s)->s_mount_opt &= ~all_barrier;
1102 REISERFS_SB(s)->s_mount_opt |= flush;
1103 printk("reiserfs: enabling write barrier flush mode\n");
1104 } else if (bits & none) {
1105 REISERFS_SB(s)->s_mount_opt |= none;
1106 printk("reiserfs: write barriers turned off\n");
1111 static void handle_attrs(struct super_block *s)
1113 struct reiserfs_super_block *rs = SB_DISK_SUPER_BLOCK(s);
1115 if (reiserfs_attrs(s)) {
1116 if (old_format_only(s)) {
1118 "reiserfs: cannot support attributes on 3.5.x disk format");
1119 REISERFS_SB(s)->s_mount_opt &= ~(1 << REISERFS_ATTRS);
1122 if (!(le32_to_cpu(rs->s_flags) & reiserfs_attrs_cleared)) {
1124 "reiserfs: cannot support attributes until flag is set in super-block");
1125 REISERFS_SB(s)->s_mount_opt &= ~(1 << REISERFS_ATTRS);
1130 static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
1132 struct reiserfs_super_block *rs;
1133 struct reiserfs_transaction_handle th;
1134 unsigned long blocks;
1135 unsigned long mount_options = REISERFS_SB(s)->s_mount_opt;
1136 unsigned long safe_mask = 0;
1137 unsigned int commit_max_age = (unsigned int)-1;
1138 struct reiserfs_journal *journal = SB_JOURNAL(s);
1144 rs = SB_DISK_SUPER_BLOCK(s);
1146 if (!reiserfs_parse_options
1147 (s, arg, &mount_options, &blocks, NULL, &commit_max_age)) {
1149 for (i = 0; i < MAXQUOTAS; i++) {
1150 kfree(REISERFS_SB(s)->s_qf_names[i]);
1151 REISERFS_SB(s)->s_qf_names[i] = NULL;
1159 /* Add options that are safe here */
1160 safe_mask |= 1 << REISERFS_SMALLTAIL;
1161 safe_mask |= 1 << REISERFS_LARGETAIL;
1162 safe_mask |= 1 << REISERFS_NO_BORDER;
1163 safe_mask |= 1 << REISERFS_NO_UNHASHED_RELOCATION;
1164 safe_mask |= 1 << REISERFS_HASHED_RELOCATION;
1165 safe_mask |= 1 << REISERFS_TEST4;
1166 safe_mask |= 1 << REISERFS_ATTRS;
1167 safe_mask |= 1 << REISERFS_XATTRS_USER;
1168 safe_mask |= 1 << REISERFS_POSIXACL;
1169 safe_mask |= 1 << REISERFS_BARRIER_FLUSH;
1170 safe_mask |= 1 << REISERFS_BARRIER_NONE;
1171 safe_mask |= 1 << REISERFS_ERROR_RO;
1172 safe_mask |= 1 << REISERFS_ERROR_CONTINUE;
1173 safe_mask |= 1 << REISERFS_ERROR_PANIC;
1174 safe_mask |= 1 << REISERFS_QUOTA;
1176 /* Update the bitmask, taking care to keep
1177 * the bits we're not allowed to change here */
1178 REISERFS_SB(s)->s_mount_opt =
1180 s_mount_opt & ~safe_mask) | (mount_options & safe_mask);
1182 if (commit_max_age != 0 && commit_max_age != (unsigned int)-1) {
1183 journal->j_max_commit_age = commit_max_age;
1184 journal->j_max_trans_age = commit_max_age;
1185 } else if (commit_max_age == 0) {
1186 /* 0 means restore defaults. */
1187 journal->j_max_commit_age = journal->j_default_max_commit_age;
1188 journal->j_max_trans_age = JOURNAL_MAX_TRANS_AGE;
1192 int rc = reiserfs_resize(s, blocks);
1197 if (*mount_flags & MS_RDONLY) {
1198 reiserfs_xattr_init(s, *mount_flags);
1199 /* remount read-only */
1200 if (s->s_flags & MS_RDONLY)
1201 /* it is read-only already */
1203 /* try to remount file system with read-only permissions */
1204 if (sb_umount_state(rs) == REISERFS_VALID_FS
1205 || REISERFS_SB(s)->s_mount_state != REISERFS_VALID_FS) {
1209 err = journal_begin(&th, s, 10);
1213 /* Mounting a rw partition read-only. */
1214 reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1);
1215 set_sb_umount_state(rs, REISERFS_SB(s)->s_mount_state);
1216 journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB(s));
1218 /* remount read-write */
1219 if (!(s->s_flags & MS_RDONLY)) {
1220 reiserfs_xattr_init(s, *mount_flags);
1221 return 0; /* We are read-write already */
1224 if (reiserfs_is_journal_aborted(journal))
1225 return journal->j_errno;
1227 handle_data_mode(s, mount_options);
1228 handle_barrier_mode(s, mount_options);
1229 REISERFS_SB(s)->s_mount_state = sb_umount_state(rs);
1230 s->s_flags &= ~MS_RDONLY; /* now it is safe to call journal_begin */
1231 err = journal_begin(&th, s, 10);
1235 /* Mount a partition which is read-only, read-write */
1236 reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1);
1237 REISERFS_SB(s)->s_mount_state = sb_umount_state(rs);
1238 s->s_flags &= ~MS_RDONLY;
1239 set_sb_umount_state(rs, REISERFS_ERROR_FS);
1240 /* mark_buffer_dirty (SB_BUFFER_WITH_SB (s), 1); */
1241 journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB(s));
1242 REISERFS_SB(s)->s_mount_state = REISERFS_VALID_FS;
1244 /* this will force a full flush of all journal lists */
1245 SB_JOURNAL(s)->j_must_wait = 1;
1246 err = journal_end(&th, s, 10);
1251 if (!(*mount_flags & MS_RDONLY)) {
1252 finish_unfinished(s);
1253 reiserfs_xattr_init(s, *mount_flags);
1259 /* load_bitmap_info_data - Sets up the reiserfs_bitmap_info structure from disk.
1260 * @sb - superblock for this filesystem
1261 * @bi - the bitmap info to be loaded. Requires that bi->bh is valid.
1263 * This routine counts how many free bits there are, finding the first zero
1264 * as a side effect. Could also be implemented as a loop of test_bit() calls, or
1265 * a loop of find_first_zero_bit() calls. This implementation is similar to
1266 * find_first_zero_bit(), but doesn't return after it finds the first bit.
1267 * Should only be called on fs mount, but should be fairly efficient anyways.
1269 * bi->first_zero_hint is considered unset if it == 0, since the bitmap itself
1270 * will * invariably occupt block 0 represented in the bitmap. The only
1271 * exception to this is when free_count also == 0, since there will be no
1272 * free blocks at all.
1275 static void load_bitmap_info_data(struct super_block *sb,
1276 struct reiserfs_bitmap_info *bi)
1278 unsigned long *cur = (unsigned long *)bi->bh->b_data;
1280 while ((char *)cur < (bi->bh->b_data + sb->s_blocksize)) {
1282 /* No need to scan if all 0's or all 1's.
1283 * Since we're only counting 0's, we can simply ignore all 1's */
1285 if (bi->first_zero_hint == 0) {
1286 bi->first_zero_hint =
1287 ((char *)cur - bi->bh->b_data) << 3;
1289 bi->free_count += sizeof(unsigned long) * 8;
1290 } else if (*cur != ~0L) {
1292 for (b = 0; b < sizeof(unsigned long) * 8; b++) {
1293 if (!reiserfs_test_le_bit(b, cur)) {
1295 if (bi->first_zero_hint == 0)
1296 bi->first_zero_hint =
1298 bi->bh->b_data) << 3) + b;
1305 #ifdef CONFIG_REISERFS_CHECK
1306 // This outputs a lot of unneded info on big FSes
1307 // reiserfs_warning ("bitmap loaded from block %d: %d free blocks",
1308 // bi->bh->b_blocknr, bi->free_count);
1312 static int read_bitmaps(struct super_block *s)
1317 vmalloc(sizeof(struct reiserfs_bitmap_info) * SB_BMAP_NR(s));
1318 if (SB_AP_BITMAP(s) == 0)
1320 memset(SB_AP_BITMAP(s), 0,
1321 sizeof(struct reiserfs_bitmap_info) * SB_BMAP_NR(s));
1322 for (i = 0, bmap_nr =
1323 REISERFS_DISK_OFFSET_IN_BYTES / s->s_blocksize + 1;
1324 i < SB_BMAP_NR(s); i++, bmap_nr = s->s_blocksize * 8 * i) {
1325 SB_AP_BITMAP(s)[i].bh = sb_getblk(s, bmap_nr);
1326 if (!buffer_uptodate(SB_AP_BITMAP(s)[i].bh))
1327 ll_rw_block(READ, 1, &SB_AP_BITMAP(s)[i].bh);
1329 for (i = 0; i < SB_BMAP_NR(s); i++) {
1330 wait_on_buffer(SB_AP_BITMAP(s)[i].bh);
1331 if (!buffer_uptodate(SB_AP_BITMAP(s)[i].bh)) {
1332 reiserfs_warning(s, "sh-2029: reiserfs read_bitmaps: "
1333 "bitmap block (#%lu) reading failed",
1334 SB_AP_BITMAP(s)[i].bh->b_blocknr);
1335 for (i = 0; i < SB_BMAP_NR(s); i++)
1336 brelse(SB_AP_BITMAP(s)[i].bh);
1337 vfree(SB_AP_BITMAP(s));
1338 SB_AP_BITMAP(s) = NULL;
1341 load_bitmap_info_data(s, SB_AP_BITMAP(s) + i);
1346 static int read_old_bitmaps(struct super_block *s)
1349 struct reiserfs_super_block *rs = SB_DISK_SUPER_BLOCK(s);
1350 int bmp1 = (REISERFS_OLD_DISK_OFFSET_IN_BYTES / s->s_blocksize) + 1; /* first of bitmap blocks */
1352 /* read true bitmap */
1354 vmalloc(sizeof(struct reiserfs_buffer_info *) * sb_bmap_nr(rs));
1355 if (SB_AP_BITMAP(s) == 0)
1358 memset(SB_AP_BITMAP(s), 0,
1359 sizeof(struct reiserfs_buffer_info *) * sb_bmap_nr(rs));
1361 for (i = 0; i < sb_bmap_nr(rs); i++) {
1362 SB_AP_BITMAP(s)[i].bh = sb_bread(s, bmp1 + i);
1363 if (!SB_AP_BITMAP(s)[i].bh)
1365 load_bitmap_info_data(s, SB_AP_BITMAP(s) + i);
1371 static int read_super_block(struct super_block *s, int offset)
1373 struct buffer_head *bh;
1374 struct reiserfs_super_block *rs;
1377 bh = sb_bread(s, offset / s->s_blocksize);
1379 reiserfs_warning(s, "sh-2006: read_super_block: "
1380 "bread failed (dev %s, block %lu, size %lu)",
1381 reiserfs_bdevname(s), offset / s->s_blocksize,
1386 rs = (struct reiserfs_super_block *)bh->b_data;
1387 if (!is_any_reiserfs_magic_string(rs)) {
1392 // ok, reiserfs signature (old or new) found in at the given offset
1394 fs_blocksize = sb_blocksize(rs);
1396 sb_set_blocksize(s, fs_blocksize);
1398 bh = sb_bread(s, offset / s->s_blocksize);
1400 reiserfs_warning(s, "sh-2007: read_super_block: "
1401 "bread failed (dev %s, block %lu, size %lu)\n",
1402 reiserfs_bdevname(s), offset / s->s_blocksize,
1407 rs = (struct reiserfs_super_block *)bh->b_data;
1408 if (sb_blocksize(rs) != s->s_blocksize) {
1409 reiserfs_warning(s, "sh-2011: read_super_block: "
1410 "can't find a reiserfs filesystem on (dev %s, block %Lu, size %lu)\n",
1411 reiserfs_bdevname(s),
1412 (unsigned long long)bh->b_blocknr,
1418 if (rs->s_v1.s_root_block == cpu_to_le32(-1)) {
1421 "Unfinished reiserfsck --rebuild-tree run detected. Please run\n"
1422 "reiserfsck --rebuild-tree and wait for a completion. If that fails\n"
1423 "get newer reiserfsprogs package");
1427 SB_BUFFER_WITH_SB(s) = bh;
1428 SB_DISK_SUPER_BLOCK(s) = rs;
1430 if (is_reiserfs_jr(rs)) {
1431 /* magic is of non-standard journal filesystem, look at s_version to
1432 find which format is in use */
1433 if (sb_version(rs) == REISERFS_VERSION_2)
1435 "read_super_block: found reiserfs format \"3.6\""
1436 " with non-standard journal");
1437 else if (sb_version(rs) == REISERFS_VERSION_1)
1439 "read_super_block: found reiserfs format \"3.5\""
1440 " with non-standard journal");
1443 "sh-2012: read_super_block: found unknown "
1444 "format \"%u\" of reiserfs with non-standard magic",
1449 /* s_version of standard format may contain incorrect information,
1450 so we just look at the magic string */
1452 "found reiserfs format \"%s\" with standard journal\n",
1453 is_reiserfs_3_5(rs) ? "3.5" : "3.6");
1455 s->s_op = &reiserfs_sops;
1456 s->s_export_op = &reiserfs_export_ops;
1458 s->s_qcop = &reiserfs_qctl_operations;
1459 s->dq_op = &reiserfs_quota_operations;
1462 /* new format is limited by the 32 bit wide i_blocks field, want to
1463 ** be one full block below that.
1465 s->s_maxbytes = (512LL << 32) - s->s_blocksize;
1469 /* after journal replay, reread all bitmap and super blocks */
1470 static int reread_meta_blocks(struct super_block *s)
1473 ll_rw_block(READ, 1, &(SB_BUFFER_WITH_SB(s)));
1474 wait_on_buffer(SB_BUFFER_WITH_SB(s));
1475 if (!buffer_uptodate(SB_BUFFER_WITH_SB(s))) {
1477 "reread_meta_blocks, error reading the super");
1481 for (i = 0; i < SB_BMAP_NR(s); i++) {
1482 ll_rw_block(READ, 1, &(SB_AP_BITMAP(s)[i].bh));
1483 wait_on_buffer(SB_AP_BITMAP(s)[i].bh);
1484 if (!buffer_uptodate(SB_AP_BITMAP(s)[i].bh)) {
1486 "reread_meta_blocks, error reading bitmap block number %d at %llu",
1488 (unsigned long long)SB_AP_BITMAP(s)[i].
1497 /////////////////////////////////////////////////////
1498 // hash detection stuff
1500 // if root directory is empty - we set default - Yura's - hash and
1502 // FIXME: we look for only one name in a directory. If tea and yura
1503 // bith have the same value - we ask user to send report to the
1505 static __u32 find_hash_out(struct super_block *s)
1508 struct inode *inode;
1510 INITIALIZE_PATH(path);
1511 struct reiserfs_dir_entry de;
1512 __u32 hash = DEFAULT_HASH;
1514 inode = s->s_root->d_inode;
1516 do { // Some serious "goto"-hater was there ;)
1517 u32 teahash, r5hash, yurahash;
1519 make_cpu_key(&key, inode, ~0, TYPE_DIRENTRY, 3);
1520 retval = search_by_entry_key(s, &key, &path, &de);
1521 if (retval == IO_ERROR) {
1525 if (retval == NAME_NOT_FOUND)
1527 set_de_name_and_namelen(&de);
1528 if (deh_offset(&(de.de_deh[de.de_entry_num])) == DOT_DOT_OFFSET) {
1529 /* allow override in this case */
1530 if (reiserfs_rupasov_hash(s)) {
1533 reiserfs_warning(s, "FS seems to be empty, autodetect "
1534 "is using the default hash");
1537 r5hash = GET_HASH_VALUE(r5_hash(de.de_name, de.de_namelen));
1538 teahash = GET_HASH_VALUE(keyed_hash(de.de_name, de.de_namelen));
1539 yurahash = GET_HASH_VALUE(yura_hash(de.de_name, de.de_namelen));
1540 if (((teahash == r5hash)
1542 (GET_HASH_VALUE(deh_offset(&(de.de_deh[de.de_entry_num])))
1543 == r5hash)) || ((teahash == yurahash)
1545 GET_HASH_VALUE(deh_offset
1550 || ((r5hash == yurahash)
1552 GET_HASH_VALUE(deh_offset
1553 (&(de.de_deh[de.de_entry_num])))))) {
1555 "Unable to automatically detect hash function. "
1556 "Please mount with -o hash={tea,rupasov,r5}",
1557 reiserfs_bdevname(s));
1561 if (GET_HASH_VALUE(deh_offset(&(de.de_deh[de.de_entry_num]))) ==
1564 else if (GET_HASH_VALUE
1565 (deh_offset(&(de.de_deh[de.de_entry_num]))) == teahash)
1567 else if (GET_HASH_VALUE
1568 (deh_offset(&(de.de_deh[de.de_entry_num]))) == r5hash)
1571 reiserfs_warning(s, "Unrecognised hash function");
1580 // finds out which hash names are sorted with
1581 static int what_hash(struct super_block *s)
1585 code = sb_hash_function_code(SB_DISK_SUPER_BLOCK(s));
1587 /* reiserfs_hash_detect() == true if any of the hash mount options
1588 ** were used. We must check them to make sure the user isn't
1589 ** using a bad hash value
1591 if (code == UNSET_HASH || reiserfs_hash_detect(s))
1592 code = find_hash_out(s);
1594 if (code != UNSET_HASH && reiserfs_hash_detect(s)) {
1595 /* detection has found the hash, and we must check against the
1598 if (reiserfs_rupasov_hash(s) && code != YURA_HASH) {
1599 reiserfs_warning(s, "Error, %s hash detected, "
1600 "unable to force rupasov hash",
1601 reiserfs_hashname(code));
1603 } else if (reiserfs_tea_hash(s) && code != TEA_HASH) {
1604 reiserfs_warning(s, "Error, %s hash detected, "
1605 "unable to force tea hash",
1606 reiserfs_hashname(code));
1608 } else if (reiserfs_r5_hash(s) && code != R5_HASH) {
1609 reiserfs_warning(s, "Error, %s hash detected, "
1610 "unable to force r5 hash",
1611 reiserfs_hashname(code));
1615 /* find_hash_out was not called or could not determine the hash */
1616 if (reiserfs_rupasov_hash(s)) {
1618 } else if (reiserfs_tea_hash(s)) {
1620 } else if (reiserfs_r5_hash(s)) {
1625 /* if we are mounted RW, and we have a new valid hash code, update
1628 if (code != UNSET_HASH &&
1629 !(s->s_flags & MS_RDONLY) &&
1630 code != sb_hash_function_code(SB_DISK_SUPER_BLOCK(s))) {
1631 set_sb_hash_function_code(SB_DISK_SUPER_BLOCK(s), code);
1636 // return pointer to appropriate function
1637 static hashf_t hash_function(struct super_block *s)
1639 switch (what_hash(s)) {
1641 reiserfs_info(s, "Using tea hash to sort names\n");
1644 reiserfs_info(s, "Using rupasov hash to sort names\n");
1647 reiserfs_info(s, "Using r5 hash to sort names\n");
1653 // this is used to set up correct value for old partitions
1654 static int function2code(hashf_t func)
1656 if (func == keyed_hash)
1658 if (func == yura_hash)
1660 if (func == r5_hash)
1663 BUG(); // should never happen
1668 #define SWARN(silent, s, ...) \
1670 reiserfs_warning (s, __VA_ARGS__)
1672 static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1674 struct inode *root_inode;
1676 struct reiserfs_transaction_handle th;
1678 unsigned long blocks;
1679 unsigned int commit_max_age = 0;
1681 struct reiserfs_iget_args args;
1682 struct reiserfs_super_block *rs;
1684 struct reiserfs_sb_info *sbi;
1685 int errval = -EINVAL;
1687 sbi = kmalloc(sizeof(struct reiserfs_sb_info), GFP_KERNEL);
1693 memset(sbi, 0, sizeof(struct reiserfs_sb_info));
1694 /* Set default values for options: non-aggressive tails, RO on errors */
1695 REISERFS_SB(s)->s_mount_opt |= (1 << REISERFS_SMALLTAIL);
1696 REISERFS_SB(s)->s_mount_opt |= (1 << REISERFS_ERROR_RO);
1697 /* no preallocation minimum, be smart in
1698 reiserfs_file_write instead */
1699 REISERFS_SB(s)->s_alloc_options.preallocmin = 0;
1700 /* Preallocate by 16 blocks (17-1) at once */
1701 REISERFS_SB(s)->s_alloc_options.preallocsize = 17;
1702 /* Initialize the rwsem for xattr dir */
1703 init_rwsem(&REISERFS_SB(s)->xattr_dir_sem);
1705 /* setup default block allocator options */
1706 reiserfs_init_alloc_options(s);
1709 if (reiserfs_parse_options
1710 (s, (char *)data, &(sbi->s_mount_opt), &blocks, &jdev_name,
1711 &commit_max_age) == 0) {
1716 SWARN(silent, s, "jmacd-7: reiserfs_fill_super: resize option "
1717 "for remount only");
1721 /* try old format (undistributed bitmap, super block in 8-th 1k block of a device) */
1722 if (!read_super_block(s, REISERFS_OLD_DISK_OFFSET_IN_BYTES))
1724 /* try new format (64-th 1k block), which can contain reiserfs super block */
1725 else if (read_super_block(s, REISERFS_DISK_OFFSET_IN_BYTES)) {
1727 "sh-2021: reiserfs_fill_super: can not find reiserfs on %s",
1728 reiserfs_bdevname(s));
1732 rs = SB_DISK_SUPER_BLOCK(s);
1733 /* Let's do basic sanity check to verify that underlying device is not
1734 smaller than the filesystem. If the check fails then abort and scream,
1735 because bad stuff will happen otherwise. */
1736 if (s->s_bdev && s->s_bdev->bd_inode
1737 && i_size_read(s->s_bdev->bd_inode) <
1738 sb_block_count(rs) * sb_blocksize(rs)) {
1740 "Filesystem on %s cannot be mounted because it is bigger than the device",
1741 reiserfs_bdevname(s));
1743 "You may need to run fsck or increase size of your LVM partition");
1745 "Or may be you forgot to reboot after fdisk when it told you to");
1749 sbi->s_mount_state = SB_REISERFS_STATE(s);
1750 sbi->s_mount_state = REISERFS_VALID_FS;
1752 if (old_format ? read_old_bitmaps(s) : read_bitmaps(s)) {
1754 "jmacd-8: reiserfs_fill_super: unable to read bitmap");
1757 #ifdef CONFIG_REISERFS_CHECK
1758 SWARN(silent, s, "CONFIG_REISERFS_CHECK is set ON");
1759 SWARN(silent, s, "- it is slow mode for debugging.");
1762 /* make data=ordered the default */
1763 if (!reiserfs_data_log(s) && !reiserfs_data_ordered(s) &&
1764 !reiserfs_data_writeback(s)) {
1765 REISERFS_SB(s)->s_mount_opt |= (1 << REISERFS_DATA_ORDERED);
1768 if (reiserfs_data_log(s)) {
1769 reiserfs_info(s, "using journaled data mode\n");
1770 } else if (reiserfs_data_ordered(s)) {
1771 reiserfs_info(s, "using ordered data mode\n");
1773 reiserfs_info(s, "using writeback data mode\n");
1775 if (reiserfs_barrier_flush(s)) {
1776 printk("reiserfs: using flush barriers\n");
1778 // set_device_ro(s->s_dev, 1) ;
1779 if (journal_init(s, jdev_name, old_format, commit_max_age)) {
1781 "sh-2022: reiserfs_fill_super: unable to initialize journal space");
1784 jinit_done = 1; /* once this is set, journal_release must be called
1785 ** if we error out of the mount
1788 if (reread_meta_blocks(s)) {
1790 "jmacd-9: reiserfs_fill_super: unable to reread meta blocks after journal init");
1797 if (bdev_read_only(s->s_bdev) && !(s->s_flags & MS_RDONLY)) {
1799 "clm-7000: Detected readonly device, marking FS readonly");
1800 s->s_flags |= MS_RDONLY;
1802 args.objectid = REISERFS_ROOT_OBJECTID;
1803 args.dirid = REISERFS_ROOT_PARENT_OBJECTID;
1805 iget5_locked(s, REISERFS_ROOT_OBJECTID, reiserfs_find_actor,
1806 reiserfs_init_locked_inode, (void *)(&args));
1809 "jmacd-10: reiserfs_fill_super: get root inode failed");
1813 if (root_inode->i_state & I_NEW) {
1814 reiserfs_read_locked_inode(root_inode, &args);
1815 unlock_new_inode(root_inode);
1818 s->s_root = d_alloc_root(root_inode);
1823 // define and initialize hash function
1824 sbi->s_hash_function = hash_function(s);
1825 if (sbi->s_hash_function == NULL) {
1831 if (is_reiserfs_3_5(rs)
1832 || (is_reiserfs_jr(rs) && SB_VERSION(s) == REISERFS_VERSION_1))
1833 set_bit(REISERFS_3_5, &(sbi->s_properties));
1835 set_bit(REISERFS_3_6, &(sbi->s_properties));
1837 if (!(s->s_flags & MS_RDONLY)) {
1839 errval = journal_begin(&th, s, 1);
1845 reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1);
1847 set_sb_umount_state(rs, REISERFS_ERROR_FS);
1848 set_sb_fs_state(rs, 0);
1850 if (old_format_only(s)) {
1851 /* filesystem of format 3.5 either with standard or non-standard
1853 if (convert_reiserfs(s)) {
1854 /* and -o conv is given */
1857 "converting 3.5 filesystem to the 3.6 format");
1859 if (is_reiserfs_3_5(rs))
1860 /* put magic string of 3.6 format. 2.2 will not be able to
1861 mount this filesystem anymore */
1862 memcpy(rs->s_v1.s_magic,
1863 reiserfs_3_6_magic_string,
1865 (reiserfs_3_6_magic_string));
1867 set_sb_version(rs, REISERFS_VERSION_2);
1868 reiserfs_convert_objectid_map_v1(s);
1869 set_bit(REISERFS_3_6, &(sbi->s_properties));
1870 clear_bit(REISERFS_3_5, &(sbi->s_properties));
1871 } else if (!silent) {
1872 reiserfs_info(s, "using 3.5.x disk format\n");
1876 journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB(s));
1877 errval = journal_end(&th, s, 1);
1884 if ((errval = reiserfs_xattr_init(s, s->s_flags))) {
1890 /* look for files which were to be removed in previous session */
1891 finish_unfinished(s);
1893 if (old_format_only(s) && !silent) {
1894 reiserfs_info(s, "using 3.5.x disk format\n");
1897 if ((errval = reiserfs_xattr_init(s, s->s_flags))) {
1903 // mark hash in super block: it could be unset. overwrite should be ok
1904 set_sb_hash_function_code(rs, function2code(sbi->s_hash_function));
1908 reiserfs_proc_info_init(s);
1910 init_waitqueue_head(&(sbi->s_wait));
1911 spin_lock_init(&sbi->bitmap_lock);
1916 if (jinit_done) { /* kill the commit thread, free journal ram */
1917 journal_release_error(NULL, s);
1919 if (SB_DISK_SUPER_BLOCK(s)) {
1920 for (j = 0; j < SB_BMAP_NR(s); j++) {
1921 if (SB_AP_BITMAP(s))
1922 brelse(SB_AP_BITMAP(s)[j].bh);
1924 vfree(SB_AP_BITMAP(s));
1926 if (SB_BUFFER_WITH_SB(s))
1927 brelse(SB_BUFFER_WITH_SB(s));
1929 for (j = 0; j < MAXQUOTAS; j++) {
1930 kfree(sbi->s_qf_names[j]);
1931 sbi->s_qf_names[j] = NULL;
1936 s->s_fs_info = NULL;
1940 static int reiserfs_statfs(struct dentry *dentry, struct kstatfs *buf)
1942 struct reiserfs_super_block *rs = SB_DISK_SUPER_BLOCK(dentry->d_sb);
1944 buf->f_namelen = (REISERFS_MAX_NAME(s->s_blocksize));
1945 buf->f_bfree = sb_free_blocks(rs);
1946 buf->f_bavail = buf->f_bfree;
1947 buf->f_blocks = sb_block_count(rs) - sb_bmap_nr(rs) - 1;
1948 buf->f_bsize = dentry->d_sb->s_blocksize;
1949 /* changed to accommodate gcc folks. */
1950 buf->f_type = REISERFS_SUPER_MAGIC;
1955 static int reiserfs_dquot_initialize(struct inode *inode, int type)
1957 struct reiserfs_transaction_handle th;
1960 /* We may create quota structure so we need to reserve enough blocks */
1961 reiserfs_write_lock(inode->i_sb);
1963 journal_begin(&th, inode->i_sb,
1964 2 * REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb));
1967 ret = dquot_initialize(inode, type);
1969 journal_end(&th, inode->i_sb,
1970 2 * REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb));
1974 reiserfs_write_unlock(inode->i_sb);
1978 static int reiserfs_dquot_drop(struct inode *inode)
1980 struct reiserfs_transaction_handle th;
1983 /* We may delete quota structure so we need to reserve enough blocks */
1984 reiserfs_write_lock(inode->i_sb);
1986 journal_begin(&th, inode->i_sb,
1987 2 * REISERFS_QUOTA_DEL_BLOCKS(inode->i_sb));
1990 ret = dquot_drop(inode);
1992 journal_end(&th, inode->i_sb,
1993 2 * REISERFS_QUOTA_DEL_BLOCKS(inode->i_sb));
1997 reiserfs_write_unlock(inode->i_sb);
2001 static int reiserfs_write_dquot(struct dquot *dquot)
2003 struct reiserfs_transaction_handle th;
2006 reiserfs_write_lock(dquot->dq_sb);
2008 journal_begin(&th, dquot->dq_sb,
2009 REISERFS_QUOTA_TRANS_BLOCKS(dquot->dq_sb));
2012 ret = dquot_commit(dquot);
2014 journal_end(&th, dquot->dq_sb,
2015 REISERFS_QUOTA_TRANS_BLOCKS(dquot->dq_sb));
2019 reiserfs_write_unlock(dquot->dq_sb);
2023 static int reiserfs_acquire_dquot(struct dquot *dquot)
2025 struct reiserfs_transaction_handle th;
2028 reiserfs_write_lock(dquot->dq_sb);
2030 journal_begin(&th, dquot->dq_sb,
2031 REISERFS_QUOTA_INIT_BLOCKS(dquot->dq_sb));
2034 ret = dquot_acquire(dquot);
2036 journal_end(&th, dquot->dq_sb,
2037 REISERFS_QUOTA_INIT_BLOCKS(dquot->dq_sb));
2041 reiserfs_write_unlock(dquot->dq_sb);
2045 static int reiserfs_release_dquot(struct dquot *dquot)
2047 struct reiserfs_transaction_handle th;
2050 reiserfs_write_lock(dquot->dq_sb);
2052 journal_begin(&th, dquot->dq_sb,
2053 REISERFS_QUOTA_DEL_BLOCKS(dquot->dq_sb));
2056 ret = dquot_release(dquot);
2058 journal_end(&th, dquot->dq_sb,
2059 REISERFS_QUOTA_DEL_BLOCKS(dquot->dq_sb));
2063 reiserfs_write_unlock(dquot->dq_sb);
2067 static int reiserfs_mark_dquot_dirty(struct dquot *dquot)
2069 /* Are we journalling quotas? */
2070 if (REISERFS_SB(dquot->dq_sb)->s_qf_names[USRQUOTA] ||
2071 REISERFS_SB(dquot->dq_sb)->s_qf_names[GRPQUOTA]) {
2072 dquot_mark_dquot_dirty(dquot);
2073 return reiserfs_write_dquot(dquot);
2075 return dquot_mark_dquot_dirty(dquot);
2078 static int reiserfs_write_info(struct super_block *sb, int type)
2080 struct reiserfs_transaction_handle th;
2083 /* Data block + inode block */
2084 reiserfs_write_lock(sb);
2085 ret = journal_begin(&th, sb, 2);
2088 ret = dquot_commit_info(sb, type);
2089 err = journal_end(&th, sb, 2);
2093 reiserfs_write_unlock(sb);
2098 * Turn on quotas during mount time - we need to find the quota file and such...
2100 static int reiserfs_quota_on_mount(struct super_block *sb, int type)
2102 return vfs_quota_on_mount(sb, REISERFS_SB(sb)->s_qf_names[type],
2103 REISERFS_SB(sb)->s_jquota_fmt, type);
2107 * Standard function to be called on quota_on
2109 static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
2113 struct nameidata nd;
2115 if (!(REISERFS_SB(sb)->s_mount_opt & (1 << REISERFS_QUOTA)))
2117 err = path_lookup(path, LOOKUP_FOLLOW, &nd);
2120 /* Quotafile not on the same filesystem? */
2121 if (nd.mnt->mnt_sb != sb) {
2125 /* We must not pack tails for quota files on reiserfs for quota IO to work */
2126 if (!REISERFS_I(nd.dentry->d_inode)->i_flags & i_nopack_mask) {
2127 reiserfs_warning(sb,
2128 "reiserfs: Quota file must have tail packing disabled.");
2132 /* Not journalling quota? No more tests needed... */
2133 if (!REISERFS_SB(sb)->s_qf_names[USRQUOTA] &&
2134 !REISERFS_SB(sb)->s_qf_names[GRPQUOTA]) {
2136 return vfs_quota_on(sb, type, format_id, path);
2138 /* Quotafile not of fs root? */
2139 if (nd.dentry->d_parent->d_inode != sb->s_root->d_inode)
2140 reiserfs_warning(sb,
2141 "reiserfs: Quota file not on filesystem root. "
2142 "Journalled quota will not work.");
2144 return vfs_quota_on(sb, type, format_id, path);
2147 /* Read data from quotafile - avoid pagecache and such because we cannot afford
2148 * acquiring the locks... As quota files are never truncated and quota code
2149 * itself serializes the operations (and noone else should touch the files)
2150 * we don't have to be afraid of races */
2151 static ssize_t reiserfs_quota_read(struct super_block *sb, int type, char *data,
2152 size_t len, loff_t off)
2154 struct inode *inode = sb_dqopt(sb)->files[type];
2155 unsigned long blk = off >> sb->s_blocksize_bits;
2156 int err = 0, offset = off & (sb->s_blocksize - 1), tocopy;
2158 struct buffer_head tmp_bh, *bh;
2159 loff_t i_size = i_size_read(inode);
2163 if (off + len > i_size)
2166 while (toread > 0) {
2168 sb->s_blocksize - offset <
2169 toread ? sb->s_blocksize - offset : toread;
2171 /* Quota files are without tails so we can safely use this function */
2172 reiserfs_write_lock(sb);
2173 err = reiserfs_get_block(inode, blk, &tmp_bh, 0);
2174 reiserfs_write_unlock(sb);
2177 if (!buffer_mapped(&tmp_bh)) /* A hole? */
2178 memset(data, 0, tocopy);
2180 bh = sb_bread(sb, tmp_bh.b_blocknr);
2183 memcpy(data, bh->b_data + offset, tocopy);
2194 /* Write to quotafile (we know the transaction is already started and has
2195 * enough credits) */
2196 static ssize_t reiserfs_quota_write(struct super_block *sb, int type,
2197 const char *data, size_t len, loff_t off)
2199 struct inode *inode = sb_dqopt(sb)->files[type];
2200 unsigned long blk = off >> sb->s_blocksize_bits;
2201 int err = 0, offset = off & (sb->s_blocksize - 1), tocopy;
2202 int journal_quota = REISERFS_SB(sb)->s_qf_names[type] != NULL;
2203 size_t towrite = len;
2204 struct buffer_head tmp_bh, *bh;
2206 mutex_lock(&inode->i_mutex);
2207 while (towrite > 0) {
2208 tocopy = sb->s_blocksize - offset < towrite ?
2209 sb->s_blocksize - offset : towrite;
2211 err = reiserfs_get_block(inode, blk, &tmp_bh, GET_BLOCK_CREATE);
2214 if (offset || tocopy != sb->s_blocksize)
2215 bh = sb_bread(sb, tmp_bh.b_blocknr);
2217 bh = sb_getblk(sb, tmp_bh.b_blocknr);
2223 memcpy(bh->b_data + offset, data, tocopy);
2224 flush_dcache_page(bh->b_page);
2225 set_buffer_uptodate(bh);
2227 reiserfs_prepare_for_journal(sb, bh, 1);
2228 journal_mark_dirty(current->journal_info, sb, bh);
2230 reiserfs_add_ordered_list(inode, bh);
2240 if (inode->i_size < off + len - towrite)
2241 i_size_write(inode, off + len - towrite);
2243 inode->i_mtime = inode->i_ctime = CURRENT_TIME;
2244 mark_inode_dirty(inode);
2245 mutex_unlock(&inode->i_mutex);
2246 return len - towrite;
2251 static int get_super_block(struct file_system_type *fs_type,
2252 int flags, const char *dev_name,
2253 void *data, struct vfsmount *mnt)
2255 return get_sb_bdev(fs_type, flags, dev_name, data, reiserfs_fill_super,
2259 static int __init init_reiserfs_fs(void)
2263 if ((ret = init_inodecache())) {
2267 if ((ret = reiserfs_xattr_register_handlers()))
2268 goto failed_reiserfs_xattr_register_handlers;
2270 reiserfs_proc_info_global_init();
2271 reiserfs_proc_register_global("version",
2272 reiserfs_global_version_in_proc);
2274 ret = register_filesystem(&reiserfs_fs_type);
2280 reiserfs_xattr_unregister_handlers();
2282 failed_reiserfs_xattr_register_handlers:
2283 reiserfs_proc_unregister_global("version");
2284 reiserfs_proc_info_global_done();
2285 destroy_inodecache();
2290 static void __exit exit_reiserfs_fs(void)
2292 reiserfs_xattr_unregister_handlers();
2293 reiserfs_proc_unregister_global("version");
2294 reiserfs_proc_info_global_done();
2295 unregister_filesystem(&reiserfs_fs_type);
2296 destroy_inodecache();
2299 struct file_system_type reiserfs_fs_type = {
2300 .owner = THIS_MODULE,
2302 .get_sb = get_super_block,
2303 .kill_sb = kill_block_super,
2304 .fs_flags = FS_REQUIRES_DEV,
2307 MODULE_DESCRIPTION("ReiserFS journaled filesystem");
2308 MODULE_AUTHOR("Hans Reiser <reiser@namesys.com>");
2309 MODULE_LICENSE("GPL");
2311 module_init(init_reiserfs_fs);
2312 module_exit(exit_reiserfs_fs);