Merge branch 'reiserfs-updates' from Jeff Mahoney

* reiserfs-updates: (35 commits)
  reiserfs: rename [cn]_* variables
  reiserfs: rename p_._ variables
  reiserfs: rename p_s_tb to tb
  reiserfs: rename p_s_inode to inode
  reiserfs: rename p_s_bh to bh
  reiserfs: rename p_s_sb to sb
  reiserfs: strip trailing whitespace
  reiserfs: cleanup path functions
  reiserfs: factor out buffer_info initialization
  reiserfs: add atomic addition of selinux attributes during inode creation
  reiserfs: use generic readdir for operations across all xattrs
  reiserfs: journaled xattrs
  reiserfs: use generic xattr handlers
  reiserfs: remove i_has_xattr_dir
  reiserfs: make per-inode xattr locking more fine grained
  reiserfs: eliminate per-super xattr lock
  reiserfs: simplify xattr internal file lookups/opens
  reiserfs: Clean up xattrs when REISERFS_FS_XATTR is unset
  reiserfs: remove IS_PRIVATE helpers
  reiserfs: remove link detection code
  ...

Fixed up conflicts manually due to:
 - quota name cleanups vs variable naming changes:
	fs/reiserfs/inode.c
	fs/reiserfs/namei.c
	fs/reiserfs/stree.c
        fs/reiserfs/xattr.c
 - exported include header cleanups
	include/linux/reiserfs_fs.h
This commit is contained in:
Linus Torvalds 2009-03-30 12:29:21 -07:00
commit e1c5024828
32 changed files with 3384 additions and 3648 deletions

View File

@ -7,10 +7,10 @@ obj-$(CONFIG_REISERFS_FS) += reiserfs.o
reiserfs-objs := bitmap.o do_balan.o namei.o inode.o file.o dir.o fix_node.o \
super.o prints.o objectid.o lbalance.o ibalance.o stree.o \
hashes.o tail_conversion.o journal.o resize.o \
item_ops.o ioctl.o procfs.o
item_ops.o ioctl.o procfs.o xattr.o
ifeq ($(CONFIG_REISERFS_FS_XATTR),y)
reiserfs-objs += xattr.o xattr_user.o xattr_trusted.o
reiserfs-objs += xattr_user.o xattr_trusted.o
endif
ifeq ($(CONFIG_REISERFS_FS_SECURITY),y)

View File

@ -40,8 +40,8 @@
#define SET_OPTION(optname) \
do { \
reiserfs_warning(s, "reiserfs: option \"%s\" is set", #optname); \
set_bit(_ALLOC_ ## optname , &SB_ALLOC_OPTS(s)); \
reiserfs_info(s, "block allocator option \"%s\" is set", #optname); \
set_bit(_ALLOC_ ## optname , &SB_ALLOC_OPTS(s)); \
} while(0)
#define TEST_OPTION(optname, s) \
test_bit(_ALLOC_ ## optname , &SB_ALLOC_OPTS(s))
@ -64,9 +64,9 @@ int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value)
unsigned int bmap_count = reiserfs_bmap_count(s);
if (block == 0 || block >= SB_BLOCK_COUNT(s)) {
reiserfs_warning(s,
"vs-4010: is_reusable: block number is out of range %lu (%u)",
block, SB_BLOCK_COUNT(s));
reiserfs_error(s, "vs-4010",
"block number is out of range %lu (%u)",
block, SB_BLOCK_COUNT(s));
return 0;
}
@ -79,31 +79,30 @@ int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value)
b_blocknr_t bmap1 = REISERFS_SB(s)->s_sbh->b_blocknr + 1;
if (block >= bmap1 &&
block <= bmap1 + bmap_count) {
reiserfs_warning(s, "vs: 4019: is_reusable: "
"bitmap block %lu(%u) can't be freed or reused",
block, bmap_count);
reiserfs_error(s, "vs-4019", "bitmap block %lu(%u) "
"can't be freed or reused",
block, bmap_count);
return 0;
}
} else {
if (offset == 0) {
reiserfs_warning(s, "vs: 4020: is_reusable: "
"bitmap block %lu(%u) can't be freed or reused",
block, bmap_count);
reiserfs_error(s, "vs-4020", "bitmap block %lu(%u) "
"can't be freed or reused",
block, bmap_count);
return 0;
}
}
if (bmap >= bmap_count) {
reiserfs_warning(s,
"vs-4030: is_reusable: there is no so many bitmap blocks: "
"block=%lu, bitmap_nr=%u", block, bmap);
reiserfs_error(s, "vs-4030", "bitmap for requested block "
"is out of range: block=%lu, bitmap_nr=%u",
block, bmap);
return 0;
}
if (bit_value == 0 && block == SB_ROOT_BLOCK(s)) {
reiserfs_warning(s,
"vs-4050: is_reusable: this is root block (%u), "
"it must be busy", SB_ROOT_BLOCK(s));
reiserfs_error(s, "vs-4050", "this is root block (%u), "
"it must be busy", SB_ROOT_BLOCK(s));
return 0;
}
@ -154,8 +153,8 @@ static int scan_bitmap_block(struct reiserfs_transaction_handle *th,
/* - I mean `a window of zero bits' as in description of this function - Zam. */
if (!bi) {
reiserfs_warning(s, "NULL bitmap info pointer for bitmap %d",
bmap_n);
reiserfs_error(s, "jdm-4055", "NULL bitmap info pointer "
"for bitmap %d", bmap_n);
return 0;
}
@ -400,11 +399,8 @@ static void _reiserfs_free_block(struct reiserfs_transaction_handle *th,
get_bit_address(s, block, &nr, &offset);
if (nr >= reiserfs_bmap_count(s)) {
reiserfs_warning(s, "vs-4075: reiserfs_free_block: "
"block %lu is out of range on %s "
"(nr=%u,max=%u)", block,
reiserfs_bdevname(s), nr,
reiserfs_bmap_count(s));
reiserfs_error(s, "vs-4075", "block %lu is out of range",
block);
return;
}
@ -416,9 +412,8 @@ static void _reiserfs_free_block(struct reiserfs_transaction_handle *th,
/* clear bit for the given block in bit map */
if (!reiserfs_test_and_clear_le_bit(offset, bmbh->b_data)) {
reiserfs_warning(s, "vs-4080: reiserfs_free_block: "
"free_block (%s:%lu)[dev:blocknr]: bit already cleared",
reiserfs_bdevname(s), block);
reiserfs_error(s, "vs-4080",
"block %lu: bit already cleared", block);
}
apbi[nr].free_count++;
journal_mark_dirty(th, s, bmbh);
@ -445,7 +440,7 @@ void reiserfs_free_block(struct reiserfs_transaction_handle *th,
return;
if (block > sb_block_count(REISERFS_SB(s)->s_rs)) {
reiserfs_panic(th->t_super, "bitmap-4072",
reiserfs_error(th->t_super, "bitmap-4072",
"Trying to free block outside file system "
"boundaries (%lu > %lu)",
block, sb_block_count(REISERFS_SB(s)->s_rs));
@ -477,9 +472,8 @@ static void __discard_prealloc(struct reiserfs_transaction_handle *th,
BUG_ON(!th->t_trans_id);
#ifdef CONFIG_REISERFS_CHECK
if (ei->i_prealloc_count < 0)
reiserfs_warning(th->t_super,
"zam-4001:%s: inode has negative prealloc blocks count.",
__func__);
reiserfs_error(th->t_super, "zam-4001",
"inode has negative prealloc blocks count.");
#endif
while (ei->i_prealloc_count > 0) {
reiserfs_free_prealloc_block(th, inode, ei->i_prealloc_block);
@ -515,9 +509,9 @@ void reiserfs_discard_all_prealloc(struct reiserfs_transaction_handle *th)
i_prealloc_list);
#ifdef CONFIG_REISERFS_CHECK
if (!ei->i_prealloc_count) {
reiserfs_warning(th->t_super,
"zam-4001:%s: inode is in prealloc list but has no preallocated blocks.",
__func__);
reiserfs_error(th->t_super, "zam-4001",
"inode is in prealloc list but has "
"no preallocated blocks.");
}
#endif
__discard_prealloc(th, ei);
@ -631,12 +625,12 @@ int reiserfs_parse_alloc_options(struct super_block *s, char *options)
continue;
}
reiserfs_warning(s, "zam-4001: %s : unknown option - %s",
__func__, this_char);
reiserfs_warning(s, "zam-4001", "unknown option - %s",
this_char);
return 1;
}
reiserfs_warning(s, "allocator options = [%08x]\n", SB_ALLOC_OPTS(s));
reiserfs_info(s, "allocator options = [%08x]\n", SB_ALLOC_OPTS(s));
return 0;
}
@ -1221,7 +1215,9 @@ void reiserfs_cache_bitmap_metadata(struct super_block *sb,
unsigned long *cur = (unsigned long *)(bh->b_data + bh->b_size);
/* The first bit must ALWAYS be 1 */
BUG_ON(!reiserfs_test_le_bit(0, (unsigned long *)bh->b_data));
if (!reiserfs_test_le_bit(0, (unsigned long *)bh->b_data))
reiserfs_error(sb, "reiserfs-2025", "bitmap block %lu is "
"corrupted: first bit must be 1", bh->b_blocknr);
info->free_count = 0;

View File

@ -41,10 +41,10 @@ static int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry,
#define store_ih(where,what) copy_item_head (where, what)
//
static int reiserfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
int reiserfs_readdir_dentry(struct dentry *dentry, void *dirent,
filldir_t filldir, loff_t *pos)
{
struct inode *inode = filp->f_path.dentry->d_inode;
struct inode *inode = dentry->d_inode;
struct cpu_key pos_key; /* key of current position in the directory (key of directory entry) */
INITIALIZE_PATH(path_to_entry);
struct buffer_head *bh;
@ -64,13 +64,9 @@ static int reiserfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
/* form key for search the next directory entry using f_pos field of
file structure */
make_cpu_key(&pos_key, inode,
(filp->f_pos) ? (filp->f_pos) : DOT_OFFSET, TYPE_DIRENTRY,
3);
make_cpu_key(&pos_key, inode, *pos ?: DOT_OFFSET, TYPE_DIRENTRY, 3);
next_pos = cpu_key_k_offset(&pos_key);
/* reiserfs_warning (inode->i_sb, "reiserfs_readdir 1: f_pos = %Ld", filp->f_pos); */
path_to_entry.reada = PATH_READA;
while (1) {
research:
@ -144,7 +140,7 @@ static int reiserfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
/* Ignore the .reiserfs_priv entry */
if (reiserfs_xattrs(inode->i_sb) &&
!old_format_only(inode->i_sb) &&
filp->f_path.dentry == inode->i_sb->s_root &&
dentry == inode->i_sb->s_root &&
REISERFS_SB(inode->i_sb)->priv_root &&
REISERFS_SB(inode->i_sb)->priv_root->d_inode
&& deh_objectid(deh) ==
@ -156,7 +152,7 @@ static int reiserfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
}
d_off = deh_offset(deh);
filp->f_pos = d_off;
*pos = d_off;
d_ino = deh_objectid(deh);
if (d_reclen <= 32) {
local_buf = small_buf;
@ -223,15 +219,21 @@ static int reiserfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
} /* while */
end:
filp->f_pos = next_pos;
end:
*pos = next_pos;
pathrelse(&path_to_entry);
reiserfs_check_path(&path_to_entry);
out:
out:
reiserfs_write_unlock(inode->i_sb);
return ret;
}
static int reiserfs_readdir(struct file *file, void *dirent, filldir_t filldir)
{
struct dentry *dentry = file->f_path.dentry;
return reiserfs_readdir_dentry(dentry, dirent, filldir, &file->f_pos);
}
/* compose directory item containing "." and ".." entries (entries are
not aligned to 4 byte boundary) */
/* the last four params are LE */

View File

@ -29,6 +29,43 @@ struct tree_balance *cur_tb = NULL; /* detects whether more than one
is interrupting do_balance */
#endif
static inline void buffer_info_init_left(struct tree_balance *tb,
struct buffer_info *bi)
{
bi->tb = tb;
bi->bi_bh = tb->L[0];
bi->bi_parent = tb->FL[0];
bi->bi_position = get_left_neighbor_position(tb, 0);
}
static inline void buffer_info_init_right(struct tree_balance *tb,
struct buffer_info *bi)
{
bi->tb = tb;
bi->bi_bh = tb->R[0];
bi->bi_parent = tb->FR[0];
bi->bi_position = get_right_neighbor_position(tb, 0);
}
static inline void buffer_info_init_tbS0(struct tree_balance *tb,
struct buffer_info *bi)
{
bi->tb = tb;
bi->bi_bh = PATH_PLAST_BUFFER(tb->tb_path);
bi->bi_parent = PATH_H_PPARENT(tb->tb_path, 0);
bi->bi_position = PATH_H_POSITION(tb->tb_path, 1);
}
static inline void buffer_info_init_bh(struct tree_balance *tb,
struct buffer_info *bi,
struct buffer_head *bh)
{
bi->tb = tb;
bi->bi_bh = bh;
bi->bi_parent = NULL;
bi->bi_position = 0;
}
inline void do_balance_mark_leaf_dirty(struct tree_balance *tb,
struct buffer_head *bh, int flag)
{
@ -86,6 +123,7 @@ static int balance_leaf_when_delete(struct tree_balance *tb, int flag)
"PAP-12010: tree can not be empty");
ih = B_N_PITEM_HEAD(tbS0, item_pos);
buffer_info_init_tbS0(tb, &bi);
/* Delete or truncate the item */
@ -96,10 +134,6 @@ static int balance_leaf_when_delete(struct tree_balance *tb, int flag)
"vs-12013: mode Delete, insert size %d, ih to be deleted %h",
-tb->insert_size[0], ih);
bi.tb = tb;
bi.bi_bh = tbS0;
bi.bi_parent = PATH_H_PPARENT(tb->tb_path, 0);
bi.bi_position = PATH_H_POSITION(tb->tb_path, 1);
leaf_delete_items(&bi, 0, item_pos, 1, -1);
if (!item_pos && tb->CFL[0]) {
@ -121,10 +155,6 @@ static int balance_leaf_when_delete(struct tree_balance *tb, int flag)
break;
case M_CUT:{ /* cut item in S[0] */
bi.tb = tb;
bi.bi_bh = tbS0;
bi.bi_parent = PATH_H_PPARENT(tb->tb_path, 0);
bi.bi_position = PATH_H_POSITION(tb->tb_path, 1);
if (is_direntry_le_ih(ih)) {
/* UFS unlink semantics are such that you can only delete one directory entry at a time. */
@ -153,8 +183,8 @@ static int balance_leaf_when_delete(struct tree_balance *tb, int flag)
default:
print_cur_tb("12040");
reiserfs_panic(tb->tb_sb,
"PAP-12040: balance_leaf_when_delete: unexpectable mode: %s(%d)",
reiserfs_panic(tb->tb_sb, "PAP-12040",
"unexpected mode: %s(%d)",
(flag ==
M_PASTE) ? "PASTE" : ((flag ==
M_INSERT) ? "INSERT" :
@ -325,11 +355,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
ih_item_len(ih));
/* Insert new item into L[0] */
bi.tb = tb;
bi.bi_bh = tb->L[0];
bi.bi_parent = tb->FL[0];
bi.bi_position =
get_left_neighbor_position(tb, 0);
buffer_info_init_left(tb, &bi);
leaf_insert_into_buf(&bi,
n + item_pos -
ret_val, ih, body,
@ -369,11 +395,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
leaf_shift_left(tb, tb->lnum[0] - 1,
tb->lbytes);
/* Insert new item into L[0] */
bi.tb = tb;
bi.bi_bh = tb->L[0];
bi.bi_parent = tb->FL[0];
bi.bi_position =
get_left_neighbor_position(tb, 0);
buffer_info_init_left(tb, &bi);
leaf_insert_into_buf(&bi,
n + item_pos -
ret_val, ih, body,
@ -429,13 +451,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
}
/* Append given directory entry to directory item */
bi.tb = tb;
bi.bi_bh = tb->L[0];
bi.bi_parent =
tb->FL[0];
bi.bi_position =
get_left_neighbor_position
(tb, 0);
buffer_info_init_left(tb, &bi);
leaf_paste_in_buffer
(&bi,
n + item_pos -
@ -449,8 +465,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
/* when we have merge directory item, pos_in_item has been changed too */
/* paste new directory entry. 1 is entry number */
leaf_paste_entries(bi.
bi_bh,
leaf_paste_entries(&bi,
n +
item_pos
-
@ -524,13 +539,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
(tbS0,
item_pos)));
/* Append to body of item in L[0] */
bi.tb = tb;
bi.bi_bh = tb->L[0];
bi.bi_parent =
tb->FL[0];
bi.bi_position =
get_left_neighbor_position
(tb, 0);
buffer_info_init_left(tb, &bi);
leaf_paste_in_buffer
(&bi,
n + item_pos -
@ -681,11 +690,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
leaf_shift_left(tb, tb->lnum[0],
tb->lbytes);
/* Append to body of item in L[0] */
bi.tb = tb;
bi.bi_bh = tb->L[0];
bi.bi_parent = tb->FL[0];
bi.bi_position =
get_left_neighbor_position(tb, 0);
buffer_info_init_left(tb, &bi);
leaf_paste_in_buffer(&bi,
n + item_pos -
ret_val,
@ -699,7 +704,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
n + item_pos -
ret_val);
if (is_direntry_le_ih(pasted))
leaf_paste_entries(bi.bi_bh,
leaf_paste_entries(&bi,
n +
item_pos -
ret_val,
@ -722,8 +727,9 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
}
break;
default: /* cases d and t */
reiserfs_panic(tb->tb_sb,
"PAP-12130: balance_leaf: lnum > 0: unexpectable mode: %s(%d)",
reiserfs_panic(tb->tb_sb, "PAP-12130",
"lnum > 0: unexpected mode: "
" %s(%d)",
(flag ==
M_DELETE) ? "DELETE" : ((flag ==
M_CUT)
@ -776,11 +782,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
set_le_ih_k_offset(ih, offset);
put_ih_item_len(ih, tb->rbytes);
/* Insert part of the item into R[0] */
bi.tb = tb;
bi.bi_bh = tb->R[0];
bi.bi_parent = tb->FR[0];
bi.bi_position =
get_right_neighbor_position(tb, 0);
buffer_info_init_right(tb, &bi);
if ((old_len - tb->rbytes) > zeros_num) {
r_zeros_number = 0;
r_body =
@ -817,11 +819,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
tb->rnum[0] - 1,
tb->rbytes);
/* Insert new item into R[0] */
bi.tb = tb;
bi.bi_bh = tb->R[0];
bi.bi_parent = tb->FR[0];
bi.bi_position =
get_right_neighbor_position(tb, 0);
buffer_info_init_right(tb, &bi);
leaf_insert_into_buf(&bi,
item_pos - n +
tb->rnum[0] - 1,
@ -881,21 +879,14 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
pos_in_item -
entry_count +
tb->rbytes - 1;
bi.tb = tb;
bi.bi_bh = tb->R[0];
bi.bi_parent =
tb->FR[0];
bi.bi_position =
get_right_neighbor_position
(tb, 0);
buffer_info_init_right(tb, &bi);
leaf_paste_in_buffer
(&bi, 0,
paste_entry_position,
tb->insert_size[0],
body, zeros_num);
/* paste entry */
leaf_paste_entries(bi.
bi_bh,
leaf_paste_entries(&bi,
0,
paste_entry_position,
1,
@ -1019,12 +1010,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
(tb, tb->CFR[0], 0);
/* Append part of body into R[0] */
bi.tb = tb;
bi.bi_bh = tb->R[0];
bi.bi_parent = tb->FR[0];
bi.bi_position =
get_right_neighbor_position
(tb, 0);
buffer_info_init_right(tb, &bi);
if (n_rem > zeros_num) {
r_zeros_number = 0;
r_body =
@ -1071,12 +1057,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
tb->rbytes);
/* append item in R[0] */
if (pos_in_item >= 0) {
bi.tb = tb;
bi.bi_bh = tb->R[0];
bi.bi_parent = tb->FR[0];
bi.bi_position =
get_right_neighbor_position
(tb, 0);
buffer_info_init_right(tb, &bi);
leaf_paste_in_buffer(&bi,
item_pos -
n +
@ -1096,7 +1077,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
tb->rnum[0]);
if (is_direntry_le_ih(pasted)
&& pos_in_item >= 0) {
leaf_paste_entries(bi.bi_bh,
leaf_paste_entries(&bi,
item_pos -
n +
tb->rnum[0],
@ -1136,8 +1117,8 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
}
break;
default: /* cases d and t */
reiserfs_panic(tb->tb_sb,
"PAP-12175: balance_leaf: rnum > 0: unexpectable mode: %s(%d)",
reiserfs_panic(tb->tb_sb, "PAP-12175",
"rnum > 0: unexpected mode: %s(%d)",
(flag ==
M_DELETE) ? "DELETE" : ((flag ==
M_CUT) ? "CUT"
@ -1167,8 +1148,8 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
not set correctly */
if (tb->CFL[0]) {
if (!tb->CFR[0])
reiserfs_panic(tb->tb_sb,
"vs-12195: balance_leaf: CFR not initialized");
reiserfs_panic(tb->tb_sb, "vs-12195",
"CFR not initialized");
copy_key(B_N_PDELIM_KEY(tb->CFL[0], tb->lkey[0]),
B_N_PDELIM_KEY(tb->CFR[0], tb->rkey[0]));
do_balance_mark_internal_dirty(tb, tb->CFL[0], 0);
@ -1232,10 +1213,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
put_ih_item_len(ih, sbytes[i]);
/* Insert part of the item into S_new[i] before 0-th item */
bi.tb = tb;
bi.bi_bh = S_new[i];
bi.bi_parent = NULL;
bi.bi_position = 0;
buffer_info_init_bh(tb, &bi, S_new[i]);
if ((old_len - sbytes[i]) > zeros_num) {
r_zeros_number = 0;
@ -1267,10 +1245,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
S_new[i]);
/* Insert new item into S_new[i] */
bi.tb = tb;
bi.bi_bh = S_new[i];
bi.bi_parent = NULL;
bi.bi_position = 0;
buffer_info_init_bh(tb, &bi, S_new[i]);
leaf_insert_into_buf(&bi,
item_pos - n +
snum[i] - 1, ih,
@ -1327,10 +1302,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
sbytes[i] - 1,
S_new[i]);
/* Paste given directory entry to directory item */
bi.tb = tb;
bi.bi_bh = S_new[i];
bi.bi_parent = NULL;
bi.bi_position = 0;
buffer_info_init_bh(tb, &bi, S_new[i]);
leaf_paste_in_buffer
(&bi, 0,
pos_in_item -
@ -1339,8 +1311,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
tb->insert_size[0],
body, zeros_num);
/* paste new directory entry */
leaf_paste_entries(bi.
bi_bh,
leaf_paste_entries(&bi,
0,
pos_in_item
-
@ -1401,11 +1372,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
if (n_rem < 0)
n_rem = 0;
/* Append part of body into S_new[0] */
bi.tb = tb;
bi.bi_bh = S_new[i];
bi.bi_parent = NULL;
bi.bi_position = 0;
buffer_info_init_bh(tb, &bi, S_new[i]);
if (n_rem > zeros_num) {
r_zeros_number = 0;
r_body =
@ -1475,7 +1442,10 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
&& (pos_in_item != ih_item_len(ih_check)
|| tb->insert_size[0] <= 0))
reiserfs_panic(tb->tb_sb,
"PAP-12235: balance_leaf: pos_in_item must be equal to ih_item_len");
"PAP-12235",
"pos_in_item "
"must be equal "
"to ih_item_len");
#endif /* CONFIG_REISERFS_CHECK */
leaf_mi =
@ -1489,10 +1459,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
leaf_mi);
/* paste into item */
bi.tb = tb;
bi.bi_bh = S_new[i];
bi.bi_parent = NULL;
bi.bi_position = 0;
buffer_info_init_bh(tb, &bi, S_new[i]);
leaf_paste_in_buffer(&bi,
item_pos - n +
snum[i],
@ -1505,7 +1472,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
item_pos - n +
snum[i]);
if (is_direntry_le_ih(pasted)) {
leaf_paste_entries(bi.bi_bh,
leaf_paste_entries(&bi,
item_pos -
n + snum[i],
pos_in_item,
@ -1535,8 +1502,8 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
}
break;
default: /* cases d and t */
reiserfs_panic(tb->tb_sb,
"PAP-12245: balance_leaf: blknum > 2: unexpectable mode: %s(%d)",
reiserfs_panic(tb->tb_sb, "PAP-12245",
"blknum > 2: unexpected mode: %s(%d)",
(flag ==
M_DELETE) ? "DELETE" : ((flag ==
M_CUT) ? "CUT"
@ -1559,10 +1526,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
switch (flag) {
case M_INSERT: /* insert item into S[0] */
bi.tb = tb;
bi.bi_bh = tbS0;
bi.bi_parent = PATH_H_PPARENT(tb->tb_path, 0);
bi.bi_position = PATH_H_POSITION(tb->tb_path, 1);
buffer_info_init_tbS0(tb, &bi);
leaf_insert_into_buf(&bi, item_pos, ih, body,
zeros_num);
@ -1589,14 +1553,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
"PAP-12260: insert_size is 0 already");
/* prepare space */
bi.tb = tb;
bi.bi_bh = tbS0;
bi.bi_parent =
PATH_H_PPARENT(tb->tb_path,
0);
bi.bi_position =
PATH_H_POSITION(tb->tb_path,
1);
buffer_info_init_tbS0(tb, &bi);
leaf_paste_in_buffer(&bi,
item_pos,
pos_in_item,
@ -1606,7 +1563,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
zeros_num);
/* paste entry */
leaf_paste_entries(bi.bi_bh,
leaf_paste_entries(&bi,
item_pos,
pos_in_item,
1,
@ -1644,14 +1601,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
RFALSE(tb->insert_size[0] <= 0,
"PAP-12275: insert size must not be %d",
tb->insert_size[0]);
bi.tb = tb;
bi.bi_bh = tbS0;
bi.bi_parent =
PATH_H_PPARENT(tb->tb_path,
0);
bi.bi_position =
PATH_H_POSITION(tb->tb_path,
1);
buffer_info_init_tbS0(tb, &bi);
leaf_paste_in_buffer(&bi,
item_pos,
pos_in_item,
@ -1681,10 +1631,11 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
print_cur_tb("12285");
reiserfs_panic(tb->
tb_sb,
"PAP-12285: balance_leaf: insert_size must be 0 (%d)",
tb->
insert_size
[0]);
"PAP-12285",
"insert_size "
"must be 0 "
"(%d)",
tb->insert_size[0]);
}
}
#endif /* CONFIG_REISERFS_CHECK */
@ -1697,11 +1648,10 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
if (flag == M_PASTE && tb->insert_size[0]) {
print_cur_tb("12290");
reiserfs_panic(tb->tb_sb,
"PAP-12290: balance_leaf: insert_size is still not 0 (%d)",
"PAP-12290", "insert_size is still not 0 (%d)",
tb->insert_size[0]);
}
#endif /* CONFIG_REISERFS_CHECK */
return 0;
} /* Leaf level of the tree is balanced (end of balance_leaf) */
@ -1724,7 +1674,6 @@ void make_empty_node(struct buffer_info *bi)
struct buffer_head *get_FEB(struct tree_balance *tb)
{
int i;
struct buffer_head *first_b;
struct buffer_info bi;
for (i = 0; i < MAX_FEB_SIZE; i++)
@ -1732,19 +1681,15 @@ struct buffer_head *get_FEB(struct tree_balance *tb)
break;
if (i == MAX_FEB_SIZE)
reiserfs_panic(tb->tb_sb,
"vs-12300: get_FEB: FEB list is empty");
reiserfs_panic(tb->tb_sb, "vs-12300", "FEB list is empty");
bi.tb = tb;
bi.bi_bh = first_b = tb->FEB[i];
bi.bi_parent = NULL;
bi.bi_position = 0;
buffer_info_init_bh(tb, &bi, tb->FEB[i]);
make_empty_node(&bi);
set_buffer_uptodate(first_b);
set_buffer_uptodate(tb->FEB[i]);
tb->used[i] = tb->FEB[i];
tb->FEB[i] = NULL;
tb->used[i] = first_b;
return (first_b);
return tb->used[i];
}
/* This is now used because reiserfs_free_block has to be able to
@ -1755,15 +1700,16 @@ static void store_thrown(struct tree_balance *tb, struct buffer_head *bh)
int i;
if (buffer_dirty(bh))
reiserfs_warning(tb->tb_sb,
"store_thrown deals with dirty buffer");
reiserfs_warning(tb->tb_sb, "reiserfs-12320",
"called with dirty buffer");
for (i = 0; i < ARRAY_SIZE(tb->thrown); i++)
if (!tb->thrown[i]) {
tb->thrown[i] = bh;
get_bh(bh); /* free_thrown puts this */
return;
}
reiserfs_warning(tb->tb_sb, "store_thrown: too many thrown buffers");
reiserfs_warning(tb->tb_sb, "reiserfs-12321",
"too many thrown buffers");
}
static void free_thrown(struct tree_balance *tb)
@ -1774,8 +1720,8 @@ static void free_thrown(struct tree_balance *tb)
if (tb->thrown[i]) {
blocknr = tb->thrown[i]->b_blocknr;
if (buffer_dirty(tb->thrown[i]))
reiserfs_warning(tb->tb_sb,
"free_thrown deals with dirty buffer %d",
reiserfs_warning(tb->tb_sb, "reiserfs-12322",
"called with dirty buffer %d",
blocknr);
brelse(tb->thrown[i]); /* incremented in store_thrown */
reiserfs_free_block(tb->transaction_handle, NULL,
@ -1873,20 +1819,19 @@ static void check_internal_node(struct super_block *s, struct buffer_head *bh,
for (i = 0; i <= B_NR_ITEMS(bh); i++, dc++) {
if (!is_reusable(s, dc_block_number(dc), 1)) {
print_cur_tb(mes);
reiserfs_panic(s,
"PAP-12338: check_internal_node: invalid child pointer %y in %b",
reiserfs_panic(s, "PAP-12338",
"invalid child pointer %y in %b",
dc, bh);
}
}
}
static int locked_or_not_in_tree(struct buffer_head *bh, char *which)
static int locked_or_not_in_tree(struct tree_balance *tb,
struct buffer_head *bh, char *which)
{
if ((!buffer_journal_prepared(bh) && buffer_locked(bh)) ||
!B_IS_IN_TREE(bh)) {
reiserfs_warning(NULL,
"vs-12339: locked_or_not_in_tree: %s (%b)",
which, bh);
reiserfs_warning(tb->tb_sb, "vs-12339", "%s (%b)", which, bh);
return 1;
}
return 0;
@ -1897,26 +1842,28 @@ static int check_before_balancing(struct tree_balance *tb)
int retval = 0;
if (cur_tb) {
reiserfs_panic(tb->tb_sb, "vs-12335: check_before_balancing: "
"suspect that schedule occurred based on cur_tb not being null at this point in code. "
"do_balance cannot properly handle schedule occurring while it runs.");
reiserfs_panic(tb->tb_sb, "vs-12335", "suspect that schedule "
"occurred based on cur_tb not being null at "
"this point in code. do_balance cannot properly "
"handle schedule occurring while it runs.");
}
/* double check that buffers that we will modify are unlocked. (fix_nodes should already have
prepped all of these for us). */
if (tb->lnum[0]) {
retval |= locked_or_not_in_tree(tb->L[0], "L[0]");
retval |= locked_or_not_in_tree(tb->FL[0], "FL[0]");
retval |= locked_or_not_in_tree(tb->CFL[0], "CFL[0]");
retval |= locked_or_not_in_tree(tb, tb->L[0], "L[0]");
retval |= locked_or_not_in_tree(tb, tb->FL[0], "FL[0]");
retval |= locked_or_not_in_tree(tb, tb->CFL[0], "CFL[0]");
check_leaf(tb->L[0]);
}
if (tb->rnum[0]) {
retval |= locked_or_not_in_tree(tb->R[0], "R[0]");
retval |= locked_or_not_in_tree(tb->FR[0], "FR[0]");
retval |= locked_or_not_in_tree(tb->CFR[0], "CFR[0]");
retval |= locked_or_not_in_tree(tb, tb->R[0], "R[0]");
retval |= locked_or_not_in_tree(tb, tb->FR[0], "FR[0]");
retval |= locked_or_not_in_tree(tb, tb->CFR[0], "CFR[0]");
check_leaf(tb->R[0]);
}
retval |= locked_or_not_in_tree(PATH_PLAST_BUFFER(tb->tb_path), "S[0]");
retval |= locked_or_not_in_tree(tb, PATH_PLAST_BUFFER(tb->tb_path),
"S[0]");
check_leaf(PATH_PLAST_BUFFER(tb->tb_path));
return retval;
@ -1930,8 +1877,8 @@ static void check_after_balance_leaf(struct tree_balance *tb)
dc_size(B_N_CHILD
(tb->FL[0], get_left_neighbor_position(tb, 0)))) {
print_cur_tb("12221");
reiserfs_panic(tb->tb_sb,
"PAP-12355: check_after_balance_leaf: shift to left was incorrect");
reiserfs_panic(tb->tb_sb, "PAP-12355",
"shift to left was incorrect");
}
}
if (tb->rnum[0]) {
@ -1940,8 +1887,8 @@ static void check_after_balance_leaf(struct tree_balance *tb)
dc_size(B_N_CHILD
(tb->FR[0], get_right_neighbor_position(tb, 0)))) {
print_cur_tb("12222");
reiserfs_panic(tb->tb_sb,
"PAP-12360: check_after_balance_leaf: shift to right was incorrect");
reiserfs_panic(tb->tb_sb, "PAP-12360",
"shift to right was incorrect");
}
}
if (PATH_H_PBUFFER(tb->tb_path, 1) &&
@ -1955,7 +1902,7 @@ static void check_after_balance_leaf(struct tree_balance *tb)
PATH_H_POSITION(tb->tb_path,
1))));
print_cur_tb("12223");
reiserfs_warning(tb->tb_sb,
reiserfs_warning(tb->tb_sb, "reiserfs-12363",
"B_FREE_SPACE (PATH_H_PBUFFER(tb->tb_path,0)) = %d; "
"MAX_CHILD_SIZE (%d) - dc_size( %y, %d ) [%d] = %d",
left,
@ -1966,8 +1913,7 @@ static void check_after_balance_leaf(struct tree_balance *tb)
(PATH_H_PBUFFER(tb->tb_path, 1),
PATH_H_POSITION(tb->tb_path, 1))),
right);
reiserfs_panic(tb->tb_sb,
"PAP-12365: check_after_balance_leaf: S is incorrect");
reiserfs_panic(tb->tb_sb, "PAP-12365", "S is incorrect");
}
}
@ -2102,14 +2048,13 @@ void do_balance(struct tree_balance *tb, /* tree_balance structure */
tb->need_balance_dirty = 0;
if (FILESYSTEM_CHANGED_TB(tb)) {
reiserfs_panic(tb->tb_sb,
"clm-6000: do_balance, fs generation has changed\n");
reiserfs_panic(tb->tb_sb, "clm-6000", "fs generation has "
"changed");
}
/* if we have no real work to do */
if (!tb->insert_size[0]) {
reiserfs_warning(tb->tb_sb,
"PAP-12350: do_balance: insert_size == 0, mode == %c",
flag);
reiserfs_warning(tb->tb_sb, "PAP-12350",
"insert_size == 0, mode == %c", flag);
unfix_nodes(tb);
return;
}

View File

@ -76,7 +76,7 @@ static int reiserfs_file_release(struct inode *inode, struct file *filp)
* and let the admin know what is going on.
*/
igrab(inode);
reiserfs_warning(inode->i_sb,
reiserfs_warning(inode->i_sb, "clm-9001",
"pinning inode %lu because the "
"preallocation can't be freed",
inode->i_ino);
@ -134,23 +134,23 @@ static void reiserfs_vfs_truncate_file(struct inode *inode)
* be removed...
*/
static int reiserfs_sync_file(struct file *p_s_filp,
struct dentry *p_s_dentry, int datasync)
static int reiserfs_sync_file(struct file *filp,
struct dentry *dentry, int datasync)
{
struct inode *p_s_inode = p_s_dentry->d_inode;
int n_err;
struct inode *inode = dentry->d_inode;
int err;
int barrier_done;
BUG_ON(!S_ISREG(p_s_inode->i_mode));
n_err = sync_mapping_buffers(p_s_inode->i_mapping);
reiserfs_write_lock(p_s_inode->i_sb);
barrier_done = reiserfs_commit_for_inode(p_s_inode);
reiserfs_write_unlock(p_s_inode->i_sb);
if (barrier_done != 1 && reiserfs_barrier_flush(p_s_inode->i_sb))
blkdev_issue_flush(p_s_inode->i_sb->s_bdev, NULL);
BUG_ON(!S_ISREG(inode->i_mode));
err = sync_mapping_buffers(inode->i_mapping);
reiserfs_write_lock(inode->i_sb);
barrier_done = reiserfs_commit_for_inode(inode);
reiserfs_write_unlock(inode->i_sb);
if (barrier_done != 1 && reiserfs_barrier_flush(inode->i_sb))
blkdev_issue_flush(inode->i_sb->s_bdev, NULL);
if (barrier_done < 0)
return barrier_done;
return (n_err < 0) ? -EIO : 0;
return (err < 0) ? -EIO : 0;
}
/* taken fs/buffer.c:__block_commit_write */

File diff suppressed because it is too large Load Diff

View File

@ -105,8 +105,8 @@ static void internal_define_dest_src_infos(int shift_mode,
break;
default:
reiserfs_panic(tb->tb_sb,
"internal_define_dest_src_infos: shift type is unknown (%d)",
reiserfs_panic(tb->tb_sb, "ibalance-1",
"shift type is unknown (%d)",
shift_mode);
}
}
@ -702,8 +702,8 @@ static void balance_internal_when_delete(struct tree_balance *tb,
return;
}
reiserfs_panic(tb->tb_sb,
"balance_internal_when_delete: unexpected tb->lnum[%d]==%d or tb->rnum[%d]==%d",
reiserfs_panic(tb->tb_sb, "ibalance-2",
"unexpected tb->lnum[%d]==%d or tb->rnum[%d]==%d",
h, tb->lnum[h], h, tb->rnum[h]);
}
@ -940,8 +940,8 @@ int balance_internal(struct tree_balance *tb, /* tree_balance structure
struct block_head *blkh;
if (tb->blknum[h] != 1)
reiserfs_panic(NULL,
"balance_internal: One new node required for creating the new root");
reiserfs_panic(NULL, "ibalance-3", "One new node "
"required for creating the new root");
/* S[h] = empty buffer from the list FEB. */
tbSh = get_FEB(tb);
blkh = B_BLK_HEAD(tbSh);

View File

@ -841,10 +841,12 @@ int reiserfs_get_block(struct inode *inode, sector_t block,
tail_offset);
if (retval) {
if (retval != -ENOSPC)
reiserfs_warning(inode->i_sb,
"clm-6004: convert tail failed inode %lu, error %d",
inode->i_ino,
retval);
reiserfs_error(inode->i_sb,
"clm-6004",
"convert tail failed "
"inode %lu, error %d",
inode->i_ino,
retval);
if (allocated_block_nr) {
/* the bitmap, the super, and the stat data == 3 */
if (!th)
@ -1006,8 +1008,7 @@ int reiserfs_get_block(struct inode *inode, sector_t block,
goto failure;
}
if (retval == POSITION_FOUND) {
reiserfs_warning(inode->i_sb,
"vs-825: reiserfs_get_block: "
reiserfs_warning(inode->i_sb, "vs-825",
"%K should not be found", &key);
retval = -EEXIST;
if (allocated_block_nr)
@ -1299,8 +1300,7 @@ static void update_stat_data(struct treepath *path, struct inode *inode,
ih = PATH_PITEM_HEAD(path);
if (!is_statdata_le_ih(ih))
reiserfs_panic(inode->i_sb,
"vs-13065: update_stat_data: key %k, found item %h",
reiserfs_panic(inode->i_sb, "vs-13065", "key %k, found item %h",
INODE_PKEY(inode), ih);
if (stat_data_v1(ih)) {
@ -1332,10 +1332,9 @@ void reiserfs_update_sd_size(struct reiserfs_transaction_handle *th,
/* look for the object's stat data */
retval = search_item(inode->i_sb, &key, &path);
if (retval == IO_ERROR) {
reiserfs_warning(inode->i_sb,
"vs-13050: reiserfs_update_sd: "
"i/o failure occurred trying to update %K stat data",
&key);
reiserfs_error(inode->i_sb, "vs-13050",
"i/o failure occurred trying to "
"update %K stat data", &key);
return;
}
if (retval == ITEM_NOT_FOUND) {
@ -1345,9 +1344,9 @@ void reiserfs_update_sd_size(struct reiserfs_transaction_handle *th,
/*reiserfs_warning (inode->i_sb, "vs-13050: reiserfs_update_sd: i_nlink == 0, stat data not found"); */
return;
}
reiserfs_warning(inode->i_sb,
"vs-13060: reiserfs_update_sd: "
"stat data of object %k (nlink == %d) not found (pos %d)",
reiserfs_warning(inode->i_sb, "vs-13060",
"stat data of object %k (nlink == %d) "
"not found (pos %d)",
INODE_PKEY(inode), inode->i_nlink,
pos);
reiserfs_check_path(&path);
@ -1424,10 +1423,9 @@ void reiserfs_read_locked_inode(struct inode *inode,
/* look for the object's stat data */
retval = search_item(inode->i_sb, &key, &path_to_sd);
if (retval == IO_ERROR) {
reiserfs_warning(inode->i_sb,
"vs-13070: reiserfs_read_locked_inode: "
"i/o failure occurred trying to find stat data of %K",
&key);
reiserfs_error(inode->i_sb, "vs-13070",
"i/o failure occurred trying to find "
"stat data of %K", &key);
reiserfs_make_bad_inode(inode);
return;
}
@ -1457,8 +1455,7 @@ void reiserfs_read_locked_inode(struct inode *inode,
during mount (fs/reiserfs/super.c:finish_unfinished()). */
if ((inode->i_nlink == 0) &&
!REISERFS_SB(inode->i_sb)->s_is_unlinked_ok) {
reiserfs_warning(inode->i_sb,
"vs-13075: reiserfs_read_locked_inode: "
reiserfs_warning(inode->i_sb, "vs-13075",
"dead inode read from disk %K. "
"This is likely to be race with knfsd. Ignore",
&key);
@ -1555,7 +1552,7 @@ struct dentry *reiserfs_fh_to_dentry(struct super_block *sb, struct fid *fid,
*/
if (fh_type > fh_len) {
if (fh_type != 6 || fh_len != 5)
reiserfs_warning(sb,
reiserfs_warning(sb, "reiserfs-13077",
"nfsd/reiserfs, fhtype=%d, len=%d - odd",
fh_type, fh_len);
fh_type = 5;
@ -1680,13 +1677,13 @@ static int reiserfs_new_directory(struct reiserfs_transaction_handle *th,
/* look for place in the tree for new item */
retval = search_item(sb, &key, path);
if (retval == IO_ERROR) {
reiserfs_warning(sb, "vs-13080: reiserfs_new_directory: "
"i/o failure occurred creating new directory");
reiserfs_error(sb, "vs-13080",
"i/o failure occurred creating new directory");
return -EIO;
}
if (retval == ITEM_FOUND) {
pathrelse(path);
reiserfs_warning(sb, "vs-13070: reiserfs_new_directory: "
reiserfs_warning(sb, "vs-13070",
"object with this key exists (%k)",
&(ih->ih_key));
return -EEXIST;
@ -1720,13 +1717,13 @@ static int reiserfs_new_symlink(struct reiserfs_transaction_handle *th, struct i
/* look for place in the tree for new item */
retval = search_item(sb, &key, path);
if (retval == IO_ERROR) {
reiserfs_warning(sb, "vs-13080: reiserfs_new_symlinik: "
"i/o failure occurred creating new symlink");
reiserfs_error(sb, "vs-13080",
"i/o failure occurred creating new symlink");
return -EIO;
}
if (retval == ITEM_FOUND) {
pathrelse(path);
reiserfs_warning(sb, "vs-13080: reiserfs_new_symlink: "
reiserfs_warning(sb, "vs-13080",
"object with this key exists (%k)",
&(ih->ih_key));
return -EEXIST;
@ -1750,7 +1747,8 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
/* 0 for regular, EMTRY_DIR_SIZE for dirs,
strlen (symname) for symlinks) */
loff_t i_size, struct dentry *dentry,
struct inode *inode)
struct inode *inode,
struct reiserfs_security_handle *security)
{
struct super_block *sb;
struct reiserfs_iget_args args;
@ -1917,9 +1915,8 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
goto out_inserted_sd;
}
/* XXX CHECK THIS */
if (reiserfs_posixacl(inode->i_sb)) {
retval = reiserfs_inherit_default_acl(dir, dentry, inode);
retval = reiserfs_inherit_default_acl(th, dir, dentry, inode);
if (retval) {
err = retval;
reiserfs_check_path(&path_to_key);
@ -1927,10 +1924,23 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
goto out_inserted_sd;
}
} else if (inode->i_sb->s_flags & MS_POSIXACL) {
reiserfs_warning(inode->i_sb, "ACLs aren't enabled in the fs, "
reiserfs_warning(inode->i_sb, "jdm-13090",
"ACLs aren't enabled in the fs, "
"but vfs thinks they are!");
} else if (is_reiserfs_priv_object(dir)) {
reiserfs_mark_inode_private(inode);
} else if (IS_PRIVATE(dir))
inode->i_flags |= S_PRIVATE;
if (security->name) {
retval = reiserfs_security_write(th, inode, security);
if (retval) {
err = retval;
reiserfs_check_path(&path_to_key);
retval = journal_end(th, th->t_super,
th->t_blocks_allocated);
if (retval)
err = retval;
goto out_inserted_sd;
}
}
reiserfs_update_sd(th, inode);
@ -1960,19 +1970,7 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
inode->i_nlink = 0;
th->t_trans_id = 0; /* so the caller can't use this handle later */
unlock_new_inode(inode); /* OK to do even if we hadn't locked it */
/* If we were inheriting an ACL, we need to release the lock so that
* iput doesn't deadlock in reiserfs_delete_xattrs. The locking
* code really needs to be reworked, but this will take care of it
* for now. -jeffm */
#ifdef CONFIG_REISERFS_FS_POSIX_ACL
if (REISERFS_I(dir)->i_acl_default && !IS_ERR(REISERFS_I(dir)->i_acl_default)) {
reiserfs_write_unlock_xattrs(dir->i_sb);
iput(inode);
reiserfs_write_lock_xattrs(dir->i_sb);
} else
#endif
iput(inode);
iput(inode);
return err;
}
@ -1989,7 +1987,7 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
**
** on failure, nonzero is returned, page_result and bh_result are untouched.
*/
static int grab_tail_page(struct inode *p_s_inode,
static int grab_tail_page(struct inode *inode,
struct page **page_result,
struct buffer_head **bh_result)
{
@ -1997,11 +1995,11 @@ static int grab_tail_page(struct inode *p_s_inode,
/* we want the page with the last byte in the file,
** not the page that will hold the next byte for appending
*/
unsigned long index = (p_s_inode->i_size - 1) >> PAGE_CACHE_SHIFT;
unsigned long index = (inode->i_size - 1) >> PAGE_CACHE_SHIFT;
unsigned long pos = 0;
unsigned long start = 0;
unsigned long blocksize = p_s_inode->i_sb->s_blocksize;
unsigned long offset = (p_s_inode->i_size) & (PAGE_CACHE_SIZE - 1);
unsigned long blocksize = inode->i_sb->s_blocksize;
unsigned long offset = (inode->i_size) & (PAGE_CACHE_SIZE - 1);
struct buffer_head *bh;
struct buffer_head *head;
struct page *page;
@ -2015,7 +2013,7 @@ static int grab_tail_page(struct inode *p_s_inode,
if ((offset & (blocksize - 1)) == 0) {
return -ENOENT;
}
page = grab_cache_page(p_s_inode->i_mapping, index);
page = grab_cache_page(inode->i_mapping, index);
error = -ENOMEM;
if (!page) {
goto out;
@ -2044,10 +2042,8 @@ static int grab_tail_page(struct inode *p_s_inode,
** I've screwed up the code to find the buffer, or the code to
** call prepare_write
*/
reiserfs_warning(p_s_inode->i_sb,
"clm-6000: error reading block %lu on dev %s",
bh->b_blocknr,
reiserfs_bdevname(p_s_inode->i_sb));
reiserfs_error(inode->i_sb, "clm-6000",
"error reading block %lu", bh->b_blocknr);
error = -EIO;
goto unlock;
}
@ -2069,29 +2065,30 @@ static int grab_tail_page(struct inode *p_s_inode,
**
** some code taken from block_truncate_page
*/
int reiserfs_truncate_file(struct inode *p_s_inode, int update_timestamps)
int reiserfs_truncate_file(struct inode *inode, int update_timestamps)
{
struct reiserfs_transaction_handle th;
/* we want the offset for the first byte after the end of the file */
unsigned long offset = p_s_inode->i_size & (PAGE_CACHE_SIZE - 1);
unsigned blocksize = p_s_inode->i_sb->s_blocksize;
unsigned long offset = inode->i_size & (PAGE_CACHE_SIZE - 1);
unsigned blocksize = inode->i_sb->s_blocksize;
unsigned length;
struct page *page = NULL;
int error;
struct buffer_head *bh = NULL;
int err2;
reiserfs_write_lock(p_s_inode->i_sb);
reiserfs_write_lock(inode->i_sb);
if (p_s_inode->i_size > 0) {
if ((error = grab_tail_page(p_s_inode, &page, &bh))) {
if (inode->i_size > 0) {
error = grab_tail_page(inode, &page, &bh);
if (error) {
// -ENOENT means we truncated past the end of the file,
// and get_block_create_0 could not find a block to read in,
// which is ok.
if (error != -ENOENT)
reiserfs_warning(p_s_inode->i_sb,
"clm-6001: grab_tail_page failed %d",
error);
reiserfs_error(inode->i_sb, "clm-6001",
"grab_tail_page failed %d",
error);
page = NULL;
bh = NULL;
}
@ -2107,19 +2104,19 @@ int reiserfs_truncate_file(struct inode *p_s_inode, int update_timestamps)
/* it is enough to reserve space in transaction for 2 balancings:
one for "save" link adding and another for the first
cut_from_item. 1 is for update_sd */
error = journal_begin(&th, p_s_inode->i_sb,
error = journal_begin(&th, inode->i_sb,
JOURNAL_PER_BALANCE_CNT * 2 + 1);
if (error)
goto out;
reiserfs_update_inode_transaction(p_s_inode);
reiserfs_update_inode_transaction(inode);
if (update_timestamps)
/* we are doing real truncate: if the system crashes before the last
transaction of truncating gets committed - on reboot the file
either appears truncated properly or not truncated at all */
add_save_link(&th, p_s_inode, 1);
err2 = reiserfs_do_truncate(&th, p_s_inode, page, update_timestamps);
add_save_link(&th, inode, 1);
err2 = reiserfs_do_truncate(&th, inode, page, update_timestamps);
error =
journal_end(&th, p_s_inode->i_sb, JOURNAL_PER_BALANCE_CNT * 2 + 1);
journal_end(&th, inode->i_sb, JOURNAL_PER_BALANCE_CNT * 2 + 1);
if (error)
goto out;
@ -2130,7 +2127,7 @@ int reiserfs_truncate_file(struct inode *p_s_inode, int update_timestamps)
}
if (update_timestamps) {
error = remove_save_link(p_s_inode, 1 /* truncate */ );
error = remove_save_link(inode, 1 /* truncate */);
if (error)
goto out;
}
@ -2149,14 +2146,14 @@ int reiserfs_truncate_file(struct inode *p_s_inode, int update_timestamps)
page_cache_release(page);
}
reiserfs_write_unlock(p_s_inode->i_sb);
reiserfs_write_unlock(inode->i_sb);
return 0;
out:
if (page) {
unlock_page(page);
page_cache_release(page);
}
reiserfs_write_unlock(p_s_inode->i_sb);
reiserfs_write_unlock(inode->i_sb);
return error;
}
@ -2208,9 +2205,8 @@ static int map_block_for_writepage(struct inode *inode,
/* we've found an unformatted node */
if (indirect_item_found(retval, ih)) {
if (bytes_copied > 0) {
reiserfs_warning(inode->i_sb,
"clm-6002: bytes_copied %d",
bytes_copied);
reiserfs_warning(inode->i_sb, "clm-6002",
"bytes_copied %d", bytes_copied);
}
if (!get_block_num(item, pos_in_item)) {
/* crap, we are writing to a hole */
@ -2267,9 +2263,8 @@ static int map_block_for_writepage(struct inode *inode,
goto research;
}
} else {
reiserfs_warning(inode->i_sb,
"clm-6003: bad item inode %lu, device %s",
inode->i_ino, reiserfs_bdevname(inode->i_sb));
reiserfs_warning(inode->i_sb, "clm-6003",
"bad item inode %lu", inode->i_ino);
retval = -EIO;
goto out;
}

View File

@ -97,7 +97,8 @@ static int sd_unit_num(struct virtual_item *vi)
static void sd_print_vi(struct virtual_item *vi)
{
reiserfs_warning(NULL, "STATDATA, index %d, type 0x%x, %h",
reiserfs_warning(NULL, "reiserfs-16100",
"STATDATA, index %d, type 0x%x, %h",
vi->vi_index, vi->vi_type, vi->vi_ih);
}
@ -190,7 +191,8 @@ static int direct_unit_num(struct virtual_item *vi)
static void direct_print_vi(struct virtual_item *vi)
{
reiserfs_warning(NULL, "DIRECT, index %d, type 0x%x, %h",
reiserfs_warning(NULL, "reiserfs-16101",
"DIRECT, index %d, type 0x%x, %h",
vi->vi_index, vi->vi_type, vi->vi_ih);
}
@ -278,7 +280,7 @@ static void indirect_print_item(struct item_head *ih, char *item)
unp = (__le32 *) item;
if (ih_item_len(ih) % UNFM_P_SIZE)
reiserfs_warning(NULL, "indirect_print_item: invalid item len");
reiserfs_warning(NULL, "reiserfs-16102", "invalid item len");
printk("%d pointers\n[ ", (int)I_UNFM_NUM(ih));
for (j = 0; j < I_UNFM_NUM(ih); j++) {
@ -334,7 +336,8 @@ static int indirect_unit_num(struct virtual_item *vi)
static void indirect_print_vi(struct virtual_item *vi)
{
reiserfs_warning(NULL, "INDIRECT, index %d, type 0x%x, %h",
reiserfs_warning(NULL, "reiserfs-16103",
"INDIRECT, index %d, type 0x%x, %h",
vi->vi_index, vi->vi_type, vi->vi_ih);
}
@ -359,7 +362,7 @@ static struct item_operations indirect_ops = {
static int direntry_bytes_number(struct item_head *ih, int block_size)
{
reiserfs_warning(NULL, "vs-16090: direntry_bytes_number: "
reiserfs_warning(NULL, "vs-16090",
"bytes number is asked for direntry");
return 0;
}
@ -514,8 +517,9 @@ static int direntry_create_vi(struct virtual_node *vn,
((is_affected
&& (vn->vn_mode == M_PASTE
|| vn->vn_mode == M_CUT)) ? insert_size : 0)) {
reiserfs_panic(NULL,
"vs-8025: set_entry_sizes: (mode==%c, insert_size==%d), invalid length of directory item",
reiserfs_panic(NULL, "vs-8025", "(mode==%c, "
"insert_size==%d), invalid length of "
"directory item",
vn->vn_mode, insert_size);
}
}
@ -546,7 +550,8 @@ static int direntry_check_left(struct virtual_item *vi, int free,
}
if (entries == dir_u->entry_count) {
reiserfs_panic(NULL, "free space %d, entry_count %d\n", free,
reiserfs_panic(NULL, "item_ops-1",
"free space %d, entry_count %d", free,
dir_u->entry_count);
}
@ -614,7 +619,8 @@ static void direntry_print_vi(struct virtual_item *vi)
int i;
struct direntry_uarea *dir_u = vi->vi_uarea;
reiserfs_warning(NULL, "DIRENTRY, index %d, type 0x%x, %h, flags 0x%x",
reiserfs_warning(NULL, "reiserfs-16104",
"DIRENTRY, index %d, type 0x%x, %h, flags 0x%x",
vi->vi_index, vi->vi_type, vi->vi_ih, dir_u->flags);
printk("%d entries: ", dir_u->entry_count);
for (i = 0; i < dir_u->entry_count; i++)
@ -642,43 +648,43 @@ static struct item_operations direntry_ops = {
//
static int errcatch_bytes_number(struct item_head *ih, int block_size)
{
reiserfs_warning(NULL,
"green-16001: Invalid item type observed, run fsck ASAP");
reiserfs_warning(NULL, "green-16001",
"Invalid item type observed, run fsck ASAP");
return 0;
}
static void errcatch_decrement_key(struct cpu_key *key)
{
reiserfs_warning(NULL,
"green-16002: Invalid item type observed, run fsck ASAP");
reiserfs_warning(NULL, "green-16002",
"Invalid item type observed, run fsck ASAP");
}
static int errcatch_is_left_mergeable(struct reiserfs_key *key,
unsigned long bsize)
{
reiserfs_warning(NULL,
"green-16003: Invalid item type observed, run fsck ASAP");
reiserfs_warning(NULL, "green-16003",
"Invalid item type observed, run fsck ASAP");
return 0;
}
static void errcatch_print_item(struct item_head *ih, char *item)
{
reiserfs_warning(NULL,
"green-16004: Invalid item type observed, run fsck ASAP");
reiserfs_warning(NULL, "green-16004",
"Invalid item type observed, run fsck ASAP");
}
static void errcatch_check_item(struct item_head *ih, char *item)
{
reiserfs_warning(NULL,
"green-16005: Invalid item type observed, run fsck ASAP");
reiserfs_warning(NULL, "green-16005",
"Invalid item type observed, run fsck ASAP");
}
static int errcatch_create_vi(struct virtual_node *vn,
struct virtual_item *vi,
int is_affected, int insert_size)
{
reiserfs_warning(NULL,
"green-16006: Invalid item type observed, run fsck ASAP");
reiserfs_warning(NULL, "green-16006",
"Invalid item type observed, run fsck ASAP");
return 0; // We might return -1 here as well, but it won't help as create_virtual_node() from where
// this operation is called from is of return type void.
}
@ -686,36 +692,36 @@ static int errcatch_create_vi(struct virtual_node *vn,
static int errcatch_check_left(struct virtual_item *vi, int free,
int start_skip, int end_skip)
{
reiserfs_warning(NULL,
"green-16007: Invalid item type observed, run fsck ASAP");
reiserfs_warning(NULL, "green-16007",
"Invalid item type observed, run fsck ASAP");
return -1;
}
static int errcatch_check_right(struct virtual_item *vi, int free)
{
reiserfs_warning(NULL,
"green-16008: Invalid item type observed, run fsck ASAP");
reiserfs_warning(NULL, "green-16008",
"Invalid item type observed, run fsck ASAP");
return -1;
}
static int errcatch_part_size(struct virtual_item *vi, int first, int count)
{
reiserfs_warning(NULL,
"green-16009: Invalid item type observed, run fsck ASAP");
reiserfs_warning(NULL, "green-16009",
"Invalid item type observed, run fsck ASAP");
return 0;
}
static int errcatch_unit_num(struct virtual_item *vi)
{
reiserfs_warning(NULL,
"green-16010: Invalid item type observed, run fsck ASAP");
reiserfs_warning(NULL, "green-16010",
"Invalid item type observed, run fsck ASAP");
return 0;
}
static void errcatch_print_vi(struct virtual_item *vi)
{
reiserfs_warning(NULL,
"green-16011: Invalid item type observed, run fsck ASAP");
reiserfs_warning(NULL, "green-16011",
"Invalid item type observed, run fsck ASAP");
}
static struct item_operations errcatch_ops = {

File diff suppressed because it is too large Load Diff

View File

@ -111,7 +111,7 @@ static void leaf_copy_dir_entries(struct buffer_info *dest_bi,
item_num_in_dest =
(last_first == FIRST_TO_LAST) ? (B_NR_ITEMS(dest) - 1) : 0;
leaf_paste_entries(dest_bi->bi_bh, item_num_in_dest,
leaf_paste_entries(dest_bi, item_num_in_dest,
(last_first ==
FIRST_TO_LAST) ? I_ENTRY_COUNT(B_N_PITEM_HEAD(dest,
item_num_in_dest))
@ -168,10 +168,11 @@ static int leaf_copy_boundary_item(struct buffer_info *dest_bi,
if (bytes_or_entries == ih_item_len(ih)
&& is_indirect_le_ih(ih))
if (get_ih_free_space(ih))
reiserfs_panic(NULL,
"vs-10020: leaf_copy_boundary_item: "
"last unformatted node must be filled entirely (%h)",
ih);
reiserfs_panic(sb_from_bi(dest_bi),
"vs-10020",
"last unformatted node "
"must be filled "
"entirely (%h)", ih);
}
#endif
@ -622,9 +623,8 @@ static void leaf_define_dest_src_infos(int shift_mode, struct tree_balance *tb,
break;
default:
reiserfs_panic(NULL,
"vs-10250: leaf_define_dest_src_infos: shift type is unknown (%d)",
shift_mode);
reiserfs_panic(sb_from_bi(src_bi), "vs-10250",
"shift type is unknown (%d)", shift_mode);
}
RFALSE(!src_bi->bi_bh || !dest_bi->bi_bh,
"vs-10260: mode==%d, source (%p) or dest (%p) buffer is initialized incorrectly",
@ -674,9 +674,9 @@ int leaf_shift_left(struct tree_balance *tb, int shift_num, int shift_bytes)
#ifdef CONFIG_REISERFS_CHECK
if (tb->tb_mode == M_PASTE || tb->tb_mode == M_INSERT) {
print_cur_tb("vs-10275");
reiserfs_panic(tb->tb_sb,
"vs-10275: leaf_shift_left: balance condition corrupted (%c)",
tb->tb_mode);
reiserfs_panic(tb->tb_sb, "vs-10275",
"balance condition corrupted "
"(%c)", tb->tb_mode);
}
#endif
@ -889,9 +889,12 @@ void leaf_paste_in_buffer(struct buffer_info *bi, int affected_item_num,
#ifdef CONFIG_REISERFS_CHECK
if (zeros_number > paste_size) {
struct super_block *sb = NULL;
if (bi && bi->tb)
sb = bi->tb->tb_sb;
print_cur_tb("10177");
reiserfs_panic(NULL,
"vs-10177: leaf_paste_in_buffer: ero number == %d, paste_size == %d",
reiserfs_panic(sb, "vs-10177",
"zeros_number == %d, paste_size == %d",
zeros_number, paste_size);
}
#endif /* CONFIG_REISERFS_CHECK */
@ -1191,7 +1194,7 @@ static void leaf_delete_items_entirely(struct buffer_info *bi,
}
/* paste new_entry_count entries (new_dehs, records) into position before to item_num-th item */
void leaf_paste_entries(struct buffer_head *bh,
void leaf_paste_entries(struct buffer_info *bi,
int item_num,
int before,
int new_entry_count,
@ -1203,6 +1206,7 @@ void leaf_paste_entries(struct buffer_head *bh,
struct reiserfs_de_head *deh;
char *insert_point;
int i, old_entry_num;
struct buffer_head *bh = bi->bi_bh;
if (new_entry_count == 0)
return;
@ -1287,13 +1291,17 @@ void leaf_paste_entries(struct buffer_head *bh,
prev = (i != 0) ? deh_location(&(deh[i - 1])) : 0;
if (prev && prev <= deh_location(&(deh[i])))
reiserfs_warning(NULL,
"vs-10240: leaf_paste_entries: directory item (%h) corrupted (prev %a, cur(%d) %a)",
ih, deh + i - 1, i, deh + i);
reiserfs_error(sb_from_bi(bi), "vs-10240",
"directory item (%h) "
"corrupted (prev %a, "
"cur(%d) %a)",
ih, deh + i - 1, i, deh + i);
if (next && next >= deh_location(&(deh[i])))
reiserfs_warning(NULL,
"vs-10250: leaf_paste_entries: directory item (%h) corrupted (cur(%d) %a, next %a)",
ih, i, deh + i, deh + i + 1);
reiserfs_error(sb_from_bi(bi), "vs-10250",
"directory item (%h) "
"corrupted (cur(%d) %a, "
"next %a)",
ih, i, deh + i, deh + i + 1);
}
}
#endif

View File

@ -120,8 +120,8 @@ int search_by_entry_key(struct super_block *sb, const struct cpu_key *key,
switch (retval) {
case ITEM_NOT_FOUND:
if (!PATH_LAST_POSITION(path)) {
reiserfs_warning(sb,
"vs-7000: search_by_entry_key: search_by_key returned item position == 0");
reiserfs_error(sb, "vs-7000", "search_by_key "
"returned item position == 0");
pathrelse(path);
return IO_ERROR;
}
@ -135,8 +135,7 @@ int search_by_entry_key(struct super_block *sb, const struct cpu_key *key,
default:
pathrelse(path);
reiserfs_warning(sb,
"vs-7002: search_by_entry_key: no path to here");
reiserfs_error(sb, "vs-7002", "no path to here");
return IO_ERROR;
}
@ -146,10 +145,9 @@ int search_by_entry_key(struct super_block *sb, const struct cpu_key *key,
if (!is_direntry_le_ih(de->de_ih) ||
COMP_SHORT_KEYS(&(de->de_ih->ih_key), key)) {
print_block(de->de_bh, 0, -1, -1);
reiserfs_panic(sb,
"vs-7005: search_by_entry_key: found item %h is not directory item or "
"does not belong to the same directory as key %K",
de->de_ih, key);
reiserfs_panic(sb, "vs-7005", "found item %h is not directory "
"item or does not belong to the same directory "
"as key %K", de->de_ih, key);
}
#endif /* CONFIG_REISERFS_CHECK */
@ -300,8 +298,7 @@ static int reiserfs_find_entry(struct inode *dir, const char *name, int namelen,
search_by_entry_key(dir->i_sb, &key_to_search,
path_to_entry, de);
if (retval == IO_ERROR) {
reiserfs_warning(dir->i_sb, "zam-7001: io error in %s",
__func__);
reiserfs_error(dir->i_sb, "zam-7001", "io error");
return IO_ERROR;
}
@ -361,9 +358,10 @@ static struct dentry *reiserfs_lookup(struct inode *dir, struct dentry *dentry,
return ERR_PTR(-EACCES);
}
/* Propogate the priv_object flag so we know we're in the priv tree */
if (is_reiserfs_priv_object(dir))
reiserfs_mark_inode_private(inode);
/* Propagate the private flag so we know we're
* in the priv tree */
if (IS_PRIVATE(dir))
inode->i_flags |= S_PRIVATE;
}
reiserfs_write_unlock(dir->i_sb);
if (retval == IO_ERROR) {
@ -484,10 +482,9 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,
}
if (retval != NAME_FOUND) {
reiserfs_warning(dir->i_sb,
"zam-7002:%s: \"reiserfs_find_entry\" "
"has returned unexpected value (%d)",
__func__, retval);
reiserfs_error(dir->i_sb, "zam-7002",
"reiserfs_find_entry() returned "
"unexpected value (%d)", retval);
}
return -EEXIST;
@ -498,8 +495,9 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,
MAX_GENERATION_NUMBER + 1);
if (gen_number > MAX_GENERATION_NUMBER) {
/* there is no free generation number */
reiserfs_warning(dir->i_sb,
"reiserfs_add_entry: Congratulations! we have got hash function screwed up");
reiserfs_warning(dir->i_sb, "reiserfs-7010",
"Congratulations! we have got hash function "
"screwed up");
if (buffer != small_buf)
kfree(buffer);
pathrelse(&path);
@ -515,10 +513,9 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,
if (gen_number != 0) { /* we need to re-search for the insertion point */
if (search_by_entry_key(dir->i_sb, &entry_key, &path, &de) !=
NAME_NOT_FOUND) {
reiserfs_warning(dir->i_sb,
"vs-7032: reiserfs_add_entry: "
"entry with this key (%K) already exists",
&entry_key);
reiserfs_warning(dir->i_sb, "vs-7032",
"entry with this key (%K) already "
"exists", &entry_key);
if (buffer != small_buf)
kfree(buffer);
@ -601,20 +598,22 @@ static int reiserfs_create(struct inode *dir, struct dentry *dentry, int mode,
2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) +
REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb));
struct reiserfs_transaction_handle th;
int locked;
struct reiserfs_security_handle security;
if (!(inode = new_inode(dir->i_sb))) {
return -ENOMEM;
}
new_inode_init(inode, dir, mode);
locked = reiserfs_cache_default_acl(dir);
jbegin_count += reiserfs_cache_default_acl(dir);
retval = reiserfs_security_init(dir, inode, &security);
if (retval < 0) {
drop_new_inode(inode);
return retval;
}
jbegin_count += retval;
reiserfs_write_lock(dir->i_sb);
if (locked)
reiserfs_write_lock_xattrs(dir->i_sb);
retval = journal_begin(&th, dir->i_sb, jbegin_count);
if (retval) {
drop_new_inode(inode);
@ -623,15 +622,10 @@ static int reiserfs_create(struct inode *dir, struct dentry *dentry, int mode,
retval =
reiserfs_new_inode(&th, dir, mode, NULL, 0 /*i_size */ , dentry,
inode);
inode, &security);
if (retval)
goto out_failed;
if (locked) {
reiserfs_write_unlock_xattrs(dir->i_sb);
locked = 0;
}
inode->i_op = &reiserfs_file_inode_operations;
inode->i_fop = &reiserfs_file_operations;
inode->i_mapping->a_ops = &reiserfs_address_space_operations;
@ -658,8 +652,6 @@ static int reiserfs_create(struct inode *dir, struct dentry *dentry, int mode,
retval = journal_end(&th, dir->i_sb, jbegin_count);
out_failed:
if (locked)
reiserfs_write_unlock_xattrs(dir->i_sb);
reiserfs_write_unlock(dir->i_sb);
return retval;
}
@ -670,12 +662,12 @@ static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, int mode,
int retval;
struct inode *inode;
struct reiserfs_transaction_handle th;
struct reiserfs_security_handle security;
/* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */
int jbegin_count =
JOURNAL_PER_BALANCE_CNT * 3 +
2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) +
REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb));
int locked;
if (!new_valid_dev(rdev))
return -EINVAL;
@ -685,13 +677,15 @@ static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, int mode,
}
new_inode_init(inode, dir, mode);
locked = reiserfs_cache_default_acl(dir);
jbegin_count += reiserfs_cache_default_acl(dir);
retval = reiserfs_security_init(dir, inode, &security);
if (retval < 0) {
drop_new_inode(inode);
return retval;
}
jbegin_count += retval;
reiserfs_write_lock(dir->i_sb);
if (locked)
reiserfs_write_lock_xattrs(dir->i_sb);
retval = journal_begin(&th, dir->i_sb, jbegin_count);
if (retval) {
drop_new_inode(inode);
@ -700,16 +694,11 @@ static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, int mode,
retval =
reiserfs_new_inode(&th, dir, mode, NULL, 0 /*i_size */ , dentry,
inode);
inode, &security);
if (retval) {
goto out_failed;
}
if (locked) {
reiserfs_write_unlock_xattrs(dir->i_sb);
locked = 0;
}
inode->i_op = &reiserfs_special_inode_operations;
init_special_inode(inode, inode->i_mode, rdev);
@ -739,8 +728,6 @@ static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, int mode,
retval = journal_end(&th, dir->i_sb, jbegin_count);
out_failed:
if (locked)
reiserfs_write_unlock_xattrs(dir->i_sb);
reiserfs_write_unlock(dir->i_sb);
return retval;
}
@ -750,12 +737,12 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
int retval;
struct inode *inode;
struct reiserfs_transaction_handle th;
struct reiserfs_security_handle security;
/* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */
int jbegin_count =
JOURNAL_PER_BALANCE_CNT * 3 +
2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) +
REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb));
int locked;
#ifdef DISPLACE_NEW_PACKING_LOCALITIES
/* set flag that new packing locality created and new blocks for the content * of that directory are not displaced yet */
@ -767,11 +754,14 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
}
new_inode_init(inode, dir, mode);
locked = reiserfs_cache_default_acl(dir);
jbegin_count += reiserfs_cache_default_acl(dir);
retval = reiserfs_security_init(dir, inode, &security);
if (retval < 0) {
drop_new_inode(inode);
return retval;
}
jbegin_count += retval;
reiserfs_write_lock(dir->i_sb);
if (locked)
reiserfs_write_lock_xattrs(dir->i_sb);
retval = journal_begin(&th, dir->i_sb, jbegin_count);
if (retval) {
@ -787,17 +777,12 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
retval = reiserfs_new_inode(&th, dir, mode, NULL /*symlink */ ,
old_format_only(dir->i_sb) ?
EMPTY_DIR_SIZE_V1 : EMPTY_DIR_SIZE,
dentry, inode);
dentry, inode, &security);
if (retval) {
dir->i_nlink--;
goto out_failed;
}
if (locked) {
reiserfs_write_unlock_xattrs(dir->i_sb);
locked = 0;
}
reiserfs_update_inode_transaction(inode);
reiserfs_update_inode_transaction(dir);
@ -827,8 +812,6 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
unlock_new_inode(inode);
retval = journal_end(&th, dir->i_sb, jbegin_count);
out_failed:
if (locked)
reiserfs_write_unlock_xattrs(dir->i_sb);
reiserfs_write_unlock(dir->i_sb);
return retval;
}
@ -903,8 +886,9 @@ static int reiserfs_rmdir(struct inode *dir, struct dentry *dentry)
goto end_rmdir;
if (inode->i_nlink != 2 && inode->i_nlink != 1)
reiserfs_warning(inode->i_sb, "%s: empty directory has nlink "
"!= 2 (%d)", __func__, inode->i_nlink);
reiserfs_error(inode->i_sb, "reiserfs-7040",
"empty directory has nlink != 2 (%d)",
inode->i_nlink);
clear_nlink(inode);
inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
@ -980,10 +964,9 @@ static int reiserfs_unlink(struct inode *dir, struct dentry *dentry)
}
if (!inode->i_nlink) {
reiserfs_warning(inode->i_sb, "%s: deleting nonexistent file "
"(%s:%lu), %d", __func__,
reiserfs_bdevname(inode->i_sb), inode->i_ino,
inode->i_nlink);
reiserfs_warning(inode->i_sb, "reiserfs-7042",
"deleting nonexistent file (%lu), %d",
inode->i_ino, inode->i_nlink);
inode->i_nlink = 1;
}
@ -1037,6 +1020,7 @@ static int reiserfs_symlink(struct inode *parent_dir,
char *name;
int item_len;
struct reiserfs_transaction_handle th;
struct reiserfs_security_handle security;
int mode = S_IFLNK | S_IRWXUGO;
/* We need blocks for transaction + (user+group)*(quotas for new inode + update of quota for directory owner) */
int jbegin_count =
@ -1049,6 +1033,13 @@ static int reiserfs_symlink(struct inode *parent_dir,
}
new_inode_init(inode, parent_dir, mode);
retval = reiserfs_security_init(parent_dir, inode, &security);
if (retval < 0) {
drop_new_inode(inode);
return retval;
}
jbegin_count += retval;
reiserfs_write_lock(parent_dir->i_sb);
item_len = ROUND_UP(strlen(symname));
if (item_len > MAX_DIRECT_ITEM_LEN(parent_dir->i_sb->s_blocksize)) {
@ -1066,8 +1057,6 @@ static int reiserfs_symlink(struct inode *parent_dir,
memcpy(name, symname, strlen(symname));
padd_item(name, item_len, strlen(symname));
/* We would inherit the default ACL here, but symlinks don't get ACLs */
retval = journal_begin(&th, parent_dir->i_sb, jbegin_count);
if (retval) {
drop_new_inode(inode);
@ -1077,7 +1066,7 @@ static int reiserfs_symlink(struct inode *parent_dir,
retval =
reiserfs_new_inode(&th, parent_dir, mode, name, strlen(symname),
dentry, inode);
dentry, inode, &security);
kfree(name);
if (retval) { /* reiserfs_new_inode iputs for us */
goto out_failed;
@ -1173,7 +1162,7 @@ static int reiserfs_link(struct dentry *old_dentry, struct inode *dir,
return retval;
}
// de contains information pointing to an entry which
/* de contains information pointing to an entry which */
static int de_still_valid(const char *name, int len,
struct reiserfs_dir_entry *de)
{
@ -1196,15 +1185,14 @@ static int entry_points_to_object(const char *name, int len,
if (inode) {
if (!de_visible(de->de_deh + de->de_entry_num))
reiserfs_panic(NULL,
"vs-7042: entry_points_to_object: entry must be visible");
reiserfs_panic(inode->i_sb, "vs-7042",
"entry must be visible");
return (de->de_objectid == inode->i_ino) ? 1 : 0;
}
/* this must be added hidden entry */
if (de_visible(de->de_deh + de->de_entry_num))
reiserfs_panic(NULL,
"vs-7043: entry_points_to_object: entry must be visible");
reiserfs_panic(NULL, "vs-7043", "entry must be visible");
return 1;
}
@ -1318,8 +1306,8 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
new_dentry->d_name.len, old_inode, 0);
if (retval == -EEXIST) {
if (!new_dentry_inode) {
reiserfs_panic(old_dir->i_sb,
"vs-7050: new entry is found, new inode == 0\n");
reiserfs_panic(old_dir->i_sb, "vs-7050",
"new entry is found, new inode == 0");
}
} else if (retval) {
int err = journal_end(&th, old_dir->i_sb, jbegin_count);
@ -1477,7 +1465,7 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
}
if (S_ISDIR(old_inode_mode)) {
// adjust ".." of renamed directory
/* adjust ".." of renamed directory */
set_ino_in_dir_entry(&dot_dot_de, INODE_PKEY(new_dir));
journal_mark_dirty(&th, new_dir->i_sb, dot_dot_de.de_bh);
@ -1499,8 +1487,8 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
if (reiserfs_cut_from_item
(&th, &old_entry_path, &(old_de.de_entry_key), old_dir, NULL,
0) < 0)
reiserfs_warning(old_dir->i_sb,
"vs-7060: reiserfs_rename: couldn't not cut old name. Fsck later?");
reiserfs_error(old_dir->i_sb, "vs-7060",
"couldn't not cut old name. Fsck later?");
old_dir->i_size -= DEH_SIZE + old_de.de_entrylen;

View File

@ -18,8 +18,7 @@
static void check_objectid_map(struct super_block *s, __le32 * map)
{
if (le32_to_cpu(map[0]) != 1)
reiserfs_panic(s,
"vs-15010: check_objectid_map: map corrupted: %lx",
reiserfs_panic(s, "vs-15010", "map corrupted: %lx",
(long unsigned int)le32_to_cpu(map[0]));
// FIXME: add something else here
@ -61,7 +60,7 @@ __u32 reiserfs_get_unused_objectid(struct reiserfs_transaction_handle *th)
/* comment needed -Hans */
unused_objectid = le32_to_cpu(map[1]);
if (unused_objectid == U32_MAX) {
reiserfs_warning(s, "%s: no more object ids", __func__);
reiserfs_warning(s, "reiserfs-15100", "no more object ids");
reiserfs_restore_prepared_buffer(s, SB_BUFFER_WITH_SB(s));
return 0;
}
@ -160,9 +159,8 @@ void reiserfs_release_objectid(struct reiserfs_transaction_handle *th,
i += 2;
}
reiserfs_warning(s,
"vs-15011: reiserfs_release_objectid: tried to free free object id (%lu)",
(long unsigned)objectid_to_release);
reiserfs_error(s, "vs-15011", "tried to free free object id (%lu)",
(long unsigned)objectid_to_release);
}
int reiserfs_convert_objectid_map_v1(struct super_block *s)

View File

@ -157,19 +157,16 @@ static void sprintf_disk_child(char *buf, struct disk_child *dc)
dc_size(dc));
}
static char *is_there_reiserfs_struct(char *fmt, int *what, int *skip)
static char *is_there_reiserfs_struct(char *fmt, int *what)
{
char *k = fmt;
*skip = 0;
while ((k = strchr(k, '%')) != NULL) {
if (k[1] == 'k' || k[1] == 'K' || k[1] == 'h' || k[1] == 't' ||
k[1] == 'z' || k[1] == 'b' || k[1] == 'y' || k[1] == 'a') {
*what = k[1];
break;
}
(*skip)++;
k++;
}
return k;
@ -187,24 +184,23 @@ static char *is_there_reiserfs_struct(char *fmt, int *what, int *skip)
printk ("bad key %lu %lu %lu %lu", key->k_dir_id, key->k_objectid,
key->k_offset, key->k_uniqueness);
*/
static DEFINE_SPINLOCK(error_lock);
static void prepare_error_buf(const char *fmt, va_list args)
{
char *fmt1 = fmt_buf;
char *k;
char *p = error_buf;
int i, j, what, skip;
int what;
spin_lock(&error_lock);
strcpy(fmt1, fmt);
while ((k = is_there_reiserfs_struct(fmt1, &what, &skip)) != NULL) {
while ((k = is_there_reiserfs_struct(fmt1, &what)) != NULL) {
*k = 0;
p += vsprintf(p, fmt1, args);
for (i = 0; i < skip; i++)
j = va_arg(args, int);
switch (what) {
case 'k':
sprintf_le_key(p, va_arg(args, struct reiserfs_key *));
@ -243,6 +239,7 @@ static void prepare_error_buf(const char *fmt, va_list args)
fmt1 = k + 2;
}
vsprintf(p, fmt1, args);
spin_unlock(&error_lock);
}
@ -264,14 +261,17 @@ static void prepare_error_buf(const char *fmt, va_list args)
va_end( args );\
}
void reiserfs_warning(struct super_block *sb, const char *fmt, ...)
void __reiserfs_warning(struct super_block *sb, const char *id,
const char *function, const char *fmt, ...)
{
do_reiserfs_warning(fmt);
if (sb)
printk(KERN_WARNING "ReiserFS: %s: warning: %s\n",
reiserfs_bdevname(sb), error_buf);
printk(KERN_WARNING "REISERFS warning (device %s): %s%s%s: "
"%s\n", sb->s_id, id ? id : "", id ? " " : "",
function, error_buf);
else
printk(KERN_WARNING "ReiserFS: warning: %s\n", error_buf);
printk(KERN_WARNING "REISERFS warning: %s%s%s: %s\n",
id ? id : "", id ? " " : "", function, error_buf);
}
/* No newline.. reiserfs_info calls can be followed by printk's */
@ -279,10 +279,10 @@ void reiserfs_info(struct super_block *sb, const char *fmt, ...)
{
do_reiserfs_warning(fmt);
if (sb)
printk(KERN_NOTICE "ReiserFS: %s: %s",
reiserfs_bdevname(sb), error_buf);
printk(KERN_NOTICE "REISERFS (device %s): %s",
sb->s_id, error_buf);
else
printk(KERN_NOTICE "ReiserFS: %s", error_buf);
printk(KERN_NOTICE "REISERFS %s:", error_buf);
}
/* No newline.. reiserfs_printk calls can be followed by printk's */
@ -297,10 +297,10 @@ void reiserfs_debug(struct super_block *s, int level, const char *fmt, ...)
#ifdef CONFIG_REISERFS_CHECK
do_reiserfs_warning(fmt);
if (s)
printk(KERN_DEBUG "ReiserFS: %s: %s\n",
reiserfs_bdevname(s), error_buf);
printk(KERN_DEBUG "REISERFS debug (device %s): %s\n",
s->s_id, error_buf);
else
printk(KERN_DEBUG "ReiserFS: %s\n", error_buf);
printk(KERN_DEBUG "REISERFS debug: %s\n", error_buf);
#endif
}
@ -353,14 +353,46 @@ void reiserfs_debug(struct super_block *s, int level, const char *fmt, ...)
extern struct tree_balance *cur_tb;
#endif
void reiserfs_panic(struct super_block *sb, const char *fmt, ...)
void __reiserfs_panic(struct super_block *sb, const char *id,
const char *function, const char *fmt, ...)
{
do_reiserfs_warning(fmt);
#ifdef CONFIG_REISERFS_CHECK
dump_stack();
#endif
if (sb)
panic(KERN_WARNING "REISERFS panic (device %s): %s%s%s: %s\n",
sb->s_id, id ? id : "", id ? " " : "",
function, error_buf);
else
panic(KERN_WARNING "REISERFS panic: %s%s%s: %s\n",
id ? id : "", id ? " " : "", function, error_buf);
}
panic(KERN_EMERG "REISERFS: panic (device %s): %s\n",
reiserfs_bdevname(sb), error_buf);
void __reiserfs_error(struct super_block *sb, const char *id,
const char *function, const char *fmt, ...)
{
do_reiserfs_warning(fmt);
BUG_ON(sb == NULL);
if (reiserfs_error_panic(sb))
__reiserfs_panic(sb, id, function, error_buf);
if (id && id[0])
printk(KERN_CRIT "REISERFS error (device %s): %s %s: %s\n",
sb->s_id, id, function, error_buf);
else
printk(KERN_CRIT "REISERFS error (device %s): %s: %s\n",
sb->s_id, function, error_buf);
if (sb->s_flags & MS_RDONLY)
return;
reiserfs_info(sb, "Remounting filesystem read-only\n");
sb->s_flags |= MS_RDONLY;
reiserfs_abort_journal(sb, -EIO);
}
void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...)
@ -368,18 +400,18 @@ void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...)
do_reiserfs_warning(fmt);
if (reiserfs_error_panic(sb)) {
panic(KERN_CRIT "REISERFS: panic (device %s): %s\n",
reiserfs_bdevname(sb), error_buf);
panic(KERN_CRIT "REISERFS panic (device %s): %s\n", sb->s_id,
error_buf);
}
if (sb->s_flags & MS_RDONLY)
if (reiserfs_is_journal_aborted(SB_JOURNAL(sb)))
return;
printk(KERN_CRIT "REISERFS: abort (device %s): %s\n",
reiserfs_bdevname(sb), error_buf);
printk(KERN_CRIT "REISERFS abort (device %s): %s\n", sb->s_id,
error_buf);
sb->s_flags |= MS_RDONLY;
reiserfs_journal_abort(sb, errno);
reiserfs_abort_journal(sb, errno);
}
/* this prints internal nodes (4 keys/items in line) (dc_number,
@ -681,12 +713,10 @@ static void check_leaf_block_head(struct buffer_head *bh)
blkh = B_BLK_HEAD(bh);
nr = blkh_nr_item(blkh);
if (nr > (bh->b_size - BLKH_SIZE) / IH_SIZE)
reiserfs_panic(NULL,
"vs-6010: check_leaf_block_head: invalid item number %z",
reiserfs_panic(NULL, "vs-6010", "invalid item number %z",
bh);
if (blkh_free_space(blkh) > bh->b_size - BLKH_SIZE - IH_SIZE * nr)
reiserfs_panic(NULL,
"vs-6020: check_leaf_block_head: invalid free space %z",
reiserfs_panic(NULL, "vs-6020", "invalid free space %z",
bh);
}
@ -697,21 +727,15 @@ static void check_internal_block_head(struct buffer_head *bh)
blkh = B_BLK_HEAD(bh);
if (!(B_LEVEL(bh) > DISK_LEAF_NODE_LEVEL && B_LEVEL(bh) <= MAX_HEIGHT))
reiserfs_panic(NULL,
"vs-6025: check_internal_block_head: invalid level %z",
bh);
reiserfs_panic(NULL, "vs-6025", "invalid level %z", bh);
if (B_NR_ITEMS(bh) > (bh->b_size - BLKH_SIZE) / IH_SIZE)
reiserfs_panic(NULL,
"vs-6030: check_internal_block_head: invalid item number %z",
bh);
reiserfs_panic(NULL, "vs-6030", "invalid item number %z", bh);
if (B_FREE_SPACE(bh) !=
bh->b_size - BLKH_SIZE - KEY_SIZE * B_NR_ITEMS(bh) -
DC_SIZE * (B_NR_ITEMS(bh) + 1))
reiserfs_panic(NULL,
"vs-6040: check_internal_block_head: invalid free space %z",
bh);
reiserfs_panic(NULL, "vs-6040", "invalid free space %z", bh);
}

View File

@ -321,7 +321,7 @@ static int show_journal(struct seq_file *m, struct super_block *sb)
/* incore fields */
"j_1st_reserved_block: \t%i\n"
"j_state: \t%li\n"
"j_trans_id: \t%lu\n"
"j_trans_id: \t%u\n"
"j_mount_id: \t%lu\n"
"j_start: \t%lu\n"
"j_len: \t%lu\n"
@ -329,7 +329,7 @@ static int show_journal(struct seq_file *m, struct super_block *sb)
"j_wcount: \t%i\n"
"j_bcount: \t%lu\n"
"j_first_unflushed_offset: \t%lu\n"
"j_last_flush_trans_id: \t%lu\n"
"j_last_flush_trans_id: \t%u\n"
"j_trans_start_time: \t%li\n"
"j_list_bitmap_index: \t%i\n"
"j_must_wait: \t%i\n"
@ -503,7 +503,7 @@ int reiserfs_proc_info_init(struct super_block *sb)
add_file(sb, "journal", show_journal);
return 0;
}
reiserfs_warning(sb, "reiserfs: cannot create /proc/%s/%s",
reiserfs_warning(sb, "cannot create /proc/%s/%s",
proc_info_root_name, b);
return 1;
}
@ -559,8 +559,7 @@ int reiserfs_proc_info_global_init(void)
if (proc_info_root) {
proc_info_root->owner = THIS_MODULE;
} else {
reiserfs_warning(NULL,
"reiserfs: cannot create /proc/%s",
reiserfs_warning(NULL, "cannot create /proc/%s",
proc_info_root_name);
return 1;
}

File diff suppressed because it is too large Load Diff

View File

@ -183,9 +183,9 @@ static int finish_unfinished(struct super_block *s)
if (REISERFS_SB(s)->s_qf_names[i]) {
int ret = reiserfs_quota_on_mount(s, i);
if (ret < 0)
reiserfs_warning(s,
"reiserfs: cannot turn on journaled quota: error %d",
ret);
reiserfs_warning(s, "reiserfs-2500",
"cannot turn on journaled "
"quota: error %d", ret);
}
}
#endif
@ -195,17 +195,16 @@ static int finish_unfinished(struct super_block *s)
while (!retval) {
retval = search_item(s, &max_cpu_key, &path);
if (retval != ITEM_NOT_FOUND) {
reiserfs_warning(s,
"vs-2140: finish_unfinished: search_by_key returned %d",
retval);
reiserfs_error(s, "vs-2140",
"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(s,
"vs-2060: finish_unfinished: wrong position found");
reiserfs_warning(s, "vs-2060",
"wrong position found");
break;
}
item_pos--;
@ -235,8 +234,7 @@ static int finish_unfinished(struct super_block *s)
if (!inode) {
/* the unlink almost completed, it just did not manage to remove
"save" link and release objectid */
reiserfs_warning(s,
"vs-2180: finish_unfinished: iget failed for %K",
reiserfs_warning(s, "vs-2180", "iget failed for %K",
&obj_key);
retval = remove_save_link_only(s, &save_link_key, 1);
continue;
@ -244,8 +242,8 @@ static int finish_unfinished(struct super_block *s)
if (!truncate && inode->i_nlink) {
/* file is not unlinked */
reiserfs_warning(s,
"vs-2185: finish_unfinished: file %K is not unlinked",
reiserfs_warning(s, "vs-2185",
"file %K is not unlinked",
&obj_key);
retval = remove_save_link_only(s, &save_link_key, 0);
continue;
@ -257,8 +255,9 @@ static int finish_unfinished(struct super_block *s)
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(s,
"green-2101: impossible truncate on a directory %k. Please report",
reiserfs_warning(s, "green-2101",
"impossible truncate on a "
"directory %k. Please report",
INODE_PKEY(inode));
retval = remove_save_link_only(s, &save_link_key, 0);
truncate = 0;
@ -288,9 +287,10 @@ static int finish_unfinished(struct super_block *s)
/* removal gets completed in iput */
retval = 0;
} else {
reiserfs_warning(s, "Dead loop in "
"finish_unfinished detected, "
"just remove save link\n");
reiserfs_warning(s, "super-2189", "Dead loop "
"in finish_unfinished "
"detected, just remove "
"save link\n");
retval = remove_save_link_only(s,
&save_link_key, 0);
}
@ -360,8 +360,9 @@ void add_save_link(struct reiserfs_transaction_handle *th,
} else {
/* truncate */
if (S_ISDIR(inode->i_mode))
reiserfs_warning(inode->i_sb,
"green-2102: Adding a truncate savelink for a directory %k! Please report",
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);
@ -376,9 +377,9 @@ void add_save_link(struct reiserfs_transaction_handle *th,
retval = search_item(inode->i_sb, &key, &path);
if (retval != ITEM_NOT_FOUND) {
if (retval != -ENOSPC)
reiserfs_warning(inode->i_sb, "vs-2100: add_save_link:"
"search_by_key (%K) returned %d", &key,
retval);
reiserfs_error(inode->i_sb, "vs-2100",
"search_by_key (%K) returned %d", &key,
retval);
pathrelse(&path);
return;
}
@ -391,9 +392,8 @@ void add_save_link(struct reiserfs_transaction_handle *th,
reiserfs_insert_item(th, &path, &key, &ih, NULL, (char *)&link);
if (retval) {
if (retval != -ENOSPC)
reiserfs_warning(inode->i_sb,
"vs-2120: add_save_link: insert_item returned %d",
retval);
reiserfs_error(inode->i_sb, "vs-2120",
"insert_item returned %d", retval);
} else {
if (truncate)
REISERFS_I(inode)->i_flags |=
@ -492,8 +492,7 @@ static void reiserfs_put_super(struct super_block *s)
print_statistics(s);
if (REISERFS_SB(s)->reserved_blocks != 0) {
reiserfs_warning(s,
"green-2005: reiserfs_put_super: reserved blocks left %d",
reiserfs_warning(s, "green-2005", "reserved blocks left %d",
REISERFS_SB(s)->reserved_blocks);
}
@ -559,8 +558,8 @@ static void reiserfs_dirty_inode(struct inode *inode)
int err = 0;
if (inode->i_sb->s_flags & MS_RDONLY) {
reiserfs_warning(inode->i_sb,
"clm-6006: writing inode %lu on readonly FS",
reiserfs_warning(inode->i_sb, "clm-6006",
"writing inode %lu on readonly FS",
inode->i_ino);
return;
}
@ -792,13 +791,15 @@ static int reiserfs_getopt(struct super_block *s, char **cur, opt_desc_t * opts,
if (bit_flags) {
if (opt->clrmask ==
(1 << REISERFS_UNSUPPORTED_OPT))
reiserfs_warning(s, "%s not supported.",
reiserfs_warning(s, "super-6500",
"%s not supported.\n",
p);
else
*bit_flags &= ~opt->clrmask;
if (opt->setmask ==
(1 << REISERFS_UNSUPPORTED_OPT))
reiserfs_warning(s, "%s not supported.",
reiserfs_warning(s, "super-6501",
"%s not supported.\n",
p);
else
*bit_flags |= opt->setmask;
@ -807,7 +808,8 @@ static int reiserfs_getopt(struct super_block *s, char **cur, opt_desc_t * opts,
}
}
if (!opt->option_name) {
reiserfs_warning(s, "unknown mount option \"%s\"", p);
reiserfs_warning(s, "super-6502",
"unknown mount option \"%s\"", p);
return -1;
}
@ -815,8 +817,9 @@ static int reiserfs_getopt(struct super_block *s, char **cur, opt_desc_t * opts,
switch (*p) {
case '=':
if (!opt->arg_required) {
reiserfs_warning(s,
"the option \"%s\" does not require an argument",
reiserfs_warning(s, "super-6503",
"the option \"%s\" does not "
"require an argument\n",
opt->option_name);
return -1;
}
@ -824,14 +827,15 @@ static int reiserfs_getopt(struct super_block *s, char **cur, opt_desc_t * opts,
case 0:
if (opt->arg_required) {
reiserfs_warning(s,
"the option \"%s\" requires an argument",
opt->option_name);
reiserfs_warning(s, "super-6504",
"the option \"%s\" requires an "
"argument\n", opt->option_name);
return -1;
}
break;
default:
reiserfs_warning(s, "head of option \"%s\" is only correct",
reiserfs_warning(s, "super-6505",
"head of option \"%s\" is only correct\n",
opt->option_name);
return -1;
}
@ -843,7 +847,8 @@ static int reiserfs_getopt(struct super_block *s, char **cur, opt_desc_t * opts,
&& !(opt->arg_required & (1 << REISERFS_OPT_ALLOWEMPTY))
&& !strlen(p)) {
/* this catches "option=," if not allowed */
reiserfs_warning(s, "empty argument for \"%s\"",
reiserfs_warning(s, "super-6506",
"empty argument for \"%s\"\n",
opt->option_name);
return -1;
}
@ -865,7 +870,8 @@ static int reiserfs_getopt(struct super_block *s, char **cur, opt_desc_t * opts,
}
}
reiserfs_warning(s, "bad value \"%s\" for option \"%s\"", p,
reiserfs_warning(s, "super-6506",
"bad value \"%s\" for option \"%s\"\n", p,
opt->option_name);
return -1;
}
@ -955,9 +961,9 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin
*blocks = simple_strtoul(arg, &p, 0);
if (*p != '\0') {
/* NNN does not look like a number */
reiserfs_warning(s,
"reiserfs_parse_options: bad value %s",
arg);
reiserfs_warning(s, "super-6507",
"bad value %s for "
"-oresize\n", arg);
return 0;
}
}
@ -968,8 +974,8 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin
unsigned long val = simple_strtoul(arg, &p, 0);
/* commit=NNN (time in seconds) */
if (*p != '\0' || val >= (unsigned int)-1) {
reiserfs_warning(s,
"reiserfs_parse_options: bad value %s",
reiserfs_warning(s, "super-6508",
"bad value %s for -ocommit\n",
arg);
return 0;
}
@ -977,16 +983,18 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin
}
if (c == 'w') {
reiserfs_warning(s, "reiserfs: nolargeio option is no longer supported");
reiserfs_warning(s, "super-6509", "nolargeio option "
"is no longer supported");
return 0;
}
if (c == 'j') {
if (arg && *arg && jdev_name) {
if (*jdev_name) { //Hm, already assigned?
reiserfs_warning(s,
"reiserfs_parse_options: journal device was already specified to be %s",
*jdev_name);
reiserfs_warning(s, "super-6510",
"journal device was "
"already specified to "
"be %s", *jdev_name);
return 0;
}
*jdev_name = arg;
@ -998,29 +1006,35 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin
if (sb_any_quota_loaded(s) &&
(!*arg != !REISERFS_SB(s)->s_qf_names[qtype])) {
reiserfs_warning(s,
"reiserfs_parse_options: cannot change journaled quota options when quota turned on.");
reiserfs_warning(s, "super-6511",
"cannot change journaled "
"quota options when quota "
"turned on.");
return 0;
}
if (*arg) { /* Some filename specified? */
if (REISERFS_SB(s)->s_qf_names[qtype]
&& strcmp(REISERFS_SB(s)->s_qf_names[qtype],
arg)) {
reiserfs_warning(s,
"reiserfs_parse_options: %s quota file already specified.",
reiserfs_warning(s, "super-6512",
"%s quota file "
"already specified.",
QTYPE2NAME(qtype));
return 0;
}
if (strchr(arg, '/')) {
reiserfs_warning(s,
"reiserfs_parse_options: quotafile must be on filesystem root.");
reiserfs_warning(s, "super-6513",
"quotafile must be "
"on filesystem root.");
return 0;
}
qf_names[qtype] =
kmalloc(strlen(arg) + 1, GFP_KERNEL);
if (!qf_names[qtype]) {
reiserfs_warning(s,
"reiserfs_parse_options: not enough memory for storing quotafile name.");
reiserfs_warning(s, "reiserfs-2502",
"not enough memory "
"for storing "
"quotafile name.");
return 0;
}
strcpy(qf_names[qtype], arg);
@ -1038,21 +1052,24 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin
else if (!strcmp(arg, "vfsv0"))
*qfmt = QFMT_VFS_V0;
else {
reiserfs_warning(s,
"reiserfs_parse_options: unknown quota format specified.");
reiserfs_warning(s, "super-6514",
"unknown quota format "
"specified.");
return 0;
}
if (sb_any_quota_loaded(s) &&
*qfmt != REISERFS_SB(s)->s_jquota_fmt) {
reiserfs_warning(s,
"reiserfs_parse_options: cannot change journaled quota options when quota turned on.");
reiserfs_warning(s, "super-6515",
"cannot change journaled "
"quota options when quota "
"turned on.");
return 0;
}
}
#else
if (c == 'u' || c == 'g' || c == 'f') {
reiserfs_warning(s,
"reiserfs_parse_options: journaled quota options not supported.");
reiserfs_warning(s, "reiserfs-2503", "journaled "
"quota options not supported.");
return 0;
}
#endif
@ -1061,15 +1078,15 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin
#ifdef CONFIG_QUOTA
if (!REISERFS_SB(s)->s_jquota_fmt && !*qfmt
&& (qf_names[USRQUOTA] || qf_names[GRPQUOTA])) {
reiserfs_warning(s,
"reiserfs_parse_options: journaled quota format not specified.");
reiserfs_warning(s, "super-6515",
"journaled quota format not specified.");
return 0;
}
/* This checking is not precise wrt the quota type but for our purposes it is sufficient */
if (!(*mount_options & (1 << REISERFS_QUOTA))
&& sb_any_quota_loaded(s)) {
reiserfs_warning(s,
"reiserfs_parse_options: quota options must be present when quota is turned on.");
reiserfs_warning(s, "super-6516", "quota options must "
"be present when quota is turned on.");
return 0;
}
#endif
@ -1129,14 +1146,15 @@ static void handle_attrs(struct super_block *s)
if (reiserfs_attrs(s)) {
if (old_format_only(s)) {
reiserfs_warning(s,
"reiserfs: cannot support attributes on 3.5.x disk format");
reiserfs_warning(s, "super-6517", "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(s,
"reiserfs: cannot support attributes until flag is set in super-block");
reiserfs_warning(s, "super-6518", "cannot support "
"attributes until flag is set in "
"super-block");
REISERFS_SB(s)->s_mount_opt &= ~(1 << REISERFS_ATTRS);
}
}
@ -1278,6 +1296,8 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
REISERFS_SB(s)->s_mount_state = sb_umount_state(rs);
s->s_flags &= ~MS_RDONLY;
set_sb_umount_state(rs, REISERFS_ERROR_FS);
if (!old_format_only(s))
set_sb_mnt_count(rs, sb_mnt_count(rs) + 1);
/* mark_buffer_dirty (SB_BUFFER_WITH_SB (s), 1); */
journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB(s));
REISERFS_SB(s)->s_mount_state = REISERFS_VALID_FS;
@ -1312,7 +1332,7 @@ static int read_super_block(struct super_block *s, int offset)
bh = sb_bread(s, offset / s->s_blocksize);
if (!bh) {
reiserfs_warning(s, "sh-2006: read_super_block: "
reiserfs_warning(s, "sh-2006",
"bread failed (dev %s, block %lu, size %lu)",
reiserfs_bdevname(s), offset / s->s_blocksize,
s->s_blocksize);
@ -1333,8 +1353,8 @@ static int read_super_block(struct super_block *s, int offset)
bh = sb_bread(s, offset / s->s_blocksize);
if (!bh) {
reiserfs_warning(s, "sh-2007: read_super_block: "
"bread failed (dev %s, block %lu, size %lu)\n",
reiserfs_warning(s, "sh-2007",
"bread failed (dev %s, block %lu, size %lu)",
reiserfs_bdevname(s), offset / s->s_blocksize,
s->s_blocksize);
return 1;
@ -1342,8 +1362,8 @@ static int read_super_block(struct super_block *s, int offset)
rs = (struct reiserfs_super_block *)bh->b_data;
if (sb_blocksize(rs) != s->s_blocksize) {
reiserfs_warning(s, "sh-2011: read_super_block: "
"can't find a reiserfs filesystem on (dev %s, block %Lu, size %lu)\n",
reiserfs_warning(s, "sh-2011", "can't find a reiserfs "
"filesystem on (dev %s, block %Lu, size %lu)",
reiserfs_bdevname(s),
(unsigned long long)bh->b_blocknr,
s->s_blocksize);
@ -1353,9 +1373,10 @@ static int read_super_block(struct super_block *s, int offset)
if (rs->s_v1.s_root_block == cpu_to_le32(-1)) {
brelse(bh);
reiserfs_warning(s,
"Unfinished reiserfsck --rebuild-tree run detected. Please run\n"
"reiserfsck --rebuild-tree and wait for a completion. If that fails\n"
reiserfs_warning(s, "super-6519", "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");
return 1;
}
@ -1367,18 +1388,15 @@ static int read_super_block(struct super_block *s, int offset)
/* 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)
reiserfs_warning(s,
"read_super_block: found reiserfs format \"3.6\""
" with non-standard journal");
reiserfs_info(s, "found reiserfs format \"3.6\""
" with non-standard journal\n");
else if (sb_version(rs) == REISERFS_VERSION_1)
reiserfs_warning(s,
"read_super_block: found reiserfs format \"3.5\""
" with non-standard journal");
reiserfs_info(s, "found reiserfs format \"3.5\""
" with non-standard journal\n");
else {
reiserfs_warning(s,
"sh-2012: read_super_block: found unknown "
"format \"%u\" of reiserfs with non-standard magic",
sb_version(rs));
reiserfs_warning(s, "sh-2012", "found unknown "
"format \"%u\" of reiserfs with "
"non-standard magic", sb_version(rs));
return 1;
}
} else
@ -1408,8 +1426,7 @@ static int reread_meta_blocks(struct super_block *s)
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))) {
reiserfs_warning(s,
"reread_meta_blocks, error reading the super");
reiserfs_warning(s, "reiserfs-2504", "error reading the super");
return 1;
}
@ -1452,8 +1469,8 @@ static __u32 find_hash_out(struct super_block *s)
if (reiserfs_rupasov_hash(s)) {
hash = YURA_HASH;
}
reiserfs_warning(s, "FS seems to be empty, autodetect "
"is using the default hash");
reiserfs_info(s, "FS seems to be empty, autodetect "
"is using the default hash\n");
break;
}
r5hash = GET_HASH_VALUE(r5_hash(de.de_name, de.de_namelen));
@ -1473,10 +1490,10 @@ static __u32 find_hash_out(struct super_block *s)
&& (yurahash ==
GET_HASH_VALUE(deh_offset
(&(de.de_deh[de.de_entry_num])))))) {
reiserfs_warning(s,
"Unable to automatically detect hash function. "
"Please mount with -o hash={tea,rupasov,r5}",
reiserfs_bdevname(s));
reiserfs_warning(s, "reiserfs-2506", "Unable to "
"automatically detect hash function. "
"Please mount with -o "
"hash={tea,rupasov,r5}");
hash = UNSET_HASH;
break;
}
@ -1490,7 +1507,8 @@ static __u32 find_hash_out(struct super_block *s)
(deh_offset(&(de.de_deh[de.de_entry_num]))) == r5hash)
hash = R5_HASH;
else {
reiserfs_warning(s, "Unrecognised hash function");
reiserfs_warning(s, "reiserfs-2506",
"Unrecognised hash function");
hash = UNSET_HASH;
}
} while (0);
@ -1518,17 +1536,20 @@ static int what_hash(struct super_block *s)
** mount options
*/
if (reiserfs_rupasov_hash(s) && code != YURA_HASH) {
reiserfs_warning(s, "Error, %s hash detected, "
reiserfs_warning(s, "reiserfs-2507",
"Error, %s hash detected, "
"unable to force rupasov hash",
reiserfs_hashname(code));
code = UNSET_HASH;
} else if (reiserfs_tea_hash(s) && code != TEA_HASH) {
reiserfs_warning(s, "Error, %s hash detected, "
reiserfs_warning(s, "reiserfs-2508",
"Error, %s hash detected, "
"unable to force tea hash",
reiserfs_hashname(code));
code = UNSET_HASH;
} else if (reiserfs_r5_hash(s) && code != R5_HASH) {
reiserfs_warning(s, "Error, %s hash detected, "
reiserfs_warning(s, "reiserfs-2509",
"Error, %s hash detected, "
"unable to force r5 hash",
reiserfs_hashname(code));
code = UNSET_HASH;
@ -1587,9 +1608,9 @@ static int function2code(hashf_t func)
return 0;
}
#define SWARN(silent, s, ...) \
#define SWARN(silent, s, id, ...) \
if (!(silent)) \
reiserfs_warning (s, __VA_ARGS__)
reiserfs_warning(s, id, __VA_ARGS__)
static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
{
@ -1623,10 +1644,6 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
REISERFS_SB(s)->s_alloc_options.preallocmin = 0;
/* Preallocate by 16 blocks (17-1) at once */
REISERFS_SB(s)->s_alloc_options.preallocsize = 17;
#ifdef CONFIG_REISERFS_FS_XATTR
/* Initialize the rwsem for xattr dir */
init_rwsem(&REISERFS_SB(s)->xattr_dir_sem);
#endif
/* setup default block allocator options */
reiserfs_init_alloc_options(s);
@ -1641,8 +1658,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
#endif
if (blocks) {
SWARN(silent, s, "jmacd-7: reiserfs_fill_super: resize option "
"for remount only");
SWARN(silent, s, "jmacd-7", "resize option for remount only");
goto error;
}
@ -1651,8 +1667,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
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)) {
SWARN(silent, s,
"sh-2021: reiserfs_fill_super: can not find reiserfs on %s",
SWARN(silent, s, "sh-2021", "can not find reiserfs on %s",
reiserfs_bdevname(s));
goto error;
}
@ -1664,13 +1679,12 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
if (s->s_bdev && s->s_bdev->bd_inode
&& i_size_read(s->s_bdev->bd_inode) <
sb_block_count(rs) * sb_blocksize(rs)) {
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");
SWARN(silent, s, "", "Filesystem cannot be "
"mounted because it is bigger than the device");
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;
}
@ -1678,14 +1692,13 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
sbi->s_mount_state = REISERFS_VALID_FS;
if ((errval = reiserfs_init_bitmap_cache(s))) {
SWARN(silent, s,
"jmacd-8: reiserfs_fill_super: unable to read bitmap");
SWARN(silent, s, "jmacd-8", "unable to read bitmap");
goto error;
}
errval = -EINVAL;
#ifdef CONFIG_REISERFS_CHECK
SWARN(silent, s, "CONFIG_REISERFS_CHECK is set ON");
SWARN(silent, s, "- it is slow mode for debugging.");
SWARN(silent, s, "", "CONFIG_REISERFS_CHECK is set ON");
SWARN(silent, s, "", "- it is slow mode for debugging.");
#endif
/* make data=ordered the default */
@ -1706,8 +1719,8 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
}
// set_device_ro(s->s_dev, 1) ;
if (journal_init(s, jdev_name, old_format, commit_max_age)) {
SWARN(silent, s,
"sh-2022: reiserfs_fill_super: unable to initialize journal space");
SWARN(silent, s, "sh-2022",
"unable to initialize journal space");
goto error;
} else {
jinit_done = 1; /* once this is set, journal_release must be called
@ -1715,8 +1728,8 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
*/
}
if (reread_meta_blocks(s)) {
SWARN(silent, s,
"jmacd-9: reiserfs_fill_super: unable to reread meta blocks after journal init");
SWARN(silent, s, "jmacd-9",
"unable to reread meta blocks after journal init");
goto error;
}
@ -1724,8 +1737,8 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
goto error;
if (bdev_read_only(s->s_bdev) && !(s->s_flags & MS_RDONLY)) {
SWARN(silent, s,
"clm-7000: Detected readonly device, marking FS readonly");
SWARN(silent, s, "clm-7000",
"Detected readonly device, marking FS readonly");
s->s_flags |= MS_RDONLY;
}
args.objectid = REISERFS_ROOT_OBJECTID;
@ -1734,8 +1747,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
iget5_locked(s, REISERFS_ROOT_OBJECTID, reiserfs_find_actor,
reiserfs_init_locked_inode, (void *)(&args));
if (!root_inode) {
SWARN(silent, s,
"jmacd-10: reiserfs_fill_super: get root inode failed");
SWARN(silent, s, "jmacd-10", "get root inode failed");
goto error;
}
@ -1784,7 +1796,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
* avoiding corruption. -jeffm */
if (bmap_would_wrap(reiserfs_bmap_count(s)) &&
sb_bmap_nr(rs) != 0) {
reiserfs_warning(s, "super-2030: This file system "
reiserfs_warning(s, "super-2030", "This file system "
"claims to use %u bitmap blocks in "
"its super block, but requires %u. "
"Clearing to zero.", sb_bmap_nr(rs),
@ -1817,7 +1829,9 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
} else if (!silent) {
reiserfs_info(s, "using 3.5.x disk format\n");
}
}
} else
set_sb_mnt_count(rs, sb_mnt_count(rs) + 1);
journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB(s));
errval = journal_end(&th, s, 1);
@ -2031,8 +2045,8 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
if (!(REISERFS_I(inode)->i_flags & i_nopack_mask)) {
err = reiserfs_unpack(inode, NULL);
if (err) {
reiserfs_warning(sb,
"reiserfs: Unpacking tail of quota file failed"
reiserfs_warning(sb, "super-6520",
"Unpacking tail of quota file failed"
" (%d). Cannot turn on quotas.", err);
err = -EINVAL;
goto out;
@ -2043,8 +2057,8 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
if (REISERFS_SB(sb)->s_qf_names[type]) {
/* Quotafile not of fs root? */
if (path.dentry->d_parent != sb->s_root)
reiserfs_warning(sb,
"reiserfs: Quota file not on filesystem root. "
reiserfs_warning(sb, "super-6521",
"Quota file not on filesystem root. "
"Journalled quota will not work.");
}
@ -2195,9 +2209,6 @@ static int __init init_reiserfs_fs(void)
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);
@ -2208,9 +2219,6 @@ static int __init init_reiserfs_fs(void)
return 0;
}
reiserfs_xattr_unregister_handlers();
failed_reiserfs_xattr_register_handlers:
reiserfs_proc_unregister_global("version");
reiserfs_proc_info_global_done();
destroy_inodecache();
@ -2220,7 +2228,6 @@ static int __init init_reiserfs_fs(void)
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);

View File

@ -26,7 +26,7 @@ int direct2indirect(struct reiserfs_transaction_handle *th, struct inode *inode,
converted item. */
struct item_head ind_ih; /* new indirect item to be inserted or
key of unfm pointer to be pasted */
int n_blk_size, n_retval; /* returned value for reiserfs_insert_item and clones */
int blk_size, retval; /* returned value for reiserfs_insert_item and clones */
unp_t unfm_ptr; /* Handle on an unformatted node
that will be inserted in the
tree. */
@ -35,7 +35,7 @@ int direct2indirect(struct reiserfs_transaction_handle *th, struct inode *inode,
REISERFS_SB(sb)->s_direct2indirect++;
n_blk_size = sb->s_blocksize;
blk_size = sb->s_blocksize;
/* and key to search for append or insert pointer to the new
unformatted node. */
@ -46,11 +46,11 @@ int direct2indirect(struct reiserfs_transaction_handle *th, struct inode *inode,
/* Set the key to search for the place for new unfm pointer */
make_cpu_key(&end_key, inode, tail_offset, TYPE_INDIRECT, 4);
// FIXME: we could avoid this
/* FIXME: we could avoid this */
if (search_for_position_by_key(sb, &end_key, path) == POSITION_FOUND) {
reiserfs_warning(sb, "PAP-14030: direct2indirect: "
"pasted or inserted byte exists in the tree %K. "
"Use fsck to repair.", &end_key);
reiserfs_error(sb, "PAP-14030",
"pasted or inserted byte exists in "
"the tree %K. Use fsck to repair.", &end_key);
pathrelse(path);
return -EIO;
}
@ -64,17 +64,17 @@ int direct2indirect(struct reiserfs_transaction_handle *th, struct inode *inode,
set_ih_free_space(&ind_ih, 0); /* delete at nearest future */
put_ih_item_len(&ind_ih, UNFM_P_SIZE);
PATH_LAST_POSITION(path)++;
n_retval =
retval =
reiserfs_insert_item(th, path, &end_key, &ind_ih, inode,
(char *)&unfm_ptr);
} else {
/* Paste into last indirect item of an object. */
n_retval = reiserfs_paste_into_item(th, path, &end_key, inode,
retval = reiserfs_paste_into_item(th, path, &end_key, inode,
(char *)&unfm_ptr,
UNFM_P_SIZE);
}
if (n_retval) {
return n_retval;
if (retval) {
return retval;
}
// note: from here there are two keys which have matching first
// three key components. They only differ by the fourth one.
@ -92,14 +92,13 @@ int direct2indirect(struct reiserfs_transaction_handle *th, struct inode *inode,
last item of the file */
if (search_for_position_by_key(sb, &end_key, path) ==
POSITION_FOUND)
reiserfs_panic(sb,
"PAP-14050: direct2indirect: "
reiserfs_panic(sb, "PAP-14050",
"direct item (%K) not found", &end_key);
p_le_ih = PATH_PITEM_HEAD(path);
RFALSE(!is_direct_le_ih(p_le_ih),
"vs-14055: direct item expected(%K), found %h",
&end_key, p_le_ih);
tail_size = (le_ih_k_offset(p_le_ih) & (n_blk_size - 1))
tail_size = (le_ih_k_offset(p_le_ih) & (blk_size - 1))
+ ih_item_len(p_le_ih) - 1;
/* we only send the unbh pointer if the buffer is not up to date.
@ -114,11 +113,11 @@ int direct2indirect(struct reiserfs_transaction_handle *th, struct inode *inode,
} else {
up_to_date_bh = unbh;
}
n_retval = reiserfs_delete_item(th, path, &end_key, inode,
retval = reiserfs_delete_item(th, path, &end_key, inode,
up_to_date_bh);
total_tail += n_retval;
if (tail_size == n_retval)
total_tail += retval;
if (tail_size == retval)
// done: file does not have direct items anymore
break;
@ -130,7 +129,7 @@ int direct2indirect(struct reiserfs_transaction_handle *th, struct inode *inode,
unsigned pgoff =
(tail_offset + total_tail - 1) & (PAGE_CACHE_SIZE - 1);
char *kaddr = kmap_atomic(up_to_date_bh->b_page, KM_USER0);
memset(kaddr + pgoff, 0, n_blk_size - total_tail);
memset(kaddr + pgoff, 0, blk_size - total_tail);
kunmap_atomic(kaddr, KM_USER0);
}
@ -171,14 +170,18 @@ void reiserfs_unmap_buffer(struct buffer_head *bh)
what we expect from it (number of cut bytes). But when tail remains
in the unformatted node, we set mode to SKIP_BALANCING and unlock
inode */
int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_inode, struct page *page, struct treepath *p_s_path, /* path to the indirect item. */
const struct cpu_key *p_s_item_key, /* Key to look for unformatted node pointer to be cut. */
int indirect2direct(struct reiserfs_transaction_handle *th,
struct inode *inode, struct page *page,
struct treepath *path, /* path to the indirect item. */
const struct cpu_key *item_key, /* Key to look for
* unformatted node
* pointer to be cut. */
loff_t n_new_file_size, /* New file size. */
char *p_c_mode)
char *mode)
{
struct super_block *p_s_sb = p_s_inode->i_sb;
struct super_block *sb = inode->i_sb;
struct item_head s_ih;
unsigned long n_block_size = p_s_sb->s_blocksize;
unsigned long block_size = sb->s_blocksize;
char *tail;
int tail_len, round_tail_len;
loff_t pos, pos1; /* position of first byte of the tail */
@ -186,22 +189,22 @@ int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_in
BUG_ON(!th->t_trans_id);
REISERFS_SB(p_s_sb)->s_indirect2direct++;
REISERFS_SB(sb)->s_indirect2direct++;
*p_c_mode = M_SKIP_BALANCING;
*mode = M_SKIP_BALANCING;
/* store item head path points to. */
copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path));
copy_item_head(&s_ih, PATH_PITEM_HEAD(path));
tail_len = (n_new_file_size & (n_block_size - 1));
if (get_inode_sd_version(p_s_inode) == STAT_DATA_V2)
tail_len = (n_new_file_size & (block_size - 1));
if (get_inode_sd_version(inode) == STAT_DATA_V2)
round_tail_len = ROUND_UP(tail_len);
else
round_tail_len = tail_len;
pos =
le_ih_k_offset(&s_ih) - 1 + (ih_item_len(&s_ih) / UNFM_P_SIZE -
1) * p_s_sb->s_blocksize;
1) * sb->s_blocksize;
pos1 = pos;
// we are protected by i_mutex. The tail can not disapper, not
@ -210,27 +213,26 @@ int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_in
tail = (char *)kmap(page); /* this can schedule */
if (path_changed(&s_ih, p_s_path)) {
if (path_changed(&s_ih, path)) {
/* re-search indirect item */
if (search_for_position_by_key(p_s_sb, p_s_item_key, p_s_path)
if (search_for_position_by_key(sb, item_key, path)
== POSITION_NOT_FOUND)
reiserfs_panic(p_s_sb,
"PAP-5520: indirect2direct: "
reiserfs_panic(sb, "PAP-5520",
"item to be converted %K does not exist",
p_s_item_key);
copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path));
item_key);
copy_item_head(&s_ih, PATH_PITEM_HEAD(path));
#ifdef CONFIG_REISERFS_CHECK
pos = le_ih_k_offset(&s_ih) - 1 +
(ih_item_len(&s_ih) / UNFM_P_SIZE -
1) * p_s_sb->s_blocksize;
1) * sb->s_blocksize;
if (pos != pos1)
reiserfs_panic(p_s_sb, "vs-5530: indirect2direct: "
"tail position changed while we were reading it");
reiserfs_panic(sb, "vs-5530", "tail position "
"changed while we were reading it");
#endif
}
/* Set direct item header to insert. */
make_le_item_head(&s_ih, NULL, get_inode_item_key_version(p_s_inode),
make_le_item_head(&s_ih, NULL, get_inode_item_key_version(inode),
pos1 + 1, TYPE_DIRECT, round_tail_len,
0xffff /*ih_free_space */ );
@ -240,13 +242,13 @@ int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_in
*/
tail = tail + (pos & (PAGE_CACHE_SIZE - 1));
PATH_LAST_POSITION(p_s_path)++;
PATH_LAST_POSITION(path)++;
key = *p_s_item_key;
key = *item_key;
set_cpu_key_k_type(&key, TYPE_DIRECT);
key.key_length = 4;
/* Insert tail as new direct item in the tree */
if (reiserfs_insert_item(th, p_s_path, &key, &s_ih, p_s_inode,
if (reiserfs_insert_item(th, path, &key, &s_ih, inode,
tail ? tail : NULL) < 0) {
/* No disk memory. So we can not convert last unformatted node
to the direct item. In this case we used to adjust
@ -255,12 +257,12 @@ int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_in
unformatted node. For now i_size is considered as guard for
going out of file size */
kunmap(page);
return n_block_size - round_tail_len;
return block_size - round_tail_len;
}
kunmap(page);
/* make sure to get the i_blocks changes from reiserfs_insert_item */
reiserfs_update_sd(th, p_s_inode);
reiserfs_update_sd(th, inode);
// note: we have now the same as in above direct2indirect
// conversion: there are two keys which have matching first three
@ -268,11 +270,11 @@ int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_in
/* We have inserted new direct item and must remove last
unformatted node. */
*p_c_mode = M_CUT;
*mode = M_CUT;
/* we store position of first direct item in the in-core inode */
//mark_file_with_tail (p_s_inode, pos1 + 1);
REISERFS_I(p_s_inode)->i_first_direct_byte = pos1 + 1;
/* mark_file_with_tail (inode, pos1 + 1); */
REISERFS_I(inode)->i_first_direct_byte = pos1 + 1;
return n_block_size - round_tail_len;
return block_size - round_tail_len;
}

File diff suppressed because it is too large Load Diff

View File

@ -10,15 +10,17 @@
#include <linux/reiserfs_acl.h>
#include <asm/uaccess.h>
static int reiserfs_set_acl(struct inode *inode, int type,
static int reiserfs_set_acl(struct reiserfs_transaction_handle *th,
struct inode *inode, int type,
struct posix_acl *acl);
static int
xattr_set_acl(struct inode *inode, int type, const void *value, size_t size)
{
struct posix_acl *acl;
int error;
int error, error2;
struct reiserfs_transaction_handle th;
size_t jcreate_blocks;
if (!reiserfs_posixacl(inode->i_sb))
return -EOPNOTSUPP;
if (!is_owner_or_cap(inode))
@ -36,7 +38,21 @@ xattr_set_acl(struct inode *inode, int type, const void *value, size_t size)
} else
acl = NULL;
error = reiserfs_set_acl(inode, type, acl);
/* Pessimism: We can't assume that anything from the xattr root up
* has been created. */
jcreate_blocks = reiserfs_xattr_jcreate_nblocks(inode) +
reiserfs_xattr_nblocks(inode, size) * 2;
reiserfs_write_lock(inode->i_sb);
error = journal_begin(&th, inode->i_sb, jcreate_blocks);
if (error == 0) {
error = reiserfs_set_acl(&th, inode, type, acl);
error2 = journal_end(&th, inode->i_sb, jcreate_blocks);
if (error2)
error = error2;
}
reiserfs_write_unlock(inode->i_sb);
release_and_out:
posix_acl_release(acl);
@ -172,6 +188,29 @@ static void *posix_acl_to_disk(const struct posix_acl *acl, size_t * size)
return ERR_PTR(-EINVAL);
}
static inline void iset_acl(struct inode *inode, struct posix_acl **i_acl,
struct posix_acl *acl)
{
spin_lock(&inode->i_lock);
if (*i_acl != ERR_PTR(-ENODATA))
posix_acl_release(*i_acl);
*i_acl = posix_acl_dup(acl);
spin_unlock(&inode->i_lock);
}
static inline struct posix_acl *iget_acl(struct inode *inode,
struct posix_acl **i_acl)
{
struct posix_acl *acl = ERR_PTR(-ENODATA);
spin_lock(&inode->i_lock);
if (*i_acl != ERR_PTR(-ENODATA))
acl = posix_acl_dup(*i_acl);
spin_unlock(&inode->i_lock);
return acl;
}
/*
* Inode operation get_posix_acl().
*
@ -199,11 +238,11 @@ struct posix_acl *reiserfs_get_acl(struct inode *inode, int type)
return ERR_PTR(-EINVAL);
}
if (IS_ERR(*p_acl)) {
if (PTR_ERR(*p_acl) == -ENODATA)
return NULL;
} else if (*p_acl != NULL)
return posix_acl_dup(*p_acl);
acl = iget_acl(inode, p_acl);
if (acl && !IS_ERR(acl))
return acl;
else if (PTR_ERR(acl) == -ENODATA)
return NULL;
size = reiserfs_xattr_get(inode, name, NULL, 0);
if (size < 0) {
@ -229,7 +268,7 @@ struct posix_acl *reiserfs_get_acl(struct inode *inode, int type)
} else {
acl = posix_acl_from_disk(value, retval);
if (!IS_ERR(acl))
*p_acl = posix_acl_dup(acl);
iset_acl(inode, p_acl, acl);
}
kfree(value);
@ -243,12 +282,13 @@ struct posix_acl *reiserfs_get_acl(struct inode *inode, int type)
* BKL held [before 2.5.x]
*/
static int
reiserfs_set_acl(struct inode *inode, int type, struct posix_acl *acl)
reiserfs_set_acl(struct reiserfs_transaction_handle *th, struct inode *inode,
int type, struct posix_acl *acl)
{
char *name;
void *value = NULL;
struct posix_acl **p_acl;
size_t size;
size_t size = 0;
int error;
struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode);
@ -285,31 +325,28 @@ reiserfs_set_acl(struct inode *inode, int type, struct posix_acl *acl)
value = posix_acl_to_disk(acl, &size);
if (IS_ERR(value))
return (int)PTR_ERR(value);
error = reiserfs_xattr_set(inode, name, value, size, 0);
} else {
error = reiserfs_xattr_del(inode, name);
if (error == -ENODATA) {
/* This may seem odd here, but it means that the ACL was set
* with a value representable with mode bits. If there was
* an ACL before, reiserfs_xattr_del already dirtied the inode.
*/
}
error = reiserfs_xattr_set_handle(th, inode, name, value, size, 0);
/*
* Ensure that the inode gets dirtied if we're only using
* the mode bits and an old ACL didn't exist. We don't need
* to check if the inode is hashed here since we won't get
* called by reiserfs_inherit_default_acl().
*/
if (error == -ENODATA) {
error = 0;
if (type == ACL_TYPE_ACCESS) {
inode->i_ctime = CURRENT_TIME_SEC;
mark_inode_dirty(inode);
error = 0;
}
}
kfree(value);
if (!error) {
/* Release the old one */
if (!IS_ERR(*p_acl) && *p_acl)
posix_acl_release(*p_acl);
if (acl == NULL)
*p_acl = ERR_PTR(-ENODATA);
else
*p_acl = posix_acl_dup(acl);
}
if (!error)
iset_acl(inode, p_acl, acl);
return error;
}
@ -317,7 +354,8 @@ reiserfs_set_acl(struct inode *inode, int type, struct posix_acl *acl)
/* dir->i_mutex: locked,
* inode is new and not released into the wild yet */
int
reiserfs_inherit_default_acl(struct inode *dir, struct dentry *dentry,
reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th,
struct inode *dir, struct dentry *dentry,
struct inode *inode)
{
struct posix_acl *acl;
@ -335,8 +373,8 @@ reiserfs_inherit_default_acl(struct inode *dir, struct dentry *dentry,
/* Don't apply ACLs to objects in the .reiserfs_priv tree.. This
* would be useless since permissions are ignored, and a pain because
* it introduces locking cycles */
if (is_reiserfs_priv_object(dir)) {
reiserfs_mark_inode_private(inode);
if (IS_PRIVATE(dir)) {
inode->i_flags |= S_PRIVATE;
goto apply_umask;
}
@ -354,7 +392,8 @@ reiserfs_inherit_default_acl(struct inode *dir, struct dentry *dentry,
/* Copy the default ACL to the default ACL of a new directory */
if (S_ISDIR(inode->i_mode)) {
err = reiserfs_set_acl(inode, ACL_TYPE_DEFAULT, acl);
err = reiserfs_set_acl(th, inode, ACL_TYPE_DEFAULT,
acl);
if (err)
goto cleanup;
}
@ -375,9 +414,9 @@ reiserfs_inherit_default_acl(struct inode *dir, struct dentry *dentry,
/* If we need an ACL.. */
if (need_acl > 0) {
err =
reiserfs_set_acl(inode, ACL_TYPE_ACCESS,
acl_copy);
err = reiserfs_set_acl(th, inode,
ACL_TYPE_ACCESS,
acl_copy);
if (err)
goto cleanup_copy;
}
@ -395,25 +434,45 @@ reiserfs_inherit_default_acl(struct inode *dir, struct dentry *dentry,
return err;
}
/* Looks up and caches the result of the default ACL.
* We do this so that we don't need to carry the xattr_sem into
* reiserfs_new_inode if we don't need to */
/* This is used to cache the default acl before a new object is created.
* The biggest reason for this is to get an idea of how many blocks will
* actually be required for the create operation if we must inherit an ACL.
* An ACL write can add up to 3 object creations and an additional file write
* so we'd prefer not to reserve that many blocks in the journal if we can.
* It also has the advantage of not loading the ACL with a transaction open,
* this may seem silly, but if the owner of the directory is doing the
* creation, the ACL may not be loaded since the permissions wouldn't require
* it.
* We return the number of blocks required for the transaction.
*/
int reiserfs_cache_default_acl(struct inode *inode)
{
int ret = 0;
if (reiserfs_posixacl(inode->i_sb) && !is_reiserfs_priv_object(inode)) {
struct posix_acl *acl;
reiserfs_read_lock_xattr_i(inode);
reiserfs_read_lock_xattrs(inode->i_sb);
acl = reiserfs_get_acl(inode, ACL_TYPE_DEFAULT);
reiserfs_read_unlock_xattrs(inode->i_sb);
reiserfs_read_unlock_xattr_i(inode);
ret = (acl && !IS_ERR(acl));
if (ret)
posix_acl_release(acl);
struct posix_acl *acl;
int nblocks = 0;
if (IS_PRIVATE(inode))
return 0;
acl = reiserfs_get_acl(inode, ACL_TYPE_DEFAULT);
if (acl && !IS_ERR(acl)) {
int size = reiserfs_acl_size(acl->a_count);
/* Other xattrs can be created during inode creation. We don't
* want to claim too many blocks, so we check to see if we
* we need to create the tree to the xattrs, and then we
* just want two files. */
nblocks = reiserfs_xattr_jcreate_nblocks(inode);
nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb);
REISERFS_I(inode)->i_flags |= i_has_xattr_dir;
/* We need to account for writes + bitmaps for two files */
nblocks += reiserfs_xattr_nblocks(inode, size) * 4;
posix_acl_release(acl);
}
return ret;
return nblocks;
}
int reiserfs_acl_chmod(struct inode *inode)
@ -429,9 +488,7 @@ int reiserfs_acl_chmod(struct inode *inode)
return 0;
}
reiserfs_read_lock_xattrs(inode->i_sb);
acl = reiserfs_get_acl(inode, ACL_TYPE_ACCESS);
reiserfs_read_unlock_xattrs(inode->i_sb);
if (!acl)
return 0;
if (IS_ERR(acl))
@ -442,18 +499,20 @@ int reiserfs_acl_chmod(struct inode *inode)
return -ENOMEM;
error = posix_acl_chmod_masq(clone, inode->i_mode);
if (!error) {
int lock = !has_xattr_dir(inode);
reiserfs_write_lock_xattr_i(inode);
if (lock)
reiserfs_write_lock_xattrs(inode->i_sb);
else
reiserfs_read_lock_xattrs(inode->i_sb);
error = reiserfs_set_acl(inode, ACL_TYPE_ACCESS, clone);
if (lock)
reiserfs_write_unlock_xattrs(inode->i_sb);
else
reiserfs_read_unlock_xattrs(inode->i_sb);
reiserfs_write_unlock_xattr_i(inode);
struct reiserfs_transaction_handle th;
size_t size = reiserfs_xattr_nblocks(inode,
reiserfs_acl_size(clone->a_count));
reiserfs_write_lock(inode->i_sb);
error = journal_begin(&th, inode->i_sb, size * 2);
if (!error) {
int error2;
error = reiserfs_set_acl(&th, inode, ACL_TYPE_ACCESS,
clone);
error2 = journal_end(&th, inode->i_sb, size * 2);
if (error2)
error = error2;
}
reiserfs_write_unlock(inode->i_sb);
}
posix_acl_release(clone);
return error;
@ -477,38 +536,22 @@ posix_acl_access_set(struct inode *inode, const char *name,
return xattr_set_acl(inode, ACL_TYPE_ACCESS, value, size);
}
static int posix_acl_access_del(struct inode *inode, const char *name)
static size_t posix_acl_access_list(struct inode *inode, char *list,
size_t list_size, const char *name,
size_t name_len)
{
struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode);
struct posix_acl **acl = &reiserfs_i->i_acl_access;
if (strlen(name) != sizeof(POSIX_ACL_XATTR_ACCESS) - 1)
return -EINVAL;
if (!IS_ERR(*acl) && *acl) {
posix_acl_release(*acl);
*acl = ERR_PTR(-ENODATA);
}
return 0;
}
static int
posix_acl_access_list(struct inode *inode, const char *name, int namelen,
char *out)
{
int len = namelen;
const size_t size = sizeof(POSIX_ACL_XATTR_ACCESS);
if (!reiserfs_posixacl(inode->i_sb))
return 0;
if (out)
memcpy(out, name, len);
return len;
if (list && size <= list_size)
memcpy(list, POSIX_ACL_XATTR_ACCESS, size);
return size;
}
struct reiserfs_xattr_handler posix_acl_access_handler = {
struct xattr_handler reiserfs_posix_acl_access_handler = {
.prefix = POSIX_ACL_XATTR_ACCESS,
.get = posix_acl_access_get,
.set = posix_acl_access_set,
.del = posix_acl_access_del,
.list = posix_acl_access_list,
};
@ -530,37 +573,21 @@ posix_acl_default_set(struct inode *inode, const char *name,
return xattr_set_acl(inode, ACL_TYPE_DEFAULT, value, size);
}
static int posix_acl_default_del(struct inode *inode, const char *name)
static size_t posix_acl_default_list(struct inode *inode, char *list,
size_t list_size, const char *name,
size_t name_len)
{
struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode);
struct posix_acl **acl = &reiserfs_i->i_acl_default;
if (strlen(name) != sizeof(POSIX_ACL_XATTR_DEFAULT) - 1)
return -EINVAL;
if (!IS_ERR(*acl) && *acl) {
posix_acl_release(*acl);
*acl = ERR_PTR(-ENODATA);
}
return 0;
}
static int
posix_acl_default_list(struct inode *inode, const char *name, int namelen,
char *out)
{
int len = namelen;
const size_t size = sizeof(POSIX_ACL_XATTR_DEFAULT);
if (!reiserfs_posixacl(inode->i_sb))
return 0;
if (out)
memcpy(out, name, len);
return len;
if (list && size <= list_size)
memcpy(list, POSIX_ACL_XATTR_DEFAULT, size);
return size;
}
struct reiserfs_xattr_handler posix_acl_default_handler = {
struct xattr_handler reiserfs_posix_acl_default_handler = {
.prefix = POSIX_ACL_XATTR_DEFAULT,
.get = posix_acl_default_get,
.set = posix_acl_default_set,
.del = posix_acl_default_del,
.list = posix_acl_default_list,
};

View File

@ -4,6 +4,7 @@
#include <linux/pagemap.h>
#include <linux/xattr.h>
#include <linux/reiserfs_xattr.h>
#include <linux/security.h>
#include <asm/uaccess.h>
static int
@ -12,7 +13,7 @@ security_get(struct inode *inode, const char *name, void *buffer, size_t size)
if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX))
return -EINVAL;
if (is_reiserfs_priv_object(inode))
if (IS_PRIVATE(inode))
return -EPERM;
return reiserfs_xattr_get(inode, name, buffer, size);
@ -25,41 +26,84 @@ security_set(struct inode *inode, const char *name, const void *buffer,
if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX))
return -EINVAL;
if (is_reiserfs_priv_object(inode))
if (IS_PRIVATE(inode))
return -EPERM;
return reiserfs_xattr_set(inode, name, buffer, size, flags);
}
static int security_del(struct inode *inode, const char *name)
static size_t security_list(struct inode *inode, char *list, size_t list_len,
const char *name, size_t namelen)
{
if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX))
return -EINVAL;
const size_t len = namelen + 1;
if (is_reiserfs_priv_object(inode))
return -EPERM;
return 0;
}
static int
security_list(struct inode *inode, const char *name, int namelen, char *out)
{
int len = namelen;
if (is_reiserfs_priv_object(inode))
if (IS_PRIVATE(inode))
return 0;
if (out)
memcpy(out, name, len);
if (list && len <= list_len) {
memcpy(list, name, namelen);
list[namelen] = '\0';
}
return len;
}
struct reiserfs_xattr_handler security_handler = {
/* Initializes the security context for a new inode and returns the number
* of blocks needed for the transaction. If successful, reiserfs_security
* must be released using reiserfs_security_free when the caller is done. */
int reiserfs_security_init(struct inode *dir, struct inode *inode,
struct reiserfs_security_handle *sec)
{
int blocks = 0;
int error = security_inode_init_security(inode, dir, &sec->name,
&sec->value, &sec->length);
if (error) {
if (error == -EOPNOTSUPP)
error = 0;
sec->name = NULL;
sec->value = NULL;
sec->length = 0;
return error;
}
if (sec->length) {
blocks = reiserfs_xattr_jcreate_nblocks(inode) +
reiserfs_xattr_nblocks(inode, sec->length);
/* We don't want to count the directories twice if we have
* a default ACL. */
REISERFS_I(inode)->i_flags |= i_has_xattr_dir;
}
return blocks;
}
int reiserfs_security_write(struct reiserfs_transaction_handle *th,
struct inode *inode,
struct reiserfs_security_handle *sec)
{
int error;
if (strlen(sec->name) < sizeof(XATTR_SECURITY_PREFIX))
return -EINVAL;
error = reiserfs_xattr_set_handle(th, inode, sec->name, sec->value,
sec->length, XATTR_CREATE);
if (error == -ENODATA || error == -EOPNOTSUPP)
error = 0;
return error;
}
void reiserfs_security_free(struct reiserfs_security_handle *sec)
{
kfree(sec->name);
kfree(sec->value);
sec->name = NULL;
sec->value = NULL;
}
struct xattr_handler reiserfs_xattr_security_handler = {
.prefix = XATTR_SECURITY_PREFIX,
.get = security_get,
.set = security_set,
.del = security_del,
.list = security_list,
};

View File

@ -13,10 +13,7 @@ trusted_get(struct inode *inode, const char *name, void *buffer, size_t size)
if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
return -EINVAL;
if (!reiserfs_xattrs(inode->i_sb))
return -EOPNOTSUPP;
if (!(capable(CAP_SYS_ADMIN) || is_reiserfs_priv_object(inode)))
if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(inode))
return -EPERM;
return reiserfs_xattr_get(inode, name, buffer, size);
@ -29,50 +26,30 @@ trusted_set(struct inode *inode, const char *name, const void *buffer,
if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
return -EINVAL;
if (!reiserfs_xattrs(inode->i_sb))
return -EOPNOTSUPP;
if (!(capable(CAP_SYS_ADMIN) || is_reiserfs_priv_object(inode)))
if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(inode))
return -EPERM;
return reiserfs_xattr_set(inode, name, buffer, size, flags);
}
static int trusted_del(struct inode *inode, const char *name)
static size_t trusted_list(struct inode *inode, char *list, size_t list_size,
const char *name, size_t name_len)
{
if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
return -EINVAL;
const size_t len = name_len + 1;
if (!reiserfs_xattrs(inode->i_sb))
return -EOPNOTSUPP;
if (!(capable(CAP_SYS_ADMIN) || is_reiserfs_priv_object(inode)))
return -EPERM;
return 0;
}
static int
trusted_list(struct inode *inode, const char *name, int namelen, char *out)
{
int len = namelen;
if (!reiserfs_xattrs(inode->i_sb))
if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(inode))
return 0;
if (!(capable(CAP_SYS_ADMIN) || is_reiserfs_priv_object(inode)))
return 0;
if (out)
memcpy(out, name, len);
if (list && len <= list_size) {
memcpy(list, name, name_len);
list[name_len] = '\0';
}
return len;
}
struct reiserfs_xattr_handler trusted_handler = {
struct xattr_handler reiserfs_xattr_trusted_handler = {
.prefix = XATTR_TRUSTED_PREFIX,
.get = trusted_get,
.set = trusted_set,
.del = trusted_del,
.list = trusted_list,
};

View File

@ -6,10 +6,6 @@
#include <linux/reiserfs_xattr.h>
#include <asm/uaccess.h>
#ifdef CONFIG_REISERFS_FS_POSIX_ACL
# include <linux/reiserfs_acl.h>
#endif
static int
user_get(struct inode *inode, const char *name, void *buffer, size_t size)
{
@ -25,7 +21,6 @@ static int
user_set(struct inode *inode, const char *name, const void *buffer,
size_t size, int flags)
{
if (strlen(name) < sizeof(XATTR_USER_PREFIX))
return -EINVAL;
@ -34,33 +29,23 @@ user_set(struct inode *inode, const char *name, const void *buffer,
return reiserfs_xattr_set(inode, name, buffer, size, flags);
}
static int user_del(struct inode *inode, const char *name)
static size_t user_list(struct inode *inode, char *list, size_t list_size,
const char *name, size_t name_len)
{
if (strlen(name) < sizeof(XATTR_USER_PREFIX))
return -EINVAL;
const size_t len = name_len + 1;
if (!reiserfs_xattrs_user(inode->i_sb))
return -EOPNOTSUPP;
return 0;
}
static int
user_list(struct inode *inode, const char *name, int namelen, char *out)
{
int len = namelen;
if (!reiserfs_xattrs_user(inode->i_sb))
return 0;
if (out)
memcpy(out, name, len);
if (list && len <= list_size) {
memcpy(list, name, name_len);
list[name_len] = '\0';
}
return len;
}
struct reiserfs_xattr_handler user_handler = {
struct xattr_handler reiserfs_xattr_user_handler = {
.prefix = XATTR_USER_PREFIX,
.get = user_get,
.set = user_set,
.del = user_del,
.list = user_list,
};

View File

@ -49,13 +49,12 @@ static inline int reiserfs_acl_count(size_t size)
#ifdef CONFIG_REISERFS_FS_POSIX_ACL
struct posix_acl *reiserfs_get_acl(struct inode *inode, int type);
int reiserfs_acl_chmod(struct inode *inode);
int reiserfs_inherit_default_acl(struct inode *dir, struct dentry *dentry,
int reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th,
struct inode *dir, struct dentry *dentry,
struct inode *inode);
int reiserfs_cache_default_acl(struct inode *dir);
extern int reiserfs_xattr_posix_acl_init(void) __init;
extern int reiserfs_xattr_posix_acl_exit(void);
extern struct reiserfs_xattr_handler posix_acl_default_handler;
extern struct reiserfs_xattr_handler posix_acl_access_handler;
extern struct xattr_handler reiserfs_posix_acl_default_handler;
extern struct xattr_handler reiserfs_posix_acl_access_handler;
static inline void reiserfs_init_acl_access(struct inode *inode)
{
@ -75,16 +74,6 @@ static inline struct posix_acl *reiserfs_get_acl(struct inode *inode, int type)
return NULL;
}
static inline int reiserfs_xattr_posix_acl_init(void)
{
return 0;
}
static inline int reiserfs_xattr_posix_acl_exit(void)
{
return 0;
}
static inline int reiserfs_acl_chmod(struct inode *inode)
{
return 0;

View File

@ -58,8 +58,6 @@
#define reiserfs_write_lock( sb ) lock_kernel()
#define reiserfs_write_unlock( sb ) unlock_kernel()
/* xattr stuff */
#define REISERFS_XATTR_DIR_SEM(s) (REISERFS_SB(s)->xattr_dir_sem)
struct fid;
/* in reading the #defines, it may help to understand that they employ
@ -104,15 +102,21 @@ struct fid;
*/
#define REISERFS_DEBUG_CODE 5 /* extra messages to help find/debug errors */
void reiserfs_warning(struct super_block *s, const char *fmt, ...);
void __reiserfs_warning(struct super_block *s, const char *id,
const char *func, const char *fmt, ...);
#define reiserfs_warning(s, id, fmt, args...) \
__reiserfs_warning(s, id, __func__, fmt, ##args)
/* assertions handling */
/** always check a condition and panic if it's false. */
#define __RASSERT( cond, scond, format, args... ) \
if( !( cond ) ) \
reiserfs_panic( NULL, "reiserfs[%i]: assertion " scond " failed at " \
__FILE__ ":%i:%s: " format "\n", \
in_interrupt() ? -1 : task_pid_nr(current), __LINE__ , __func__ , ##args )
#define __RASSERT(cond, scond, format, args...) \
do { \
if (!(cond)) \
reiserfs_panic(NULL, "assertion failure", "(" #cond ") at " \
__FILE__ ":%i:%s: " format "\n", \
in_interrupt() ? -1 : task_pid_nr(current), \
__LINE__, __func__ , ##args); \
} while (0)
#define RASSERT(cond, format, args...) __RASSERT(cond, #cond, format, ##args)
@ -196,7 +200,11 @@ struct reiserfs_super_block {
__le32 s_flags; /* Right now used only by inode-attributes, if enabled */
unsigned char s_uuid[16]; /* filesystem unique identifier */
unsigned char s_label[16]; /* filesystem volume label */
char s_unused[88]; /* zero filled by mkreiserfs and
__le16 s_mnt_count; /* Count of mounts since last fsck */
__le16 s_max_mnt_count; /* Maximum mounts before check */
__le32 s_lastcheck; /* Timestamp of last fsck */
__le32 s_check_interval; /* Interval between checks */
char s_unused[76]; /* zero filled by mkreiserfs and
* reiserfs_convert_objectid_map_v1()
* so any additions must be updated
* there as well. */
@ -578,10 +586,8 @@ static inline int uniqueness2type(__u32 uniqueness)
return TYPE_DIRECT;
case V1_DIRENTRY_UNIQUENESS:
return TYPE_DIRENTRY;
default:
reiserfs_warning(NULL, "vs-500: unknown uniqueness %d",
uniqueness);
case V1_ANY_UNIQUENESS:
default:
return TYPE_ANY;
}
}
@ -598,9 +604,8 @@ static inline __u32 type2uniqueness(int type)
return V1_DIRECT_UNIQUENESS;
case TYPE_DIRENTRY:
return V1_DIRENTRY_UNIQUENESS;
default:
reiserfs_warning(NULL, "vs-501: unknown type %d", type);
case TYPE_ANY:
default:
return V1_ANY_UNIQUENESS;
}
}
@ -712,9 +717,9 @@ static inline void cpu_key_k_offset_dec(struct cpu_key *key)
#define is_indirect_cpu_ih(ih) (is_indirect_cpu_key (&((ih)->ih_key)))
#define is_statdata_cpu_ih(ih) (is_statdata_cpu_key (&((ih)->ih_key)))
#define I_K_KEY_IN_ITEM(p_s_ih, p_s_key, n_blocksize) \
( ! COMP_SHORT_KEYS(p_s_ih, p_s_key) && \
I_OFF_BYTE_IN_ITEM(p_s_ih, k_offset (p_s_key), n_blocksize) )
#define I_K_KEY_IN_ITEM(ih, key, n_blocksize) \
(!COMP_SHORT_KEYS(ih, key) && \
I_OFF_BYTE_IN_ITEM(ih, k_offset(key), n_blocksize))
/* maximal length of item */
#define MAX_ITEM_LEN(block_size) (block_size - BLKH_SIZE - IH_SIZE)
@ -770,25 +775,25 @@ struct block_head {
#define DISK_LEAF_NODE_LEVEL 1 /* Leaf node level. */
/* Given the buffer head of a formatted node, resolve to the block head of that node. */
#define B_BLK_HEAD(p_s_bh) ((struct block_head *)((p_s_bh)->b_data))
#define B_BLK_HEAD(bh) ((struct block_head *)((bh)->b_data))
/* Number of items that are in buffer. */
#define B_NR_ITEMS(p_s_bh) (blkh_nr_item(B_BLK_HEAD(p_s_bh)))
#define B_LEVEL(p_s_bh) (blkh_level(B_BLK_HEAD(p_s_bh)))
#define B_FREE_SPACE(p_s_bh) (blkh_free_space(B_BLK_HEAD(p_s_bh)))
#define B_NR_ITEMS(bh) (blkh_nr_item(B_BLK_HEAD(bh)))
#define B_LEVEL(bh) (blkh_level(B_BLK_HEAD(bh)))
#define B_FREE_SPACE(bh) (blkh_free_space(B_BLK_HEAD(bh)))
#define PUT_B_NR_ITEMS(p_s_bh,val) do { set_blkh_nr_item(B_BLK_HEAD(p_s_bh),val); } while (0)
#define PUT_B_LEVEL(p_s_bh,val) do { set_blkh_level(B_BLK_HEAD(p_s_bh),val); } while (0)
#define PUT_B_FREE_SPACE(p_s_bh,val) do { set_blkh_free_space(B_BLK_HEAD(p_s_bh),val); } while (0)
#define PUT_B_NR_ITEMS(bh, val) do { set_blkh_nr_item(B_BLK_HEAD(bh), val); } while (0)
#define PUT_B_LEVEL(bh, val) do { set_blkh_level(B_BLK_HEAD(bh), val); } while (0)
#define PUT_B_FREE_SPACE(bh, val) do { set_blkh_free_space(B_BLK_HEAD(bh), val); } while (0)
/* Get right delimiting key. -- little endian */
#define B_PRIGHT_DELIM_KEY(p_s_bh) (&(blk_right_delim_key(B_BLK_HEAD(p_s_bh))))
#define B_PRIGHT_DELIM_KEY(bh) (&(blk_right_delim_key(B_BLK_HEAD(bh))))
/* Does the buffer contain a disk leaf. */
#define B_IS_ITEMS_LEVEL(p_s_bh) (B_LEVEL(p_s_bh) == DISK_LEAF_NODE_LEVEL)
#define B_IS_ITEMS_LEVEL(bh) (B_LEVEL(bh) == DISK_LEAF_NODE_LEVEL)
/* Does the buffer contain a disk internal node */
#define B_IS_KEYS_LEVEL(p_s_bh) (B_LEVEL(p_s_bh) > DISK_LEAF_NODE_LEVEL \
&& B_LEVEL(p_s_bh) <= MAX_HEIGHT)
#define B_IS_KEYS_LEVEL(bh) (B_LEVEL(bh) > DISK_LEAF_NODE_LEVEL \
&& B_LEVEL(bh) <= MAX_HEIGHT)
/***************************************************************************/
/* STAT DATA */
@ -1138,12 +1143,13 @@ struct disk_child {
#define put_dc_size(dc_p, val) do { (dc_p)->dc_size = cpu_to_le16(val); } while(0)
/* Get disk child by buffer header and position in the tree node. */
#define B_N_CHILD(p_s_bh,n_pos) ((struct disk_child *)\
((p_s_bh)->b_data+BLKH_SIZE+B_NR_ITEMS(p_s_bh)*KEY_SIZE+DC_SIZE*(n_pos)))
#define B_N_CHILD(bh, n_pos) ((struct disk_child *)\
((bh)->b_data + BLKH_SIZE + B_NR_ITEMS(bh) * KEY_SIZE + DC_SIZE * (n_pos)))
/* Get disk child number by buffer header and position in the tree node. */
#define B_N_CHILD_NUM(p_s_bh,n_pos) (dc_block_number(B_N_CHILD(p_s_bh,n_pos)))
#define PUT_B_N_CHILD_NUM(p_s_bh,n_pos, val) (put_dc_block_number(B_N_CHILD(p_s_bh,n_pos), val ))
#define B_N_CHILD_NUM(bh, n_pos) (dc_block_number(B_N_CHILD(bh, n_pos)))
#define PUT_B_N_CHILD_NUM(bh, n_pos, val) \
(put_dc_block_number(B_N_CHILD(bh, n_pos), val))
/* maximal value of field child_size in structure disk_child */
/* child size is the combined size of all items and their headers */
@ -1214,33 +1220,33 @@ struct treepath {
struct treepath var = {.path_length = ILLEGAL_PATH_ELEMENT_OFFSET, .reada = 0,}
/* Get path element by path and path position. */
#define PATH_OFFSET_PELEMENT(p_s_path,n_offset) ((p_s_path)->path_elements +(n_offset))
#define PATH_OFFSET_PELEMENT(path, n_offset) ((path)->path_elements + (n_offset))
/* Get buffer header at the path by path and path position. */
#define PATH_OFFSET_PBUFFER(p_s_path,n_offset) (PATH_OFFSET_PELEMENT(p_s_path,n_offset)->pe_buffer)
#define PATH_OFFSET_PBUFFER(path, n_offset) (PATH_OFFSET_PELEMENT(path, n_offset)->pe_buffer)
/* Get position in the element at the path by path and path position. */
#define PATH_OFFSET_POSITION(p_s_path,n_offset) (PATH_OFFSET_PELEMENT(p_s_path,n_offset)->pe_position)
#define PATH_OFFSET_POSITION(path, n_offset) (PATH_OFFSET_PELEMENT(path, n_offset)->pe_position)
#define PATH_PLAST_BUFFER(p_s_path) (PATH_OFFSET_PBUFFER((p_s_path), (p_s_path)->path_length))
#define PATH_PLAST_BUFFER(path) (PATH_OFFSET_PBUFFER((path), (path)->path_length))
/* you know, to the person who didn't
write this the macro name does not
at first suggest what it does.
Maybe POSITION_FROM_PATH_END? Or
maybe we should just focus on
dumping paths... -Hans */
#define PATH_LAST_POSITION(p_s_path) (PATH_OFFSET_POSITION((p_s_path), (p_s_path)->path_length))
#define PATH_LAST_POSITION(path) (PATH_OFFSET_POSITION((path), (path)->path_length))
#define PATH_PITEM_HEAD(p_s_path) B_N_PITEM_HEAD(PATH_PLAST_BUFFER(p_s_path),PATH_LAST_POSITION(p_s_path))
#define PATH_PITEM_HEAD(path) B_N_PITEM_HEAD(PATH_PLAST_BUFFER(path), PATH_LAST_POSITION(path))
/* in do_balance leaf has h == 0 in contrast with path structure,
where root has level == 0. That is why we need these defines */
#define PATH_H_PBUFFER(p_s_path, h) PATH_OFFSET_PBUFFER (p_s_path, p_s_path->path_length - (h)) /* tb->S[h] */
#define PATH_H_PBUFFER(path, h) PATH_OFFSET_PBUFFER (path, path->path_length - (h)) /* tb->S[h] */
#define PATH_H_PPARENT(path, h) PATH_H_PBUFFER (path, (h) + 1) /* tb->F[h] or tb->S[0]->b_parent */
#define PATH_H_POSITION(path, h) PATH_OFFSET_POSITION (path, path->path_length - (h))
#define PATH_H_B_ITEM_ORDER(path, h) PATH_H_POSITION(path, h + 1) /* tb->S[h]->b_item_order */
#define PATH_H_PATH_OFFSET(p_s_path, n_h) ((p_s_path)->path_length - (n_h))
#define PATH_H_PATH_OFFSET(path, n_h) ((path)->path_length - (n_h))
#define get_last_bh(path) PATH_PLAST_BUFFER(path)
#define get_ih(path) PATH_PITEM_HEAD(path)
@ -1470,6 +1476,16 @@ struct buffer_info {
int bi_position;
};
static inline struct super_block *sb_from_tb(struct tree_balance *tb)
{
return tb ? tb->tb_sb : NULL;
}
static inline struct super_block *sb_from_bi(struct buffer_info *bi)
{
return bi ? sb_from_tb(bi->tb) : NULL;
}
/* there are 4 types of items: stat data, directory item, indirect, direct.
+-------------------+------------+--------------+------------+
| | k_offset | k_uniqueness | mergeable? |
@ -1520,7 +1536,7 @@ extern struct item_operations *item_ops[TYPE_ANY + 1];
#define COMP_SHORT_KEYS comp_short_keys
/* number of blocks pointed to by the indirect item */
#define I_UNFM_NUM(p_s_ih) ( ih_item_len(p_s_ih) / UNFM_P_SIZE )
#define I_UNFM_NUM(ih) (ih_item_len(ih) / UNFM_P_SIZE)
/* the used space within the unformatted node corresponding to pos within the item pointed to by ih */
#define I_POS_UNFM_SIZE(ih,pos,size) (((pos) == I_UNFM_NUM(ih) - 1 ) ? (size) - ih_free_space(ih) : (size))
@ -1623,6 +1639,10 @@ struct reiserfs_journal_header {
#define JOURNAL_MAX_COMMIT_AGE 30
#define JOURNAL_MAX_TRANS_AGE 30
#define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9)
#define JOURNAL_BLOCKS_PER_OBJECT(sb) (JOURNAL_PER_BALANCE_CNT * 3 + \
2 * (REISERFS_QUOTA_INIT_BLOCKS(sb) + \
REISERFS_QUOTA_TRANS_BLOCKS(sb)))
#ifdef CONFIG_QUOTA
/* We need to update data and inode (atime) */
#define REISERFS_QUOTA_TRANS_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? 2 : 0)
@ -1697,7 +1717,7 @@ struct reiserfs_transaction_handle {
int t_refcount;
int t_blocks_logged; /* number of blocks this writer has logged */
int t_blocks_allocated; /* number of blocks this writer allocated */
unsigned long t_trans_id; /* sanity check, equals the current trans id */
unsigned int t_trans_id; /* sanity check, equals the current trans id */
void *t_handle_save; /* save existing current->journal_info */
unsigned displace_new_blocks:1; /* if new block allocation occurres, that block
should be displaced from others */
@ -1773,13 +1793,13 @@ int journal_end_sync(struct reiserfs_transaction_handle *, struct super_block *,
int journal_mark_freed(struct reiserfs_transaction_handle *,
struct super_block *, b_blocknr_t blocknr);
int journal_transaction_should_end(struct reiserfs_transaction_handle *, int);
int reiserfs_in_journal(struct super_block *p_s_sb, unsigned int bmap_nr,
int bit_nr, int searchall, b_blocknr_t *next);
int reiserfs_in_journal(struct super_block *sb, unsigned int bmap_nr,
int bit_nr, int searchall, b_blocknr_t *next);
int journal_begin(struct reiserfs_transaction_handle *,
struct super_block *p_s_sb, unsigned long);
struct super_block *sb, unsigned long);
int journal_join_abort(struct reiserfs_transaction_handle *,
struct super_block *p_s_sb, unsigned long);
void reiserfs_journal_abort(struct super_block *sb, int errno);
struct super_block *sb, unsigned long);
void reiserfs_abort_journal(struct super_block *sb, int errno);
void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...);
int reiserfs_allocate_list_bitmaps(struct super_block *s,
struct reiserfs_list_bitmap *, unsigned int);
@ -1796,8 +1816,8 @@ int reiserfs_convert_objectid_map_v1(struct super_block *);
/* stree.c */
int B_IS_IN_TREE(const struct buffer_head *);
extern void copy_item_head(struct item_head *p_v_to,
const struct item_head *p_v_from);
extern void copy_item_head(struct item_head *to,
const struct item_head *from);
// first key is in cpu form, second - le
extern int comp_short_keys(const struct reiserfs_key *le_key,
@ -1832,20 +1852,20 @@ static inline void copy_key(struct reiserfs_key *to,
memcpy(to, from, KEY_SIZE);
}
int comp_items(const struct item_head *stored_ih, const struct treepath *p_s_path);
const struct reiserfs_key *get_rkey(const struct treepath *p_s_chk_path,
const struct super_block *p_s_sb);
int comp_items(const struct item_head *stored_ih, const struct treepath *path);
const struct reiserfs_key *get_rkey(const struct treepath *chk_path,
const struct super_block *sb);
int search_by_key(struct super_block *, const struct cpu_key *,
struct treepath *, int);
#define search_item(s,key,path) search_by_key (s, key, path, DISK_LEAF_NODE_LEVEL)
int search_for_position_by_key(struct super_block *p_s_sb,
const struct cpu_key *p_s_cpu_key,
struct treepath *p_s_search_path);
extern void decrement_bcount(struct buffer_head *p_s_bh);
void decrement_counters_in_path(struct treepath *p_s_search_path);
void pathrelse(struct treepath *p_s_search_path);
int search_for_position_by_key(struct super_block *sb,
const struct cpu_key *cpu_key,
struct treepath *search_path);
extern void decrement_bcount(struct buffer_head *bh);
void decrement_counters_in_path(struct treepath *search_path);
void pathrelse(struct treepath *search_path);
int reiserfs_check_path(struct treepath *p);
void pathrelse_and_restore(struct super_block *s, struct treepath *p_s_search_path);
void pathrelse_and_restore(struct super_block *s, struct treepath *search_path);
int reiserfs_insert_item(struct reiserfs_transaction_handle *th,
struct treepath *path,
@ -1868,14 +1888,14 @@ int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th,
int reiserfs_delete_item(struct reiserfs_transaction_handle *th,
struct treepath *path,
const struct cpu_key *key,
struct inode *inode, struct buffer_head *p_s_un_bh);
struct inode *inode, struct buffer_head *un_bh);
void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th,
struct inode *inode, struct reiserfs_key *key);
int reiserfs_delete_object(struct reiserfs_transaction_handle *th,
struct inode *p_s_inode);
struct inode *inode);
int reiserfs_do_truncate(struct reiserfs_transaction_handle *th,
struct inode *p_s_inode, struct page *,
struct inode *inode, struct page *,
int update_timestamps);
#define i_block_size(inode) ((inode)->i_sb->s_blocksize)
@ -1919,10 +1939,12 @@ void make_le_item_head(struct item_head *ih, const struct cpu_key *key,
loff_t offset, int type, int length, int entry_count);
struct inode *reiserfs_iget(struct super_block *s, const struct cpu_key *key);
struct reiserfs_security_handle;
int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
struct inode *dir, int mode,
const char *symname, loff_t i_size,
struct dentry *dentry, struct inode *inode);
struct dentry *dentry, struct inode *inode,
struct reiserfs_security_handle *security);
void reiserfs_update_sd_size(struct reiserfs_transaction_handle *th,
struct inode *inode, loff_t size);
@ -1980,7 +2002,7 @@ int reiserfs_global_version_in_proc(char *buffer, char **start, off_t offset,
#define PROC_INFO_MAX( sb, field, value ) VOID_V
#define PROC_INFO_INC( sb, field ) VOID_V
#define PROC_INFO_ADD( sb, field, val ) VOID_V
#define PROC_INFO_BH_STAT( p_s_sb, p_s_bh, n_node_level ) VOID_V
#define PROC_INFO_BH_STAT(sb, bh, n_node_level) VOID_V
#endif
/* dir.c */
@ -1988,6 +2010,7 @@ extern const struct inode_operations reiserfs_dir_inode_operations;
extern const struct inode_operations reiserfs_symlink_inode_operations;
extern const struct inode_operations reiserfs_special_inode_operations;
extern const struct file_operations reiserfs_dir_operations;
int reiserfs_readdir_dentry(struct dentry *, void *, filldir_t, loff_t *);
/* tail_conversion.c */
int direct2indirect(struct reiserfs_transaction_handle *, struct inode *,
@ -2004,13 +2027,20 @@ extern const struct address_space_operations reiserfs_address_space_operations;
/* fix_nodes.c */
int fix_nodes(int n_op_mode, struct tree_balance *p_s_tb,
struct item_head *p_s_ins_ih, const void *);
int fix_nodes(int n_op_mode, struct tree_balance *tb,
struct item_head *ins_ih, const void *);
void unfix_nodes(struct tree_balance *);
/* prints.c */
void reiserfs_panic(struct super_block *s, const char *fmt, ...)
void __reiserfs_panic(struct super_block *s, const char *id,
const char *function, const char *fmt, ...)
__attribute__ ((noreturn));
#define reiserfs_panic(s, id, fmt, args...) \
__reiserfs_panic(s, id, __func__, fmt, ##args)
void __reiserfs_error(struct super_block *s, const char *id,
const char *function, const char *fmt, ...);
#define reiserfs_error(s, id, fmt, args...) \
__reiserfs_error(s, id, __func__, fmt, ##args)
void reiserfs_info(struct super_block *s, const char *fmt, ...);
void reiserfs_debug(struct super_block *s, int level, const char *fmt, ...);
void print_indirect_item(struct buffer_head *bh, int item_num);
@ -2047,7 +2077,7 @@ void leaf_paste_in_buffer(struct buffer_info *bi, int pasted_item_num,
int zeros_number);
void leaf_cut_from_buffer(struct buffer_info *bi, int cut_item_num,
int pos_in_item, int cut_size);
void leaf_paste_entries(struct buffer_head *bh, int item_num, int before,
void leaf_paste_entries(struct buffer_info *bi, int item_num, int before,
int new_entry_count, struct reiserfs_de_head *new_dehs,
const char *records, int paste_size);
/* ibalance.c */
@ -2203,6 +2233,6 @@ long reiserfs_compat_ioctl(struct file *filp,
unsigned int cmd, unsigned long arg);
int reiserfs_unpack(struct inode *inode, struct file *filp);
#endif /* __KERNEL__ */
#endif /* _LINUX_REISER_FS_H */

View File

@ -51,7 +51,7 @@ struct reiserfs_inode_info {
/* we use these for fsync or O_SYNC to decide which transaction
** needs to be committed in order for this inode to be properly
** flushed */
unsigned long i_trans_id;
unsigned int i_trans_id;
struct reiserfs_journal_list *i_jl;
struct mutex i_mmap;
#ifdef CONFIG_REISERFS_FS_POSIX_ACL
@ -59,7 +59,7 @@ struct reiserfs_inode_info {
struct posix_acl *i_acl_default;
#endif
#ifdef CONFIG_REISERFS_FS_XATTR
struct rw_semaphore xattr_sem;
struct rw_semaphore i_xattr_sem;
#endif
struct inode vfs_inode;
};

View File

@ -73,6 +73,9 @@ typedef enum {
#define sb_version(sbp) (le16_to_cpu((sbp)->s_v1.s_version))
#define set_sb_version(sbp,v) ((sbp)->s_v1.s_version = cpu_to_le16(v))
#define sb_mnt_count(sbp) (le16_to_cpu((sbp)->s_mnt_count))
#define set_sb_mnt_count(sbp, v) ((sbp)->s_mnt_count = cpu_to_le16(v))
#define sb_reserved_for_journal(sbp) \
(le16_to_cpu((sbp)->s_v1.s_reserved_for_journal))
#define set_sb_reserved_for_journal(sbp,v) \
@ -153,7 +156,7 @@ struct reiserfs_journal_list {
atomic_t j_commit_left;
atomic_t j_older_commits_done; /* all commits older than this on disk */
struct mutex j_commit_mutex;
unsigned long j_trans_id;
unsigned int j_trans_id;
time_t j_timestamp;
struct reiserfs_list_bitmap *j_list_bitmap;
struct buffer_head *j_commit_bh; /* commit buffer head */
@ -182,7 +185,7 @@ struct reiserfs_journal {
int j_1st_reserved_block; /* first block on s_dev of reserved area journal */
unsigned long j_state;
unsigned long j_trans_id;
unsigned int j_trans_id;
unsigned long j_mount_id;
unsigned long j_start; /* start of current waiting commit (index into j_ap_blocks) */
unsigned long j_len; /* length of current waiting commit */
@ -223,10 +226,10 @@ struct reiserfs_journal {
int j_num_work_lists; /* number that need attention from kreiserfsd */
/* debugging to make sure things are flushed in order */
int j_last_flush_id;
unsigned int j_last_flush_id;
/* debugging to make sure things are committed in order */
int j_last_commit_id;
unsigned int j_last_commit_id;
struct list_head j_bitmap_nodes;
struct list_head j_dirty_buffers;
@ -399,10 +402,7 @@ struct reiserfs_sb_info {
int reserved_blocks; /* amount of blocks reserved for further allocations */
spinlock_t bitmap_lock; /* this lock on now only used to protect reserved_blocks variable */
struct dentry *priv_root; /* root of /.reiserfs_priv */
#ifdef CONFIG_REISERFS_FS_XATTR
struct dentry *xattr_root; /* root of /.reiserfs_priv/.xa */
struct rw_semaphore xattr_dir_sem;
#endif
int j_errno;
#ifdef CONFIG_QUOTA
char *s_qf_names[MAXQUOTAS];
@ -451,7 +451,6 @@ enum reiserfs_mount_options {
REISERFS_NO_UNHASHED_RELOCATION,
REISERFS_HASHED_RELOCATION,
REISERFS_ATTRS,
REISERFS_XATTRS,
REISERFS_XATTRS_USER,
REISERFS_POSIXACL,
REISERFS_BARRIER_NONE,
@ -489,7 +488,7 @@ enum reiserfs_mount_options {
#define reiserfs_data_log(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_LOG))
#define reiserfs_data_ordered(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_ORDERED))
#define reiserfs_data_writeback(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_WRITEBACK))
#define reiserfs_xattrs(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_XATTRS))
#define reiserfs_xattrs(s) ((s)->s_xattr != NULL)
#define reiserfs_xattrs_user(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_XATTRS_USER))
#define reiserfs_posixacl(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_POSIXACL))
#define reiserfs_xattrs_optional(s) (reiserfs_xattrs_user(s) || reiserfs_posixacl(s))

View File

@ -15,6 +15,12 @@ struct reiserfs_xattr_header {
__le32 h_hash; /* hash of the value */
};
struct reiserfs_security_handle {
char *name;
void *value;
size_t length;
};
#ifdef __KERNEL__
#include <linux/init.h>
@ -29,22 +35,13 @@ struct iattr;
struct super_block;
struct nameidata;
struct reiserfs_xattr_handler {
char *prefix;
int (*init) (void);
void (*exit) (void);
int (*get) (struct inode * inode, const char *name, void *buffer,
size_t size);
int (*set) (struct inode * inode, const char *name, const void *buffer,
size_t size, int flags);
int (*del) (struct inode * inode, const char *name);
int (*list) (struct inode * inode, const char *name, int namelen,
char *out);
struct list_head handlers;
};
int reiserfs_xattr_register_handlers(void) __init;
void reiserfs_xattr_unregister_handlers(void);
int reiserfs_xattr_init(struct super_block *sb, int mount_flags);
int reiserfs_delete_xattrs(struct inode *inode);
int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs);
#ifdef CONFIG_REISERFS_FS_XATTR
#define is_reiserfs_priv_object(inode) IS_PRIVATE(inode)
#define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir)
ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name,
void *buffer, size_t size);
@ -52,105 +49,98 @@ int reiserfs_setxattr(struct dentry *dentry, const char *name,
const void *value, size_t size, int flags);
ssize_t reiserfs_listxattr(struct dentry *dentry, char *buffer, size_t size);
int reiserfs_removexattr(struct dentry *dentry, const char *name);
int reiserfs_delete_xattrs(struct inode *inode);
int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs);
int reiserfs_xattr_init(struct super_block *sb, int mount_flags);
int reiserfs_permission(struct inode *inode, int mask);
int reiserfs_xattr_del(struct inode *, const char *);
int reiserfs_xattr_get(const struct inode *, const char *, void *, size_t);
int reiserfs_xattr_get(struct inode *, const char *, void *, size_t);
int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int);
int reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *,
struct inode *, const char *, const void *,
size_t, int);
extern struct reiserfs_xattr_handler user_handler;
extern struct reiserfs_xattr_handler trusted_handler;
extern struct reiserfs_xattr_handler security_handler;
extern struct xattr_handler reiserfs_xattr_user_handler;
extern struct xattr_handler reiserfs_xattr_trusted_handler;
extern struct xattr_handler reiserfs_xattr_security_handler;
#ifdef CONFIG_REISERFS_FS_SECURITY
int reiserfs_security_init(struct inode *dir, struct inode *inode,
struct reiserfs_security_handle *sec);
int reiserfs_security_write(struct reiserfs_transaction_handle *th,
struct inode *inode,
struct reiserfs_security_handle *sec);
void reiserfs_security_free(struct reiserfs_security_handle *sec);
#endif
int reiserfs_xattr_register_handlers(void) __init;
void reiserfs_xattr_unregister_handlers(void);
static inline void reiserfs_write_lock_xattrs(struct super_block *sb)
#define xattr_size(size) ((size) + sizeof(struct reiserfs_xattr_header))
static inline loff_t reiserfs_xattr_nblocks(struct inode *inode, loff_t size)
{
down_write(&REISERFS_XATTR_DIR_SEM(sb));
}
static inline void reiserfs_write_unlock_xattrs(struct super_block *sb)
{
up_write(&REISERFS_XATTR_DIR_SEM(sb));
}
static inline void reiserfs_read_lock_xattrs(struct super_block *sb)
{
down_read(&REISERFS_XATTR_DIR_SEM(sb));
loff_t ret = 0;
if (reiserfs_file_data_log(inode)) {
ret = _ROUND_UP(xattr_size(size), inode->i_sb->s_blocksize);
ret >>= inode->i_sb->s_blocksize_bits;
}
return ret;
}
static inline void reiserfs_read_unlock_xattrs(struct super_block *sb)
/* We may have to create up to 3 objects: xattr root, xattr dir, xattr file.
* Let's try to be smart about it.
* xattr root: We cache it. If it's not cached, we may need to create it.
* xattr dir: If anything has been loaded for this inode, we can set a flag
* saying so.
* xattr file: Since we don't cache xattrs, we can't tell. We always include
* blocks for it.
*
* However, since root and dir can be created between calls - YOU MUST SAVE
* THIS VALUE.
*/
static inline size_t reiserfs_xattr_jcreate_nblocks(struct inode *inode)
{
up_read(&REISERFS_XATTR_DIR_SEM(sb));
}
size_t nblocks = JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb);
static inline void reiserfs_write_lock_xattr_i(struct inode *inode)
{
down_write(&REISERFS_I(inode)->xattr_sem);
}
static inline void reiserfs_write_unlock_xattr_i(struct inode *inode)
{
up_write(&REISERFS_I(inode)->xattr_sem);
}
static inline void reiserfs_read_lock_xattr_i(struct inode *inode)
{
down_read(&REISERFS_I(inode)->xattr_sem);
}
if ((REISERFS_I(inode)->i_flags & i_has_xattr_dir) == 0) {
nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb);
if (REISERFS_SB(inode->i_sb)->xattr_root == NULL)
nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb);
}
static inline void reiserfs_read_unlock_xattr_i(struct inode *inode)
{
up_read(&REISERFS_I(inode)->xattr_sem);
}
static inline void reiserfs_mark_inode_private(struct inode *inode)
{
inode->i_flags |= S_PRIVATE;
return nblocks;
}
static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
{
init_rwsem(&REISERFS_I(inode)->xattr_sem);
init_rwsem(&REISERFS_I(inode)->i_xattr_sem);
}
#else
#define is_reiserfs_priv_object(inode) 0
#define reiserfs_mark_inode_private(inode) do {;} while(0)
#define reiserfs_getxattr NULL
#define reiserfs_setxattr NULL
#define reiserfs_listxattr NULL
#define reiserfs_removexattr NULL
#define reiserfs_write_lock_xattrs(sb) do {;} while(0)
#define reiserfs_write_unlock_xattrs(sb) do {;} while(0)
#define reiserfs_read_lock_xattrs(sb)
#define reiserfs_read_unlock_xattrs(sb)
#define reiserfs_permission NULL
#define reiserfs_xattr_register_handlers() 0
#define reiserfs_xattr_unregister_handlers()
static inline int reiserfs_delete_xattrs(struct inode *inode)
{
return 0;
};
static inline int reiserfs_chown_xattrs(struct inode *inode,
struct iattr *attrs)
{
return 0;
};
static inline int reiserfs_xattr_init(struct super_block *sb, int mount_flags)
{
sb->s_flags = (sb->s_flags & ~MS_POSIXACL); /* to be sure */
return 0;
};
static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
{
}
#endif /* CONFIG_REISERFS_FS_XATTR */
#ifndef CONFIG_REISERFS_FS_SECURITY
static inline int reiserfs_security_init(struct inode *dir,
struct inode *inode,
struct reiserfs_security_handle *sec)
{
return 0;
}
static inline int
reiserfs_security_write(struct reiserfs_transaction_handle *th,
struct inode *inode,
struct reiserfs_security_handle *sec)
{
return 0;
}
static inline void reiserfs_security_free(struct reiserfs_security_handle *sec)
{}
#endif
#endif /* __KERNEL__ */
#endif /* _LINUX_REISERFS_XATTR_H */