{
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;
REISERFS_I(inode)->i_acl_default = NULL;
}
-
struct super_operations reiserfs_sops =
{
.alloc_inode = reiserfs_alloc_inode,
{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[] = {
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 ++;
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},
- {"user_xattr", 0, 0, 1<<REISERFS_XATTRS_USER, 0},
- {"nouser_xattr", 0, 0, 0, 1<<REISERFS_XATTRS_USER},
+ /* 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", 0, 0, 1<<REISERFS_POSIXACL, 0},
- {"noacl", 0, 0, 0, 1<<REISERFS_POSIXACL},
+ {"acl", .setmask = 1<<REISERFS_POSIXACL},
+ {"noacl", .clrmask = 1<<REISERFS_POSIXACL},
#endif
- {"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},
- {"usrquota", 0, 0, 0, 0},
- {"grpquota", 0, 0, 0, 0},
- {"tagxid", 0, 0, 1<<REISERFS_TAGXID, 0},
- {NULL, 0, 0, 0, 0}
+ {"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') {
}
if ( c == 'c' ) {
- char *p = 0;
+ char *p = NULL;
unsigned long val = simple_strtoul (arg, &p, 0);
/* commit=NNN (time in seconds) */
if ( *p != '\0' || val >= (unsigned int)-1) {
}
if ( c == 'w' ) {
- char *p=0;
+ char *p=NULL;
int val = simple_strtoul (arg, &p, 0);
if ( *p != '\0') {
}
}
+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;
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 */
}
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) ;
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) {
goto error;
} else {
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) ) {