#include <linux/time.h>
#include <asm/uaccess.h>
#include <linux/reiserfs_fs.h>
+#include <linux/reiserfs_acl.h>
+#include <linux/reiserfs_xattr.h>
#include <linux/smp_lock.h>
#include <linux/init.h>
#include <linux/blkdev.h>
/* we are going to do one balancing */
journal_begin (&th, s, JOURNAL_PER_BALANCE_CNT);
- reiserfs_delete_solid_item (&th, key);
+ reiserfs_delete_solid_item (&th, NULL, key);
if (oid_free)
/* removals are protected by direct items */
reiserfs_release_objectid (&th, le32_to_cpu (key->k_objectid));
while (1) {
retval = search_item (s, &max_cpu_key, &path);
if (retval != ITEM_NOT_FOUND) {
- reiserfs_warning ("vs-2140: finish_unfinished: search_by_key returned %d\n",
+ reiserfs_warning (s, "vs-2140: finish_unfinished: search_by_key returned %d",
retval);
break;
}
bh = get_last_bh (&path);
item_pos = get_item_pos (&path);
if (item_pos != B_NR_ITEMS (bh)) {
- reiserfs_warning ("vs-2060: finish_unfinished: wrong position found\n");
+ reiserfs_warning (s, "vs-2060: finish_unfinished: wrong position found");
break;
}
item_pos --;
if (!inode) {
/* the unlink almost completed, it just did not manage to remove
"save" link and release objectid */
- reiserfs_warning ("vs-2180: finish_unfinished: iget failed for %K\n",
+ reiserfs_warning (s, "vs-2180: finish_unfinished: iget failed for %K",
&obj_key);
remove_save_link_only (s, &save_link_key, 1);
continue;
if (!truncate && inode->i_nlink) {
/* file is not unlinked */
- reiserfs_warning ("vs-2185: finish_unfinished: file %K is not unlinked\n",
+ reiserfs_warning (s, "vs-2185: finish_unfinished: file %K is not unlinked",
&obj_key);
remove_save_link_only (s, &save_link_key, 0);
continue;
The only imaginable way is to execute unfinished truncate request
then boot into old kernel, remove the file and create dir with
the same key. */
- reiserfs_warning("green-2101: impossible truncate on a directory %k. Please report\n", INODE_PKEY (inode));
+ reiserfs_warning(s, "green-2101: impossible truncate on a directory %k. Please report", INODE_PKEY (inode));
remove_save_link_only (s, &save_link_key, 0);
truncate = 0;
iput (inode);
REISERFS_I(inode) -> i_flags |= i_link_saved_truncate_mask;
/* not completed truncate found. New size was committed together
with "save" link */
- reiserfs_warning ("Truncating %k to %Ld ..",
+ reiserfs_info (s, "Truncating %k to %Ld ..",
INODE_PKEY (inode), inode->i_size);
reiserfs_truncate_file (inode, 0/*don't update modification time*/);
remove_save_link (inode, truncate);
} else {
REISERFS_I(inode) -> i_flags |= i_link_saved_unlink_mask;
/* not completed unlink (rmdir) found */
- reiserfs_warning ("Removing %k..", INODE_PKEY (inode));
+ reiserfs_info (s, "Removing %k..", INODE_PKEY (inode));
/* removal gets completed in iput */
}
pathrelse (&path);
if (done)
- reiserfs_warning ("There were %d uncompleted unlinks/truncates. "
+ reiserfs_info (s, "There were %d uncompleted unlinks/truncates. "
"Completed\n", done);
}
} else {
/* truncate */
if (S_ISDIR (inode->i_mode))
- reiserfs_warning("green-2102: Adding a truncate savelink for a directory %k! Please report\n", INODE_PKEY(inode));
+ reiserfs_warning(inode->i_sb, "green-2102: Adding a truncate savelink for a directory %k! Please report", INODE_PKEY(inode));
set_cpu_key_k_offset (&key, 1);
set_cpu_key_k_type (&key, TYPE_INDIRECT);
retval = search_item (inode->i_sb, &key, &path);
if (retval != ITEM_NOT_FOUND) {
if ( retval != -ENOSPC )
- reiserfs_warning ("vs-2100: add_save_link:"
- "search_by_key (%K) returned %d\n", &key, retval);
+ reiserfs_warning (inode->i_sb, "vs-2100: add_save_link:"
+ "search_by_key (%K) returned %d", &key, retval);
pathrelse (&path);
return;
}
/* body of "save" link */
link = INODE_PKEY (inode)->k_dir_id;
- /* put "save" link inot tree */
- retval = reiserfs_insert_item (th, &path, &key, &ih, (char *)&link);
+ /* put "save" link inot tree, don't charge quota to anyone */
+ retval = reiserfs_insert_item (th, &path, &key, &ih, NULL, (char *)&link);
if (retval) {
if (retval != -ENOSPC)
- reiserfs_warning ("vs-2120: add_save_link: insert_item returned %d\n",
+ reiserfs_warning (inode->i_sb, "vs-2120: add_save_link: insert_item returned %d",
retval);
} else {
if( truncate )
( REISERFS_I(inode) -> i_flags & i_link_saved_truncate_mask ) ) ||
( !truncate &&
( REISERFS_I(inode) -> i_flags & i_link_saved_unlink_mask ) ) )
- reiserfs_delete_solid_item (&th, &key);
+ /* don't take quota bytes from anywhere */
+ reiserfs_delete_solid_item (&th, NULL, &key);
if (!truncate) {
reiserfs_release_objectid (&th, inode->i_ino);
REISERFS_I(inode) -> i_flags &= ~i_link_saved_unlink_mask;
{
int i;
struct reiserfs_transaction_handle th ;
+
+ if (REISERFS_SB(s)->xattr_root) {
+ d_invalidate (REISERFS_SB(s)->xattr_root);
+ dput (REISERFS_SB(s)->xattr_root);
+ }
+ if (REISERFS_SB(s)->priv_root) {
+ d_invalidate (REISERFS_SB(s)->priv_root);
+ dput (REISERFS_SB(s)->priv_root);
+ }
+
/* change file system state to current state if it was mounted with read-write permissions */
if (!(s->s_flags & MS_RDONLY)) {
journal_begin(&th, s, 10) ;
print_statistics (s);
if (REISERFS_SB(s)->s_kmallocs != 0) {
- reiserfs_warning ("vs-2004: reiserfs_put_super: allocated memory left %d\n",
+ reiserfs_warning (s, "vs-2004: reiserfs_put_super: allocated memory left %d",
REISERFS_SB(s)->s_kmallocs);
}
if (REISERFS_SB(s)->reserved_blocks != 0) {
- reiserfs_warning ("green-2005: reiserfs_put_super: reserved blocks left %d\n",
+ reiserfs_warning (s, "green-2005: reiserfs_put_super: reserved blocks left %d",
REISERFS_SB(s)->reserved_blocks);
}
SLAB_CTOR_CONSTRUCTOR) {
INIT_LIST_HEAD(&ei->i_prealloc_list) ;
inode_init_once(&ei->vfs_inode);
+ ei->i_acl_access = NULL;
+ ei->i_acl_default = NULL;
}
}
{
reiserfs_inode_cachep = kmem_cache_create("reiser_inode_cache",
sizeof(struct reiserfs_inode_info),
- 0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
+ 0, SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (reiserfs_inode_cachep == NULL)
return -ENOMEM;
static void destroy_inodecache(void)
{
if (kmem_cache_destroy(reiserfs_inode_cachep))
- printk(KERN_INFO "reiserfs_inode_cache: not all structures were freed\n");
+ reiserfs_warning (NULL, "reiserfs_inode_cache: not all structures were freed");
}
/* we don't mark inodes dirty, we just log them */
struct reiserfs_transaction_handle th ;
if (inode->i_sb->s_flags & MS_RDONLY) {
- reiserfs_warning("clm-6006: writing inode %lu on readonly FS\n",
+ reiserfs_warning(inode->i_sb, "clm-6006: writing inode %lu on readonly FS",
inode->i_ino) ;
return ;
}
reiserfs_write_unlock(inode->i_sb);
}
+static void reiserfs_clear_inode (struct inode *inode)
+{
+ struct posix_acl *acl;
+
+ acl = REISERFS_I(inode)->i_acl_access;
+ if (acl && !IS_ERR (acl))
+ posix_acl_release (acl);
+ REISERFS_I(inode)->i_acl_access = NULL;
+
+ acl = REISERFS_I(inode)->i_acl_default;
+ if (acl && !IS_ERR (acl))
+ posix_acl_release (acl);
+ REISERFS_I(inode)->i_acl_default = NULL;
+}
+
struct super_operations reiserfs_sops =
{
.alloc_inode = reiserfs_alloc_inode,
.write_inode = reiserfs_write_inode,
.dirty_inode = reiserfs_dirty_inode,
.delete_inode = reiserfs_delete_inode,
+ .clear_inode = reiserfs_clear_inode,
.put_super = reiserfs_put_super,
.write_super = reiserfs_write_super,
.write_super_lockfs = reiserfs_write_super_lockfs,
{NULL, 0}
};
+/* possible values for -o barrier= */
+static const arg_desc_t barrier_mode[] = {
+ {"none", 1<<REISERFS_BARRIER_NONE, 1<<REISERFS_BARRIER_FLUSH},
+ {"flush", 1<<REISERFS_BARRIER_FLUSH, 1<<REISERFS_BARRIER_NONE},
+ {NULL, 0}
+};
+
/* possible values for "-o block-allocator=" and bits which are to be set in
s_mount_opt of reiserfs specific part of in-core super block */
static const arg_desc_t balloc[] = {
}
}
if (!opt->option_name) {
- printk ("reiserfs_getopt: unknown option \"%s\"\n", p);
+ reiserfs_warning (s, "unknown mount option \"%s\"", p);
return -1;
}
switch (*p) {
case '=':
if (!opt->arg_required) {
- printk ("reiserfs_getopt: the option \"%s\" does not require an argument\n",
+ reiserfs_warning (s, "the option \"%s\" does not require an argument",
opt->option_name);
return -1;
}
case 0:
if (opt->arg_required) {
- printk ("reiserfs_getopt: the option \"%s\" requires an argument\n", opt->option_name);
+ reiserfs_warning (s, "the option \"%s\" requires an argument", opt->option_name);
return -1;
}
break;
default:
- printk ("reiserfs_getopt: head of option \"%s\" is only correct\n", opt->option_name);
+ reiserfs_warning (s, "head of option \"%s\" is only correct", opt->option_name);
return -1;
}
-
+
/* move to the argument, or to next option if argument is not required */
p ++;
if ( opt->arg_required && !strlen (p) ) {
/* this catches "option=," */
- printk ("reiserfs_getopt: empty argument for \"%s\"\n", opt->option_name);
+ reiserfs_warning (s, "empty argument for \"%s\"", opt->option_name);
return -1;
}
}
}
- printk ("reiserfs_getopt: bad value \"%s\" for option \"%s\"\n", p, opt->option_name);
+ reiserfs_warning (s, "bad value \"%s\" for option \"%s\"", p, opt->option_name);
return -1;
}
char * arg = NULL;
char * pos;
opt_desc_t opts[] = {
- {"tails", 't', tails, 0, 0}, /* Compatibility stuff, so that -o notail for old setups still work */
- {"notail", 0, 0, 0, (1<<REISERFS_LARGETAIL)|(1<<REISERFS_SMALLTAIL)},
- {"conv", 0, 0, 1<<REISERFS_CONVERT, 0},
- {"attrs", 0, 0, 1<<REISERFS_ATTRS, 0},
- {"noattrs", 0, 0, 0, 1<<REISERFS_ATTRS},
- {"nolog", 0, 0, 0, 0}, /* This is unsupported */
- {"replayonly", 0, 0, 1<<REPLAYONLY, 0},
- {"block-allocator", 'a', balloc, 0, 0},
- {"data", 'd', logging_mode, 0, 0},
- {"resize", 'r', 0, 0, 0},
- {"jdev", 'j', 0, 0, 0},
- {"nolargeio", 'w', 0, 0, 0},
- {"commit", 'c', 0, 0, 0},
- {NULL, 0, 0, 0, 0}
+ /* Compatibility stuff, so that -o notail for old setups still work */
+ {"tails", .arg_required = 't', .values = tails},
+ {"notail", .clrmask = (1<<REISERFS_LARGETAIL)|(1<<REISERFS_SMALLTAIL)},
+ {"conv", .setmask = 1<<REISERFS_CONVERT},
+ {"attrs", .setmask = 1<<REISERFS_ATTRS},
+ {"noattrs", .clrmask = 1<<REISERFS_ATTRS},
+ {"user_xattr", .setmask = 1<<REISERFS_XATTRS_USER},
+ {"nouser_xattr",.clrmask = 1<<REISERFS_XATTRS_USER},
+ {"tagxid", .setmask = 1<<REISERFS_TAGXID},
+#ifdef CONFIG_REISERFS_FS_POSIX_ACL
+ {"acl", .setmask = 1<<REISERFS_POSIXACL},
+ {"noacl", .clrmask = 1<<REISERFS_POSIXACL},
+#endif
+ {"nolog",}, /* This is unsupported */
+ {"replayonly", .setmask = 1<<REPLAYONLY},
+ {"block-allocator", .arg_required = 'a', .values = balloc},
+ {"data", .arg_required = 'd', .values = logging_mode},
+ {"barrier", .arg_required = 'b', .values = barrier_mode},
+ {"resize", .arg_required = 'r', .values = NULL},
+ {"jdev", .arg_required = 'j', .values = NULL},
+ {"nolargeio", .arg_required = 'w', .values = NULL},
+ {"commit", .arg_required = 'c', .values = NULL},
+ {"usrquota",},
+ {"grpquota",},
+ {NULL,}
};
*blocks = 0;
if (c == 'r') {
char * p;
- p = 0;
+ p = NULL;
/* "resize=NNN" */
*blocks = simple_strtoul (arg, &p, 0);
if (*p != '\0') {
/* NNN does not look like a number */
- printk ("reiserfs_parse_options: bad value %s\n", arg);
+ reiserfs_warning (s, "reiserfs_parse_options: bad value %s", arg);
return 0;
}
}
if ( c == 'c' ) {
- char *p = 0;
- int val = simple_strtoul (arg, &p, 0);
+ char *p = NULL;
+ unsigned long val = simple_strtoul (arg, &p, 0);
/* commit=NNN (time in seconds) */
- if ( *p != '\0' || val < 0) {
- printk ("reiserfs_parse_options: bad value %s\n", arg);
- return 0;
+ if ( *p != '\0' || val >= (unsigned int)-1) {
+ reiserfs_warning (s, "reiserfs_parse_options: bad value %s", arg); return 0;
}
- *commit_max_age = val;
+ *commit_max_age = (unsigned int)val;
}
if ( c == 'w' ) {
- char *p=0;
+ char *p=NULL;
int val = simple_strtoul (arg, &p, 0);
if ( *p != '\0') {
- printk ("reiserfs_parse_options: non-numeric value %s for nolargeio option\n", arg);
+ reiserfs_warning (s, "reiserfs_parse_options: non-numeric value %s for nolargeio option", arg);
return 0;
}
if ( val )
if (c == 'j') {
if (arg && *arg && jdev_name) {
if ( *jdev_name ) { //Hm, already assigned?
- printk("reiserfs_parse_options: journal device was already specified to be %s\n", *jdev_name);
+ reiserfs_warning (s, "reiserfs_parse_options: journal device was already specified to be %s", *jdev_name);
return 0;
}
*jdev_name = arg;
if (mount_options & (1 << REISERFS_DATA_LOG)) {
if (!reiserfs_data_log(s)) {
switch_data_mode(s, REISERFS_DATA_LOG);
- printk("reiserfs: switching to journaled data mode\n");
+ reiserfs_info (s, "switching to journaled data mode\n");
}
} else if (mount_options & (1 << REISERFS_DATA_ORDERED)) {
if (!reiserfs_data_ordered(s)) {
switch_data_mode(s, REISERFS_DATA_ORDERED);
- printk("reiserfs: switching to ordered data mode\n");
+ reiserfs_info (s, "switching to ordered data mode\n");
}
} else if (mount_options & (1 << REISERFS_DATA_WRITEBACK)) {
if (!reiserfs_data_writeback(s)) {
switch_data_mode(s, REISERFS_DATA_WRITEBACK);
- printk("reiserfs: switching to writeback data mode\n");
+ reiserfs_info (s, "switching to writeback data mode\n");
}
}
}
+static void handle_barrier_mode(struct super_block *s, unsigned long bits) {
+ int flush = (1 << REISERFS_BARRIER_FLUSH);
+ int none = (1 << REISERFS_BARRIER_NONE);
+ int all_barrier = flush | none;
+
+ if (bits & all_barrier) {
+ REISERFS_SB(s)->s_mount_opt &= ~all_barrier;
+ if (bits & flush) {
+ REISERFS_SB(s)->s_mount_opt |= flush;
+ printk("reiserfs: enabling write barrier flush mode\n");
+ } else if (bits & none) {
+ REISERFS_SB(s)->s_mount_opt |= none;
+ printk("reiserfs: write barriers turned off\n");
+ }
+ }
+}
+
static void handle_attrs( struct super_block *s )
{
struct reiserfs_super_block * rs;
if( reiserfs_attrs( s ) ) {
rs = SB_DISK_SUPER_BLOCK (s);
if( old_format_only(s) ) {
- reiserfs_warning( "reiserfs: cannot support attributes on 3.5.x disk format\n" );
+ reiserfs_warning(s, "reiserfs: cannot support attributes on 3.5.x disk format" );
REISERFS_SB(s) -> s_mount_opt &= ~ ( 1 << REISERFS_ATTRS );
return;
}
if( !( le32_to_cpu( rs -> s_flags ) & reiserfs_attrs_cleared ) ) {
- reiserfs_warning( "reiserfs: cannot support attributes until flag is set in super-block\n" );
+ reiserfs_warning(s, "reiserfs: cannot support attributes until flag is set in super-block" );
REISERFS_SB(s) -> s_mount_opt &= ~ ( 1 << REISERFS_ATTRS );
}
}
unsigned long blocks;
unsigned long mount_options = REISERFS_SB(s)->s_mount_opt;
unsigned long safe_mask = 0;
- unsigned int commit_max_age = 0;
+ unsigned int commit_max_age = (unsigned int)-1;
rs = SB_DISK_SUPER_BLOCK (s);
safe_mask |= 1 << REISERFS_HASHED_RELOCATION;
safe_mask |= 1 << REISERFS_TEST4;
safe_mask |= 1 << REISERFS_ATTRS;
+ safe_mask |= 1 << REISERFS_XATTRS_USER;
+ safe_mask |= 1 << REISERFS_POSIXACL;
+ safe_mask |= 1 << REISERFS_BARRIER_FLUSH;
+ safe_mask |= 1 << REISERFS_BARRIER_NONE;
/* Update the bitmask, taking care to keep
* the bits we're not allowed to change here */
REISERFS_SB(s)->s_mount_opt = (REISERFS_SB(s)->s_mount_opt & ~safe_mask) | (mount_options & safe_mask);
- if(commit_max_age != 0) {
+ if(commit_max_age != 0 && commit_max_age != (unsigned int)-1) {
SB_JOURNAL_MAX_COMMIT_AGE(s) = commit_max_age;
SB_JOURNAL_MAX_TRANS_AGE(s) = commit_max_age;
}
- else
+ else if(commit_max_age == 0)
{
/* 0 means restore defaults. */
SB_JOURNAL_MAX_COMMIT_AGE(s) = SB_JOURNAL_DEFAULT_MAX_COMMIT_AGE(s);
}
if (*mount_flags & MS_RDONLY) {
+ reiserfs_xattr_init (s, *mount_flags);
/* remount read-only */
if (s->s_flags & MS_RDONLY)
/* it is read-only already */
journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB (s));
} else {
/* remount read-write */
- if (!(s->s_flags & MS_RDONLY))
+ if (!(s->s_flags & MS_RDONLY)) {
+ reiserfs_xattr_init (s, *mount_flags);
return 0; /* We are read-write already */
+ }
handle_data_mode(s, mount_options);
+ handle_barrier_mode(s, mount_options);
REISERFS_SB(s)->s_mount_state = sb_umount_state(rs) ;
s->s_flags &= ~MS_RDONLY ; /* now it is safe to call journal_begin */
journal_begin(&th, s, 10) ;
journal_end(&th, s, 10) ;
s->s_dirt = 0;
- if (!( *mount_flags & MS_RDONLY ) )
+ if (!( *mount_flags & MS_RDONLY ) ) {
finish_unfinished( s );
+ reiserfs_xattr_init (s, *mount_flags);
+ }
return 0;
}
#ifdef CONFIG_REISERFS_CHECK
// This outputs a lot of unneded info on big FSes
-// reiserfs_warning ("bitmap loaded from block %d: %d free blocks\n",
+// reiserfs_warning ("bitmap loaded from block %d: %d free blocks",
// bi->bh->b_blocknr, bi->free_count);
#endif
}
for (i = 0; i < SB_BMAP_NR(s); i++) {
wait_on_buffer(SB_AP_BITMAP (s)[i].bh);
if (!buffer_uptodate(SB_AP_BITMAP(s)[i].bh)) {
- reiserfs_warning("sh-2029: reiserfs read_bitmaps: "
- "bitmap block (#%lu) reading failed\n",
+ reiserfs_warning(s,"sh-2029: reiserfs read_bitmaps: "
+ "bitmap block (#%lu) reading failed",
SB_AP_BITMAP(s)[i].bh->b_blocknr);
for (i = 0; i < SB_BMAP_NR(s); i++)
brelse(SB_AP_BITMAP(s)[i].bh);
}
if (free != SB_FREE_BLOCKS (s))
- reiserfs_warning ("vs-4000: check_bitmap: %d free blocks, must be %d\n",
+ reiserfs_warning (s,"vs-4000: check_bitmap: %d free blocks, must be %d",
free, SB_FREE_BLOCKS (s));
}
bh = sb_bread (s, offset / s->s_blocksize);
if (!bh) {
- printk ("sh-2006: read_super_block: "
- "bread failed (dev %s, block %lu, size %lu)\n",
+ reiserfs_warning (s, "sh-2006: read_super_block: "
+ "bread failed (dev %s, block %lu, size %lu)",
reiserfs_bdevname (s), offset / s->s_blocksize, s->s_blocksize);
return 1;
}
bh = sb_bread (s, offset / s->s_blocksize);
if (!bh) {
- printk("sh-2007: read_super_block: "
+ reiserfs_warning (s, "sh-2007: read_super_block: "
"bread failed (dev %s, block %lu, size %lu)\n",
reiserfs_bdevname (s), offset / s->s_blocksize, s->s_blocksize);
return 1;
rs = (struct reiserfs_super_block *)bh->b_data;
if (sb_blocksize(rs) != s->s_blocksize) {
- printk ("sh-2011: read_super_block: "
+ reiserfs_warning (s, "sh-2011: read_super_block: "
"can't find a reiserfs filesystem on (dev %s, block %Lu, size %lu)\n",
reiserfs_bdevname (s), (unsigned long long)bh->b_blocknr, s->s_blocksize);
brelse (bh);
if ( rs->s_v1.s_root_block == -1 ) {
brelse(bh) ;
- printk("dev %s: Unfinished reiserfsck --rebuild-tree run detected. Please run\n"
+ reiserfs_warning (s, "Unfinished reiserfsck --rebuild-tree run detected. Please run\n"
"reiserfsck --rebuild-tree and wait for a completion. If that fails\n"
- "get newer reiserfsprogs package\n", reiserfs_bdevname (s));
+ "get newer reiserfsprogs package");
return 1;
}
/* magic is of non-standard journal filesystem, look at s_version to
find which format is in use */
if (sb_version(rs) == REISERFS_VERSION_2)
- printk ("read_super_block: found reiserfs format \"3.6\" "
- "with non-standard journal\n");
+ reiserfs_warning (s, "read_super_block: found reiserfs format \"3.6\""
+ " with non-standard journal");
else if (sb_version(rs) == REISERFS_VERSION_1)
- printk ("read_super_block: found reiserfs format \"3.5\" "
- "with non-standard journal\n");
+ reiserfs_warning (s, "read_super_block: found reiserfs format \"3.5\""
+ " with non-standard journal");
else {
- printk ("sh-2012: read_super_block: found unknown format \"%u\" "
- "of reiserfs with non-standard magic\n", sb_version(rs));
+ reiserfs_warning (s, "sh-2012: read_super_block: found unknown "
+ "format \"%u\" of reiserfs with non-standard magic",
+ sb_version(rs));
return 1;
}
}
else
/* s_version of standard format may contain incorrect information,
so we just look at the magic string */
- printk ("found reiserfs format \"%s\" with standard journal\n",
+ reiserfs_info (s, "found reiserfs format \"%s\" with standard journal\n",
is_reiserfs_3_5 (rs) ? "3.5" : "3.6");
s->s_op = &reiserfs_sops;
ll_rw_block(READ, 1, &(SB_BUFFER_WITH_SB(s))) ;
wait_on_buffer(SB_BUFFER_WITH_SB(s)) ;
if (!buffer_uptodate(SB_BUFFER_WITH_SB(s))) {
- printk("reread_meta_blocks, error reading the super\n") ;
+ reiserfs_warning (s, "reread_meta_blocks, error reading the super") ;
return 1 ;
}
ll_rw_block(READ, 1, &(SB_AP_BITMAP(s)[i].bh)) ;
wait_on_buffer(SB_AP_BITMAP(s)[i].bh) ;
if (!buffer_uptodate(SB_AP_BITMAP(s)[i].bh)) {
- printk("reread_meta_blocks, error reading bitmap block number %d at %llu\n",
+ reiserfs_warning (s, "reread_meta_blocks, error reading bitmap block number %d at %llu",
i, (unsigned long long)SB_AP_BITMAP(s)[i].bh->b_blocknr) ;
return 1 ;
}
if (reiserfs_rupasov_hash(s)) {
hash = YURA_HASH ;
}
- reiserfs_warning("reiserfs: FS seems to be empty, autodetect "
- "is using the default hash\n");
+ reiserfs_warning(s,"FS seems to be empty, autodetect "
+ "is using the default hash");
break;
}
r5hash=GET_HASH_VALUE (r5_hash (de.de_name, de.de_namelen));
if ( ( (teahash == r5hash) && (GET_HASH_VALUE( deh_offset(&(de.de_deh[de.de_entry_num]))) == r5hash) ) ||
( (teahash == yurahash) && (yurahash == GET_HASH_VALUE( deh_offset(&(de.de_deh[de.de_entry_num])))) ) ||
( (r5hash == yurahash) && (yurahash == GET_HASH_VALUE( deh_offset(&(de.de_deh[de.de_entry_num])))) ) ) {
- reiserfs_warning("reiserfs: Unable to automatically detect hash"
- "function for device %s\n"
- "please mount with -o hash={tea,rupasov,r5}\n", reiserfs_bdevname (s));
+ reiserfs_warning(s,"Unable to automatically detect hash function. "
+ "Please mount with -o hash={tea,rupasov,r5}",
+ reiserfs_bdevname (s));
hash = UNSET_HASH;
break;
}
else if (GET_HASH_VALUE( deh_offset(&(de.de_deh[de.de_entry_num])) ) == r5hash)
hash = R5_HASH;
else {
- reiserfs_warning("reiserfs: Unrecognised hash function for "
- "device %s\n", reiserfs_bdevname (s));
+ reiserfs_warning (s,"Unrecognised hash function");
hash = UNSET_HASH;
}
} while (0);
** mount options
*/
if (reiserfs_rupasov_hash(s) && code != YURA_HASH) {
- printk("REISERFS: Error, %s hash detected, "
- "unable to force rupasov hash\n", reiserfs_hashname(code)) ;
+ reiserfs_warning (s, "Error, %s hash detected, "
+ "unable to force rupasov hash", reiserfs_hashname(code)) ;
code = UNSET_HASH ;
} else if (reiserfs_tea_hash(s) && code != TEA_HASH) {
- printk("REISERFS: Error, %s hash detected, "
- "unable to force tea hash\n", reiserfs_hashname(code)) ;
+ reiserfs_warning (s, "Error, %s hash detected, "
+ "unable to force tea hash", reiserfs_hashname(code)) ;
code = UNSET_HASH ;
} else if (reiserfs_r5_hash(s) && code != R5_HASH) {
- printk("REISERFS: Error, %s hash detected, "
- "unable to force r5 hash\n", reiserfs_hashname(code)) ;
+ reiserfs_warning (s, "Error, %s hash detected, "
+ "unable to force r5 hash", reiserfs_hashname(code)) ;
code = UNSET_HASH ;
}
} else {
{
switch (what_hash (s)) {
case TEA_HASH:
- reiserfs_warning ("Using tea hash to sort names\n");
+ reiserfs_info (s, "Using tea hash to sort names\n");
return keyed_hash;
case YURA_HASH:
- reiserfs_warning ("Using rupasov hash to sort names\n");
+ reiserfs_info (s, "Using rupasov hash to sort names\n");
return yura_hash;
case R5_HASH:
- reiserfs_warning ("Using r5 hash to sort names\n");
+ reiserfs_info (s, "Using r5 hash to sort names\n");
return r5_hash;
}
return NULL;
return 0;
}
-#define SPRINTK(silent, ...) \
+#define SWARN(silent, s, ...) \
if (!(silent)) \
- printk(__VA_ARGS__)
+ reiserfs_warning (s, __VA_ARGS__)
static int reiserfs_fill_super (struct super_block * s, void * data, int silent)
{
struct reiserfs_transaction_handle th ;
int old_format = 0;
unsigned long blocks;
- unsigned int commit_max_age = 0;
+ unsigned int commit_max_age = 0;
int jinit_done = 0 ;
struct reiserfs_iget_args args ;
struct reiserfs_super_block * rs;
memset (sbi, 0, sizeof (struct reiserfs_sb_info));
/* Set default values for options: non-aggressive tails */
REISERFS_SB(s)->s_mount_opt = ( 1 << REISERFS_SMALLTAIL );
- /* default block allocator option: skip_busy */
- REISERFS_SB(s)->s_alloc_options.bits = ( 1 << 5);
- /* If file grew past 4 blocks, start preallocation blocks for it. */
- REISERFS_SB(s)->s_alloc_options.preallocmin = 4;
+ /* no preallocation minimum, be smart in
+ reiserfs_file_write instead */
+ REISERFS_SB(s)->s_alloc_options.preallocmin = 0;
/* Preallocate by 16 blocks (17-1) at once */
REISERFS_SB(s)->s_alloc_options.preallocsize = 17;
+ /* Initialize the rwsem for xattr dir */
+ init_rwsem(&REISERFS_SB(s)->xattr_dir_sem);
+
+ /* setup default block allocator options */
+ reiserfs_init_alloc_options(s);
jdev_name = NULL;
if (reiserfs_parse_options (s, (char *) data, &(sbi->s_mount_opt), &blocks, &jdev_name, &commit_max_age) == 0) {
}
if (blocks) {
- SPRINTK(silent, "jmacd-7: reiserfs_fill_super: resize option for remount only\n");
+ SWARN (silent, s, "jmacd-7: reiserfs_fill_super: resize option "
+ "for remount only");
goto error;
}
old_format = 1;
/* try new format (64-th 1k block), which can contain reiserfs super block */
else if (read_super_block (s, REISERFS_DISK_OFFSET_IN_BYTES)) {
- SPRINTK(silent, "sh-2021: reiserfs_fill_super: can not find reiserfs on %s\n", reiserfs_bdevname (s));
+ SWARN(silent, s, "sh-2021: reiserfs_fill_super: can not find reiserfs on %s", reiserfs_bdevname (s));
goto error;
}
smaller than the filesystem. If the check fails then abort and scream,
because bad stuff will happen otherwise. */
if ( s->s_bdev && s->s_bdev->bd_inode && i_size_read(s->s_bdev->bd_inode) < sb_block_count(rs)*sb_blocksize(rs)) {
- SPRINTK(silent, "Filesystem on %s cannot be mounted because it is bigger than the device\n", reiserfs_bdevname(s));
- SPRINTK(silent, "You may need to run fsck or increase size of your LVM partition\n");
- SPRINTK(silent, "Or may be you forgot to reboot after fdisk when it told you to\n");
+ SWARN (silent, s, "Filesystem on %s cannot be mounted because it is bigger than the device", reiserfs_bdevname(s));
+ SWARN(silent, s, "You may need to run fsck or increase size of your LVM partition");
+ SWARN(silent, s, "Or may be you forgot to reboot after fdisk when it told you to");
goto error;
}
sbi->s_mount_state = REISERFS_VALID_FS ;
if (old_format ? read_old_bitmaps(s) : read_bitmaps(s)) {
- SPRINTK(silent, "jmacd-8: reiserfs_fill_super: unable to read bitmap\n");
+ SWARN(silent, s, "jmacd-8: reiserfs_fill_super: unable to read bitmap");
goto error;
}
#ifdef CONFIG_REISERFS_CHECK
- SPRINTK(silent, "reiserfs:warning: CONFIG_REISERFS_CHECK is set ON\n");
- SPRINTK(silent, "reiserfs:warning: - it is slow mode for debugging.\n");
+ SWARN (silent, s, "CONFIG_REISERFS_CHECK is set ON");
+ SWARN (silent, s, "- it is slow mode for debugging.");
#endif
/* make data=ordered the default */
}
if (reiserfs_data_log(s)) {
- printk("reiserfs: using journaled data mode\n");
+ reiserfs_info (s, "using journaled data mode\n");
} else if (reiserfs_data_ordered(s)) {
- printk("reiserfs: using ordered data mode\n");
+ reiserfs_info (s, "using ordered data mode\n");
} else {
- printk("reiserfs: using writeback data mode\n");
+ reiserfs_info (s, "using writeback data mode\n");
+ }
+ if (reiserfs_barrier_flush(s)) {
+ printk("reiserfs: using flush barriers\n");
}
// set_device_ro(s->s_dev, 1) ;
if( journal_init(s, jdev_name, old_format, commit_max_age) ) {
- SPRINTK(silent, "sh-2022: reiserfs_fill_super: unable to initialize journal space\n") ;
+ SWARN(silent, s, "sh-2022: reiserfs_fill_super: unable to initialize journal space") ;
goto error ;
} else {
jinit_done = 1 ; /* once this is set, journal_release must be called
*/
}
if (reread_meta_blocks(s)) {
- SPRINTK(silent, "jmacd-9: reiserfs_fill_super: unable to reread meta blocks after journal init\n") ;
+ SWARN(silent, s, "jmacd-9: reiserfs_fill_super: unable to reread meta blocks after journal init") ;
goto error ;
}
goto error;
if (bdev_read_only(s->s_bdev) && !(s->s_flags & MS_RDONLY)) {
- SPRINTK(silent, "clm-7000: Detected readonly device, marking FS readonly\n") ;
+ SWARN(silent, s, "clm-7000: Detected readonly device, marking FS readonly") ;
s->s_flags |= MS_RDONLY ;
}
args.objectid = REISERFS_ROOT_OBJECTID ;
args.dirid = REISERFS_ROOT_PARENT_OBJECTID ;
root_inode = iget5_locked (s, REISERFS_ROOT_OBJECTID, reiserfs_find_actor, reiserfs_init_locked_inode, (void *)(&args));
if (!root_inode) {
- SPRINTK(silent, "jmacd-10: reiserfs_fill_super: get root inode failed\n");
+ SWARN(silent, s, "jmacd-10: reiserfs_fill_super: get root inode failed");
goto error;
}
if (convert_reiserfs (s)) {
/* and -o conv is given */
if(!silent)
- reiserfs_warning ("reiserfs: converting 3.5 filesystem to the 3.6 format\n") ;
+ reiserfs_info (s,"converting 3.5 filesystem to the 3.6 format") ;
if (is_reiserfs_3_5 (rs))
/* put magic string of 3.6 format. 2.2 will not be able to
set_bit(REISERFS_3_6, &(sbi->s_properties));
clear_bit(REISERFS_3_5, &(sbi->s_properties));
} else if (!silent){
- reiserfs_warning("reiserfs: using 3.5.x disk format\n") ;
+ reiserfs_info (s, "using 3.5.x disk format\n") ;
}
}
journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB (s));
journal_end(&th, s, 1) ;
-
+
+ if (reiserfs_xattr_init (s, s->s_flags)) {
+ dput (s->s_root);
+ s->s_root = NULL;
+ goto error;
+ }
+
/* look for files which were to be removed in previous session */
finish_unfinished (s);
} else {
if ( old_format_only(s) && !silent) {
- reiserfs_warning("reiserfs: using 3.5.x disk format\n") ;
+ reiserfs_info (s, "using 3.5.x disk format\n") ;
+ }
+
+ if (reiserfs_xattr_init (s, s->s_flags)) {
+ dput (s->s_root);
+ s->s_root = NULL;
+ goto error;
}
}
// mark hash in super block: it could be unset. overwrite should be ok
return ret;
}
+ if ((ret = reiserfs_xattr_register_handlers ()))
+ goto failed_reiserfs_xattr_register_handlers;
+
reiserfs_proc_info_global_init ();
reiserfs_proc_register_global ("version", reiserfs_global_version_in_proc);
return 0;
}
+ reiserfs_xattr_unregister_handlers ();
+
+failed_reiserfs_xattr_register_handlers:
reiserfs_proc_unregister_global ("version");
reiserfs_proc_info_global_done ();
destroy_inodecache ();
static void __exit
exit_reiserfs_fs ( void )
{
+ reiserfs_xattr_unregister_handlers ();
reiserfs_proc_unregister_global ("version");
reiserfs_proc_info_global_done ();
unregister_filesystem (& reiserfs_fs_type);