Commit f5d256f8 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] ext3/JBD: remove trailing whitespace

ext3 and JBD still have enormous numbers of lines which end in tabs.  Fix
them all up.
parent 1ca5d490
...@@ -361,7 +361,7 @@ ext3_init_acl(handle_t *handle, struct inode *inode, struct inode *dir) ...@@ -361,7 +361,7 @@ ext3_init_acl(handle_t *handle, struct inode *inode, struct inode *dir)
error = -ENOMEM; error = -ENOMEM;
if (!clone) if (!clone)
goto cleanup; goto cleanup;
mode = inode->i_mode; mode = inode->i_mode;
error = posix_acl_create_masq(clone, &mode); error = posix_acl_create_masq(clone, &mode);
if (error >= 0) { if (error >= 0) {
......
...@@ -54,7 +54,7 @@ struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb, ...@@ -54,7 +54,7 @@ struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb,
return NULL; return NULL;
} }
group_desc = block_group / EXT3_DESC_PER_BLOCK(sb); group_desc = block_group / EXT3_DESC_PER_BLOCK(sb);
desc = block_group % EXT3_DESC_PER_BLOCK(sb); desc = block_group % EXT3_DESC_PER_BLOCK(sb);
if (!EXT3_SB(sb)->s_group_desc[group_desc]) { if (!EXT3_SB(sb)->s_group_desc[group_desc]) {
...@@ -64,7 +64,7 @@ struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb, ...@@ -64,7 +64,7 @@ struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb,
block_group, group_desc, desc); block_group, group_desc, desc);
return NULL; return NULL;
} }
gdp = (struct ext3_group_desc *) gdp = (struct ext3_group_desc *)
EXT3_SB(sb)->s_group_desc[group_desc]->b_data; EXT3_SB(sb)->s_group_desc[group_desc]->b_data;
if (bh) if (bh)
...@@ -83,7 +83,7 @@ read_block_bitmap(struct super_block *sb, unsigned int block_group) ...@@ -83,7 +83,7 @@ read_block_bitmap(struct super_block *sb, unsigned int block_group)
{ {
struct ext3_group_desc * desc; struct ext3_group_desc * desc;
struct buffer_head * bh = NULL; struct buffer_head * bh = NULL;
desc = ext3_get_group_desc (sb, block_group, NULL); desc = ext3_get_group_desc (sb, block_group, NULL);
if (!desc) if (!desc)
goto error_out; goto error_out;
...@@ -174,19 +174,19 @@ void ext3_free_blocks (handle_t *handle, struct inode * inode, ...@@ -174,19 +174,19 @@ void ext3_free_blocks (handle_t *handle, struct inode * inode,
err = ext3_journal_get_undo_access(handle, bitmap_bh, NULL); err = ext3_journal_get_undo_access(handle, bitmap_bh, NULL);
if (err) if (err)
goto error_return; goto error_return;
/* /*
* We are about to modify some metadata. Call the journal APIs * We are about to modify some metadata. Call the journal APIs
* to unshare ->b_data if a currently-committing transaction is * to unshare ->b_data if a currently-committing transaction is
* using it * using it
*/ */
BUFFER_TRACE(gd_bh, "get_write_access"); BUFFER_TRACE(gd_bh, "get_write_access");
err = ext3_journal_get_write_access(handle, gd_bh); err = ext3_journal_get_write_access(handle, gd_bh);
if (err) if (err)
goto error_return; goto error_return;
jbd_lock_bh_state(bitmap_bh); jbd_lock_bh_state(bitmap_bh);
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
/* /*
* An HJ special. This is expensive... * An HJ special. This is expensive...
...@@ -316,7 +316,7 @@ static int find_next_usable_block(int start, struct buffer_head *bh, ...@@ -316,7 +316,7 @@ static int find_next_usable_block(int start, struct buffer_head *bh,
{ {
int here, next; int here, next;
char *p, *r; char *p, *r;
if (start > 0) { if (start > 0) {
/* /*
* The goal was occupied; search forward for a free * The goal was occupied; search forward for a free
...@@ -331,15 +331,14 @@ static int find_next_usable_block(int start, struct buffer_head *bh, ...@@ -331,15 +331,14 @@ static int find_next_usable_block(int start, struct buffer_head *bh,
if (here < end_goal && if (here < end_goal &&
ext3_test_allocatable(here, bh, have_access)) ext3_test_allocatable(here, bh, have_access))
return here; return here;
ext3_debug ("Bit not found near goal\n"); ext3_debug ("Bit not found near goal\n");
} }
here = start; here = start;
if (here < 0) if (here < 0)
here = 0; here = 0;
/* /*
* There has been no free block found in the near vicinity of * There has been no free block found in the near vicinity of
* the goal: do a search forward through the block groups, * the goal: do a search forward through the block groups,
...@@ -351,10 +350,10 @@ static int find_next_usable_block(int start, struct buffer_head *bh, ...@@ -351,10 +350,10 @@ static int find_next_usable_block(int start, struct buffer_head *bh,
p = ((char *) bh->b_data) + (here >> 3); p = ((char *) bh->b_data) + (here >> 3);
r = memscan(p, 0, (maxblocks - here + 7) >> 3); r = memscan(p, 0, (maxblocks - here + 7) >> 3);
next = (r - ((char *) bh->b_data)) << 3; next = (r - ((char *) bh->b_data)) << 3;
if (next < maxblocks && ext3_test_allocatable(next, bh, have_access)) if (next < maxblocks && ext3_test_allocatable(next, bh, have_access))
return next; return next;
/* The bitmap search --- search forward alternately /* The bitmap search --- search forward alternately
* through the actual bitmap and the last-committed copy * through the actual bitmap and the last-committed copy
* until we find a bit free in both. */ * until we find a bit free in both. */
...@@ -547,7 +546,7 @@ ext3_new_block(handle_t *handle, struct inode *inode, unsigned long goal, ...@@ -547,7 +546,7 @@ ext3_new_block(handle_t *handle, struct inode *inode, unsigned long goal,
EXT3_BLOCKS_PER_GROUP(sb)); EXT3_BLOCKS_PER_GROUP(sb));
bitmap_bh = read_block_bitmap(sb, group_no); bitmap_bh = read_block_bitmap(sb, group_no);
if (!bitmap_bh) if (!bitmap_bh)
goto io_error; goto io_error;
ret_block = ext3_try_to_allocate(sb, handle, group_no, ret_block = ext3_try_to_allocate(sb, handle, group_no,
bitmap_bh, ret_block, &fatal); bitmap_bh, ret_block, &fatal);
if (fatal) if (fatal)
...@@ -555,7 +554,7 @@ ext3_new_block(handle_t *handle, struct inode *inode, unsigned long goal, ...@@ -555,7 +554,7 @@ ext3_new_block(handle_t *handle, struct inode *inode, unsigned long goal,
if (ret_block >= 0) if (ret_block >= 0)
goto allocated; goto allocated;
} }
/* /*
* Now search the rest of the groups. We assume that * Now search the rest of the groups. We assume that
* i and gdp correctly point to the last group visited. * i and gdp correctly point to the last group visited.
...@@ -675,7 +674,7 @@ ext3_new_block(handle_t *handle, struct inode *inode, unsigned long goal, ...@@ -675,7 +674,7 @@ ext3_new_block(handle_t *handle, struct inode *inode, unsigned long goal,
*errp = 0; *errp = 0;
brelse(bitmap_bh); brelse(bitmap_bh);
return ret_block; return ret_block;
io_error: io_error:
*errp = -EIO; *errp = -EIO;
out: out:
...@@ -690,7 +689,6 @@ ext3_new_block(handle_t *handle, struct inode *inode, unsigned long goal, ...@@ -690,7 +689,6 @@ ext3_new_block(handle_t *handle, struct inode *inode, unsigned long goal,
DQUOT_FREE_BLOCK(inode, 1); DQUOT_FREE_BLOCK(inode, 1);
brelse(bitmap_bh); brelse(bitmap_bh);
return 0; return 0;
} }
unsigned long ext3_count_free_blocks(struct super_block *sb) unsigned long ext3_count_free_blocks(struct super_block *sb)
...@@ -702,7 +700,7 @@ unsigned long ext3_count_free_blocks(struct super_block *sb) ...@@ -702,7 +700,7 @@ unsigned long ext3_count_free_blocks(struct super_block *sb)
struct ext3_super_block *es; struct ext3_super_block *es;
unsigned long bitmap_count, x; unsigned long bitmap_count, x;
struct buffer_head *bitmap_bh = NULL; struct buffer_head *bitmap_bh = NULL;
lock_super(sb); lock_super(sb);
es = EXT3_SB(sb)->s_es; es = EXT3_SB(sb)->s_es;
desc_count = 0; desc_count = 0;
...@@ -717,7 +715,7 @@ unsigned long ext3_count_free_blocks(struct super_block *sb) ...@@ -717,7 +715,7 @@ unsigned long ext3_count_free_blocks(struct super_block *sb)
bitmap_bh = read_block_bitmap(sb, i); bitmap_bh = read_block_bitmap(sb, i);
if (bitmap_bh == NULL) if (bitmap_bh == NULL)
continue; continue;
x = ext3_count_free(bitmap_bh, sb->s_blocksize); x = ext3_count_free(bitmap_bh, sb->s_blocksize);
printk("group %d: stored = %d, counted = %lu\n", printk("group %d: stored = %d, counted = %lu\n",
i, le16_to_cpu(gdp->bg_free_blocks_count), x); i, le16_to_cpu(gdp->bg_free_blocks_count), x);
......
...@@ -16,7 +16,7 @@ unsigned long ext3_count_free (struct buffer_head * map, unsigned int numchars) ...@@ -16,7 +16,7 @@ unsigned long ext3_count_free (struct buffer_head * map, unsigned int numchars)
{ {
unsigned int i; unsigned int i;
unsigned long sum = 0; unsigned long sum = 0;
if (!map) if (!map)
return (0); return (0);
for (i = 0; i < numchars; i++) for (i = 0; i < numchars; i++)
......
...@@ -157,7 +157,7 @@ static int ext3_readdir(struct file * filp, ...@@ -157,7 +157,7 @@ static int ext3_readdir(struct file * filp,
brelse (bha[i]); brelse (bha[i]);
} }
} }
revalidate: revalidate:
/* If the dir block has changed since the last call to /* If the dir block has changed since the last call to
* readdir(2), then we might be pointing to an invalid * readdir(2), then we might be pointing to an invalid
...@@ -183,7 +183,7 @@ static int ext3_readdir(struct file * filp, ...@@ -183,7 +183,7 @@ static int ext3_readdir(struct file * filp,
| offset; | offset;
filp->f_version = inode->i_version; filp->f_version = inode->i_version;
} }
while (!error && filp->f_pos < inode->i_size while (!error && filp->f_pos < inode->i_size
&& offset < sb->s_blocksize) { && offset < sb->s_blocksize) {
de = (struct ext3_dir_entry_2 *) (bh->b_data + offset); de = (struct ext3_dir_entry_2 *) (bh->b_data + offset);
...@@ -329,7 +329,7 @@ void ext3_htree_free_dir_info(struct dir_private_info *p) ...@@ -329,7 +329,7 @@ void ext3_htree_free_dir_info(struct dir_private_info *p)
free_rb_tree_fname(&p->root); free_rb_tree_fname(&p->root);
kfree(p); kfree(p);
} }
/* /*
* Given a directory entry, enter it into the fname rb tree. * Given a directory entry, enter it into the fname rb tree.
*/ */
...@@ -358,7 +358,7 @@ int ext3_htree_store_dirent(struct file *dir_file, __u32 hash, ...@@ -358,7 +358,7 @@ int ext3_htree_store_dirent(struct file *dir_file, __u32 hash,
new_fn->file_type = dirent->file_type; new_fn->file_type = dirent->file_type;
memcpy(new_fn->name, dirent->name, dirent->name_len); memcpy(new_fn->name, dirent->name, dirent->name_len);
new_fn->name[dirent->name_len] = 0; new_fn->name[dirent->name_len] = 0;
while (*p) { while (*p) {
parent = *p; parent = *p;
fname = rb_entry(parent, struct fname, rb_hash); fname = rb_entry(parent, struct fname, rb_hash);
...@@ -373,7 +373,7 @@ int ext3_htree_store_dirent(struct file *dir_file, __u32 hash, ...@@ -373,7 +373,7 @@ int ext3_htree_store_dirent(struct file *dir_file, __u32 hash,
fname->next = new_fn; fname->next = new_fn;
return 0; return 0;
} }
if (new_fn->hash < fname->hash) if (new_fn->hash < fname->hash)
p = &(*p)->rb_left; p = &(*p)->rb_left;
else if (new_fn->hash > fname->hash) else if (new_fn->hash > fname->hash)
...@@ -406,7 +406,7 @@ static int call_filldir(struct file * filp, void * dirent, ...@@ -406,7 +406,7 @@ static int call_filldir(struct file * filp, void * dirent,
int error; int error;
sb = inode->i_sb; sb = inode->i_sb;
if (!fname) { if (!fname) {
printk("call_filldir: called with null fname?!?\n"); printk("call_filldir: called with null fname?!?\n");
return 0; return 0;
......
...@@ -69,7 +69,7 @@ ext3_file_write(struct kiocb *iocb, const char *buf, size_t count, loff_t pos) ...@@ -69,7 +69,7 @@ ext3_file_write(struct kiocb *iocb, const char *buf, size_t count, loff_t pos)
*/ */
if (ret <= 0) if (ret <= 0)
return ret; return ret;
/* /*
* If the inode is IS_SYNC, or is O_SYNC and we are doing data * If the inode is IS_SYNC, or is O_SYNC and we are doing data
* journalling then we need to make sure that we force the transaction * journalling then we need to make sure that we force the transaction
...@@ -97,14 +97,14 @@ ext3_file_write(struct kiocb *iocb, const char *buf, size_t count, loff_t pos) ...@@ -97,14 +97,14 @@ ext3_file_write(struct kiocb *iocb, const char *buf, size_t count, loff_t pos)
*/ */
if (!IS_SYNC(inode)) if (!IS_SYNC(inode))
return ret; return ret;
/* /*
* Open question #2 --- should we force data to disk here too? If we * Open question #2 --- should we force data to disk here too? If we
* don't, the only impact is that data=writeback filesystems won't * don't, the only impact is that data=writeback filesystems won't
* flush data to disk automatically on IS_SYNC, only metadata (but * flush data to disk automatically on IS_SYNC, only metadata (but
* historically, that is what ext2 has done.) * historically, that is what ext2 has done.)
*/ */
force_commit: force_commit:
err = ext3_force_commit(inode->i_sb); err = ext3_force_commit(inode->i_sb);
if (err) if (err)
......
...@@ -23,10 +23,10 @@ static void TEA_transform(__u32 buf[4], __u32 const in[]) ...@@ -23,10 +23,10 @@ static void TEA_transform(__u32 buf[4], __u32 const in[])
__u32 a = in[0], b = in[1], c = in[2], d = in[3]; __u32 a = in[0], b = in[1], c = in[2], d = in[3];
int n = 16; int n = 16;
do { do {
sum += DELTA; sum += DELTA;
b0 += ((b1 << 4)+a) ^ (b1+sum) ^ ((b1 >> 5)+b); b0 += ((b1 << 4)+a) ^ (b1+sum) ^ ((b1 >> 5)+b);
b1 += ((b0 << 4)+c) ^ (b0+sum) ^ ((b0 >> 5)+d); b1 += ((b0 << 4)+c) ^ (b0+sum) ^ ((b0 >> 5)+d);
} while(--n); } while(--n);
buf[0] += b0; buf[0] += b0;
...@@ -107,7 +107,7 @@ static __u32 dx_hack_hash (const char *name, int len) ...@@ -107,7 +107,7 @@ static __u32 dx_hack_hash (const char *name, int len)
__u32 hash0 = 0x12a3fe2d, hash1 = 0x37abe8f9; __u32 hash0 = 0x12a3fe2d, hash1 = 0x37abe8f9;
while (len--) { while (len--) {
__u32 hash = hash1 + (hash0 ^ (*name++ * 7152373)); __u32 hash = hash1 + (hash0 ^ (*name++ * 7152373));
if (hash & 0x80000000) hash -= 0x7fffffff; if (hash & 0x80000000) hash -= 0x7fffffff;
hash1 = hash0; hash1 = hash0;
hash0 = hash; hash0 = hash;
...@@ -178,7 +178,7 @@ int ext3fs_dirhash(const char *name, int len, struct dx_hash_info *hinfo) ...@@ -178,7 +178,7 @@ int ext3fs_dirhash(const char *name, int len, struct dx_hash_info *hinfo)
if (i < 4) if (i < 4)
memcpy(buf, hinfo->seed, sizeof(buf)); memcpy(buf, hinfo->seed, sizeof(buf));
} }
switch (hinfo->hash_version) { switch (hinfo->hash_version) {
case DX_HASH_LEGACY: case DX_HASH_LEGACY:
hash = dx_hack_hash(name, len); hash = dx_hack_hash(name, len);
......
...@@ -462,13 +462,13 @@ struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode) ...@@ -462,13 +462,13 @@ struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode)
for (i = 0; i < sbi->s_groups_count; i++) { for (i = 0; i < sbi->s_groups_count; i++) {
gdp = ext3_get_group_desc(sb, group, &bh2); gdp = ext3_get_group_desc(sb, group, &bh2);
err = -EIO; err = -EIO;
brelse(bitmap_bh); brelse(bitmap_bh);
bitmap_bh = read_inode_bitmap(sb, group); bitmap_bh = read_inode_bitmap(sb, group);
if (!bitmap_bh) if (!bitmap_bh)
goto fail; goto fail;
ino = ext3_find_first_zero_bit((unsigned long *) ino = ext3_find_first_zero_bit((unsigned long *)
bitmap_bh->b_data, EXT3_INODES_PER_GROUP(sb)); bitmap_bh->b_data, EXT3_INODES_PER_GROUP(sb));
if (ino < EXT3_INODES_PER_GROUP(sb)) { if (ino < EXT3_INODES_PER_GROUP(sb)) {
...@@ -532,7 +532,7 @@ struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode) ...@@ -532,7 +532,7 @@ struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode)
BUFFER_TRACE(bh2, "call ext3_journal_dirty_metadata"); BUFFER_TRACE(bh2, "call ext3_journal_dirty_metadata");
err = ext3_journal_dirty_metadata(handle, bh2); err = ext3_journal_dirty_metadata(handle, bh2);
if (err) goto fail; if (err) goto fail;
percpu_counter_dec(&sbi->s_freeinodes_counter); percpu_counter_dec(&sbi->s_freeinodes_counter);
if (S_ISDIR(mode)) if (S_ISDIR(mode))
percpu_counter_inc(&sbi->s_dirs_counter); percpu_counter_inc(&sbi->s_dirs_counter);
...@@ -580,7 +580,7 @@ struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode) ...@@ -580,7 +580,7 @@ struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode)
ei->i_prealloc_count = 0; ei->i_prealloc_count = 0;
#endif #endif
ei->i_block_group = group; ei->i_block_group = group;
ext3_set_inode_flags(inode); ext3_set_inode_flags(inode);
if (IS_DIRSYNC(inode)) if (IS_DIRSYNC(inode))
handle->h_sync = 1; handle->h_sync = 1;
......
...@@ -72,7 +72,7 @@ int ext3_forget(handle_t *handle, int is_metadata, ...@@ -72,7 +72,7 @@ int ext3_forget(handle_t *handle, int is_metadata,
"data mode %lx\n", "data mode %lx\n",
bh, is_metadata, inode->i_mode, bh, is_metadata, inode->i_mode,
test_opt(inode->i_sb, DATA_FLAGS)); test_opt(inode->i_sb, DATA_FLAGS));
/* Never use the revoke function if we are doing full data /* Never use the revoke function if we are doing full data
* journaling: there is no need to, and a V1 superblock won't * journaling: there is no need to, and a V1 superblock won't
* support it. Otherwise, only skip the revoke on un-journaled * support it. Otherwise, only skip the revoke on un-journaled
...@@ -107,7 +107,7 @@ int ext3_forget(handle_t *handle, int is_metadata, ...@@ -107,7 +107,7 @@ int ext3_forget(handle_t *handle, int is_metadata,
static unsigned long blocks_for_truncate(struct inode *inode) static unsigned long blocks_for_truncate(struct inode *inode)
{ {
unsigned long needed; unsigned long needed;
needed = inode->i_blocks >> (inode->i_sb->s_blocksize_bits - 9); needed = inode->i_blocks >> (inode->i_sb->s_blocksize_bits - 9);
/* Give ourselves just enough room to cope with inodes in which /* Give ourselves just enough room to cope with inodes in which
...@@ -126,7 +126,7 @@ static unsigned long blocks_for_truncate(struct inode *inode) ...@@ -126,7 +126,7 @@ static unsigned long blocks_for_truncate(struct inode *inode)
return EXT3_DATA_TRANS_BLOCKS + needed; return EXT3_DATA_TRANS_BLOCKS + needed;
} }
/* /*
* Truncate transactions can be complex and absolutely huge. So we need to * Truncate transactions can be complex and absolutely huge. So we need to
* be able to restart the transaction at a conventient checkpoint to make * be able to restart the transaction at a conventient checkpoint to make
...@@ -141,11 +141,11 @@ static unsigned long blocks_for_truncate(struct inode *inode) ...@@ -141,11 +141,11 @@ static unsigned long blocks_for_truncate(struct inode *inode)
static handle_t *start_transaction(struct inode *inode) static handle_t *start_transaction(struct inode *inode)
{ {
handle_t *result; handle_t *result;
result = ext3_journal_start(inode, blocks_for_truncate(inode)); result = ext3_journal_start(inode, blocks_for_truncate(inode));
if (!IS_ERR(result)) if (!IS_ERR(result))
return result; return result;
ext3_std_error(inode->i_sb, PTR_ERR(result)); ext3_std_error(inode->i_sb, PTR_ERR(result));
return result; return result;
} }
...@@ -195,7 +195,7 @@ void ext3_put_inode(struct inode *inode) ...@@ -195,7 +195,7 @@ void ext3_put_inode(struct inode *inode)
void ext3_delete_inode (struct inode * inode) void ext3_delete_inode (struct inode * inode)
{ {
handle_t *handle; handle_t *handle;
if (is_bad_inode(inode)) if (is_bad_inode(inode))
goto no_delete; goto no_delete;
...@@ -209,7 +209,7 @@ void ext3_delete_inode (struct inode * inode) ...@@ -209,7 +209,7 @@ void ext3_delete_inode (struct inode * inode)
ext3_std_error(inode->i_sb, PTR_ERR(handle)); ext3_std_error(inode->i_sb, PTR_ERR(handle));
goto no_delete; goto no_delete;
} }
if (IS_SYNC(inode)) if (IS_SYNC(inode))
handle->h_sync = 1; handle->h_sync = 1;
inode->i_size = 0; inode->i_size = 0;
...@@ -593,7 +593,7 @@ static int ext3_alloc_branch(handle_t *handle, struct inode *inode, ...@@ -593,7 +593,7 @@ static int ext3_alloc_branch(handle_t *handle, struct inode *inode,
break; break;
branch[n].key = cpu_to_le32(nr); branch[n].key = cpu_to_le32(nr);
keys = n+1; keys = n+1;
/* /*
* Get buffer_head for parent block, zero it out * Get buffer_head for parent block, zero it out
* and set the pointer to new one, then send * and set the pointer to new one, then send
...@@ -621,7 +621,7 @@ static int ext3_alloc_branch(handle_t *handle, struct inode *inode, ...@@ -621,7 +621,7 @@ static int ext3_alloc_branch(handle_t *handle, struct inode *inode,
err = ext3_journal_dirty_metadata(handle, bh); err = ext3_journal_dirty_metadata(handle, bh);
if (err) if (err)
break; break;
parent = nr; parent = nr;
} }
} }
...@@ -723,7 +723,7 @@ static int ext3_splice_branch(handle_t *handle, struct inode *inode, long block, ...@@ -723,7 +723,7 @@ static int ext3_splice_branch(handle_t *handle, struct inode *inode, long block,
*/ */
jbd_debug(1, "the chain changed: try again\n"); jbd_debug(1, "the chain changed: try again\n");
err = -EAGAIN; err = -EAGAIN;
err_out: err_out:
for (i = 1; i < num; i++) { for (i = 1; i < num; i++) {
BUFFER_TRACE(where[i].bh, "call journal_forget"); BUFFER_TRACE(where[i].bh, "call journal_forget");
...@@ -915,7 +915,7 @@ struct buffer_head *ext3_getblk(handle_t *handle, struct inode * inode, ...@@ -915,7 +915,7 @@ struct buffer_head *ext3_getblk(handle_t *handle, struct inode * inode,
{ {
struct buffer_head dummy; struct buffer_head dummy;
int fatal = 0, err; int fatal = 0, err;
J_ASSERT(handle != NULL || create == 0); J_ASSERT(handle != NULL || create == 0);
dummy.b_state = 0; dummy.b_state = 0;
...@@ -1233,7 +1233,7 @@ static sector_t ext3_bmap(struct address_space *mapping, sector_t block) ...@@ -1233,7 +1233,7 @@ static sector_t ext3_bmap(struct address_space *mapping, sector_t block)
struct inode *inode = mapping->host; struct inode *inode = mapping->host;
journal_t *journal; journal_t *journal;
int err; int err;
if (EXT3_I(inode)->i_state & EXT3_STATE_JDATA) { if (EXT3_I(inode)->i_state & EXT3_STATE_JDATA) {
/* /*
* This is a REALLY heavyweight approach, but the use of * This is a REALLY heavyweight approach, but the use of
...@@ -1252,17 +1252,17 @@ static sector_t ext3_bmap(struct address_space *mapping, sector_t block) ...@@ -1252,17 +1252,17 @@ static sector_t ext3_bmap(struct address_space *mapping, sector_t block)
* hasn't yet been flushed to disk, they deserve * hasn't yet been flushed to disk, they deserve
* everything they get. * everything they get.
*/ */
EXT3_I(inode)->i_state &= ~EXT3_STATE_JDATA; EXT3_I(inode)->i_state &= ~EXT3_STATE_JDATA;
journal = EXT3_JOURNAL(inode); journal = EXT3_JOURNAL(inode);
journal_lock_updates(journal); journal_lock_updates(journal);
err = journal_flush(journal); err = journal_flush(journal);
journal_unlock_updates(journal); journal_unlock_updates(journal);
if (err) if (err)
return 0; return 0;
} }
return generic_block_bmap(mapping,block,ext3_get_block); return generic_block_bmap(mapping,block,ext3_get_block);
} }
...@@ -1347,7 +1347,7 @@ static int ext3_ordered_writepage(struct page *page, ...@@ -1347,7 +1347,7 @@ static int ext3_ordered_writepage(struct page *page,
int err; int err;
J_ASSERT(PageLocked(page)); J_ASSERT(PageLocked(page));
/* /*
* We give up here if we're reentered, because it might be for a * We give up here if we're reentered, because it might be for a
* different filesystem. * different filesystem.
...@@ -1356,7 +1356,7 @@ static int ext3_ordered_writepage(struct page *page, ...@@ -1356,7 +1356,7 @@ static int ext3_ordered_writepage(struct page *page,
goto out_fail; goto out_fail;
handle = ext3_journal_start(inode, ext3_writepage_trans_blocks(inode)); handle = ext3_journal_start(inode, ext3_writepage_trans_blocks(inode));
if (IS_ERR(handle)) { if (IS_ERR(handle)) {
ret = PTR_ERR(handle); ret = PTR_ERR(handle);
goto out_fail; goto out_fail;
...@@ -2003,7 +2003,7 @@ static void ext3_free_branches(handle_t *handle, struct inode *inode, ...@@ -2003,7 +2003,7 @@ static void ext3_free_branches(handle_t *handle, struct inode *inode,
if (is_handle_aborted(handle)) if (is_handle_aborted(handle))
return; return;
if (depth--) { if (depth--) {
struct buffer_head *bh; struct buffer_head *bh;
int addr_per_block = EXT3_ADDR_PER_BLOCK(inode->i_sb); int addr_per_block = EXT3_ADDR_PER_BLOCK(inode->i_sb);
...@@ -2165,7 +2165,6 @@ void ext3_truncate(struct inode * inode) ...@@ -2165,7 +2165,6 @@ void ext3_truncate(struct inode * inode)
>> EXT3_BLOCK_SIZE_BITS(inode->i_sb); >> EXT3_BLOCK_SIZE_BITS(inode->i_sb);
ext3_block_truncate_page(handle, inode->i_mapping, inode->i_size); ext3_block_truncate_page(handle, inode->i_mapping, inode->i_size);
n = ext3_block_to_path(inode, last_block, offsets, NULL); n = ext3_block_to_path(inode, last_block, offsets, NULL);
if (n == 0) if (n == 0)
...@@ -2296,7 +2295,7 @@ int ext3_get_inode_loc (struct inode *inode, struct ext3_iloc *iloc) ...@@ -2296,7 +2295,7 @@ int ext3_get_inode_loc (struct inode *inode, struct ext3_iloc *iloc)
unsigned long desc; unsigned long desc;
unsigned long offset; unsigned long offset;
struct ext3_group_desc * gdp; struct ext3_group_desc * gdp;
if ((inode->i_ino != EXT3_ROOT_INO && if ((inode->i_ino != EXT3_ROOT_INO &&
inode->i_ino != EXT3_JOURNAL_INO && inode->i_ino != EXT3_JOURNAL_INO &&
inode->i_ino < EXT3_FIRST_INO(inode->i_sb)) || inode->i_ino < EXT3_FIRST_INO(inode->i_sb)) ||
...@@ -2340,9 +2339,9 @@ int ext3_get_inode_loc (struct inode *inode, struct ext3_iloc *iloc) ...@@ -2340,9 +2339,9 @@ int ext3_get_inode_loc (struct inode *inode, struct ext3_iloc *iloc)
iloc->bh = bh; iloc->bh = bh;
iloc->raw_inode = (struct ext3_inode *) (bh->b_data + offset); iloc->raw_inode = (struct ext3_inode *) (bh->b_data + offset);
iloc->block_group = block_group; iloc->block_group = block_group;
return 0; return 0;
bad_inode: bad_inode:
return -EIO; return -EIO;
} }
...@@ -2372,7 +2371,7 @@ void ext3_read_inode(struct inode * inode) ...@@ -2372,7 +2371,7 @@ void ext3_read_inode(struct inode * inode)
struct ext3_inode_info *ei = EXT3_I(inode); struct ext3_inode_info *ei = EXT3_I(inode);
struct buffer_head *bh; struct buffer_head *bh;
int block; int block;
#ifdef CONFIG_EXT3_FS_POSIX_ACL #ifdef CONFIG_EXT3_FS_POSIX_ACL
ei->i_acl = EXT3_ACL_NOT_CACHED; ei->i_acl = EXT3_ACL_NOT_CACHED;
ei->i_default_acl = EXT3_ACL_NOT_CACHED; ei->i_default_acl = EXT3_ACL_NOT_CACHED;
...@@ -2472,7 +2471,7 @@ void ext3_read_inode(struct inode * inode) ...@@ -2472,7 +2471,7 @@ void ext3_read_inode(struct inode * inode)
} }
ext3_set_inode_flags(inode); ext3_set_inode_flags(inode);
return; return;
bad_inode: bad_inode:
make_bad_inode(inode); make_bad_inode(inode);
return; return;
...@@ -2634,7 +2633,7 @@ void ext3_write_inode(struct inode *inode, int wait) ...@@ -2634,7 +2633,7 @@ void ext3_write_inode(struct inode *inode, int wait)
if (!wait) if (!wait)
return; return;
ext3_force_commit(inode->i_sb); ext3_force_commit(inode->i_sb);
} }
/* /*
...@@ -2680,7 +2679,7 @@ int ext3_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -2680,7 +2679,7 @@ int ext3_setattr(struct dentry *dentry, struct iattr *attr)
error = PTR_ERR(handle); error = PTR_ERR(handle);
goto err_out; goto err_out;
} }
error = ext3_orphan_add(handle, inode); error = ext3_orphan_add(handle, inode);
EXT3_I(inode)->i_disksize = attr->ia_size; EXT3_I(inode)->i_disksize = attr->ia_size;
rc = ext3_mark_inode_dirty(handle, inode); rc = ext3_mark_inode_dirty(handle, inode);
...@@ -2688,7 +2687,7 @@ int ext3_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -2688,7 +2687,7 @@ int ext3_setattr(struct dentry *dentry, struct iattr *attr)
error = rc; error = rc;
ext3_journal_stop(handle); ext3_journal_stop(handle);
} }
rc = inode_setattr(inode, attr); rc = inode_setattr(inode, attr);
/* If inode_setattr's call to ext3_truncate failed to get a /* If inode_setattr's call to ext3_truncate failed to get a
...@@ -2740,7 +2739,7 @@ int ext3_writepage_trans_blocks(struct inode *inode) ...@@ -2740,7 +2739,7 @@ int ext3_writepage_trans_blocks(struct inode *inode)
int bpp = ext3_journal_blocks_per_page(inode); int bpp = ext3_journal_blocks_per_page(inode);
int indirects = (EXT3_NDIR_BLOCKS % bpp) ? 5 : 3; int indirects = (EXT3_NDIR_BLOCKS % bpp) ? 5 : 3;
int ret; int ret;
if (ext3_should_journal_data(inode)) if (ext3_should_journal_data(inode))
ret = 3 * (bpp + indirects) + 2; ret = 3 * (bpp + indirects) + 2;
else else
...@@ -2877,7 +2876,7 @@ static inline int ...@@ -2877,7 +2876,7 @@ static inline int
ext3_pin_inode(handle_t *handle, struct inode *inode) ext3_pin_inode(handle_t *handle, struct inode *inode)
{ {
struct ext3_iloc iloc; struct ext3_iloc iloc;
int err = 0; int err = 0;
if (handle) { if (handle) {
err = ext3_get_inode_loc(inode, &iloc); err = ext3_get_inode_loc(inode, &iloc);
...@@ -2914,7 +2913,7 @@ int ext3_change_inode_journal_flag(struct inode *inode, int val) ...@@ -2914,7 +2913,7 @@ int ext3_change_inode_journal_flag(struct inode *inode, int val)
journal = EXT3_JOURNAL(inode); journal = EXT3_JOURNAL(inode);
if (is_journal_aborted(journal) || IS_RDONLY(inode)) if (is_journal_aborted(journal) || IS_RDONLY(inode))
return -EROFS; return -EROFS;
journal_lock_updates(journal); journal_lock_updates(journal);
journal_flush(journal); journal_flush(journal);
...@@ -2943,6 +2942,6 @@ int ext3_change_inode_journal_flag(struct inode *inode, int val) ...@@ -2943,6 +2942,6 @@ int ext3_change_inode_journal_flag(struct inode *inode, int val)
handle->h_sync = 1; handle->h_sync = 1;
ext3_journal_stop(handle); ext3_journal_stop(handle);
ext3_std_error(inode->i_sb, err); ext3_std_error(inode->i_sb, err);
return err; return err;
} }
...@@ -61,7 +61,7 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, ...@@ -61,7 +61,7 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
if (!capable(CAP_LINUX_IMMUTABLE)) if (!capable(CAP_LINUX_IMMUTABLE))
return -EPERM; return -EPERM;
} }
/* /*
* The JOURNAL_DATA flag can only be changed by * The JOURNAL_DATA flag can only be changed by
* the relevant capability. * the relevant capability.
...@@ -80,7 +80,7 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, ...@@ -80,7 +80,7 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
err = ext3_reserve_inode_write(handle, inode, &iloc); err = ext3_reserve_inode_write(handle, inode, &iloc);
if (err) if (err)
goto flags_err; goto flags_err;
flags = flags & EXT3_FL_USER_MODIFIABLE; flags = flags & EXT3_FL_USER_MODIFIABLE;
flags |= oldflags & ~EXT3_FL_USER_MODIFIABLE; flags |= oldflags & ~EXT3_FL_USER_MODIFIABLE;
ei->i_flags = flags; ei->i_flags = flags;
...@@ -93,7 +93,7 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, ...@@ -93,7 +93,7 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
ext3_journal_stop(handle); ext3_journal_stop(handle);
if (err) if (err)
return err; return err;
if ((jflag ^ oldflags) & (EXT3_JOURNAL_DATA_FL)) if ((jflag ^ oldflags) & (EXT3_JOURNAL_DATA_FL))
err = ext3_change_inode_journal_flag(inode, jflag); err = ext3_change_inode_journal_flag(inode, jflag);
return err; return err;
......
...@@ -263,7 +263,7 @@ static struct stats dx_show_leaf(struct dx_hash_info *hinfo, struct ext3_dir_ent ...@@ -263,7 +263,7 @@ static struct stats dx_show_leaf(struct dx_hash_info *hinfo, struct ext3_dir_ent
unsigned names = 0, space = 0; unsigned names = 0, space = 0;
char *base = (char *) de; char *base = (char *) de;
struct dx_hash_info h = *hinfo; struct dx_hash_info h = *hinfo;
printk("names: "); printk("names: ");
while ((char *) de < base + size) while ((char *) de < base + size)
{ {
...@@ -546,7 +546,7 @@ static int htree_dirblock_to_tree(struct file *dir_file, ...@@ -546,7 +546,7 @@ static int htree_dirblock_to_tree(struct file *dir_file,
dxtrace(printk("In htree dirblock_to_tree: block %d\n", block)); dxtrace(printk("In htree dirblock_to_tree: block %d\n", block));
if (!(bh = ext3_bread (NULL, dir, block, 0, &err))) if (!(bh = ext3_bread (NULL, dir, block, 0, &err)))
return err; return err;
de = (struct ext3_dir_entry_2 *) bh->b_data; de = (struct ext3_dir_entry_2 *) bh->b_data;
top = (struct ext3_dir_entry_2 *) ((char *) de + top = (struct ext3_dir_entry_2 *) ((char *) de +
dir->i_sb->s_blocksize - dir->i_sb->s_blocksize -
...@@ -588,11 +588,11 @@ int ext3_htree_fill_tree(struct file *dir_file, __u32 start_hash, ...@@ -588,11 +588,11 @@ int ext3_htree_fill_tree(struct file *dir_file, __u32 start_hash,
int count = 0; int count = 0;
int ret; int ret;
__u32 hashval; __u32 hashval;
dxtrace(printk("In htree_fill_tree, start hash: %x:%x\n", start_hash, dxtrace(printk("In htree_fill_tree, start hash: %x:%x\n", start_hash,
start_minor_hash)); start_minor_hash));
dir = dir_file->f_dentry->d_inode; dir = dir_file->f_dentry->d_inode;
if (!(EXT3_I(dir)->i_flags & EXT3_INDEX_FL)) { if (!(EXT3_I(dir)->i_flags & EXT3_INDEX_FL)) {
hinfo.hash_version = EXT3_SB(dir->i_sb)->s_def_hash_version; hinfo.hash_version = EXT3_SB(dir->i_sb)->s_def_hash_version;
hinfo.seed = EXT3_SB(dir->i_sb)->s_hash_seed; hinfo.seed = EXT3_SB(dir->i_sb)->s_hash_seed;
count = htree_dirblock_to_tree(dir_file, dir, 0, &hinfo, count = htree_dirblock_to_tree(dir_file, dir, 0, &hinfo,
...@@ -663,7 +663,7 @@ static int dx_make_map (struct ext3_dir_entry_2 *de, int size, ...@@ -663,7 +663,7 @@ static int dx_make_map (struct ext3_dir_entry_2 *de, int size,
int count = 0; int count = 0;
char *base = (char *) de; char *base = (char *) de;
struct dx_hash_info h = *hinfo; struct dx_hash_info h = *hinfo;
while ((char *) de < base + size) while ((char *) de < base + size)
{ {
if (de->name_len && de->inode) { if (de->name_len && de->inode) {
...@@ -798,8 +798,6 @@ static inline int search_dirblock(struct buffer_head * bh, ...@@ -798,8 +798,6 @@ static inline int search_dirblock(struct buffer_head * bh,
* The returned buffer_head has ->b_count elevated. The caller is expected * The returned buffer_head has ->b_count elevated. The caller is expected
* to brelse() it when appropriate. * to brelse() it when appropriate.
*/ */
static struct buffer_head * ext3_find_entry (struct dentry *dentry, static struct buffer_head * ext3_find_entry (struct dentry *dentry,
struct ext3_dir_entry_2 ** res_dir) struct ext3_dir_entry_2 ** res_dir)
{ {
...@@ -903,7 +901,7 @@ static struct buffer_head * ext3_find_entry (struct dentry *dentry, ...@@ -903,7 +901,7 @@ static struct buffer_head * ext3_find_entry (struct dentry *dentry,
start = 0; start = 0;
goto restart; goto restart;
} }
cleanup_and_exit: cleanup_and_exit:
/* Clean up the read-ahead blocks */ /* Clean up the read-ahead blocks */
for (; ra_ptr < ra_max; ra_ptr++) for (; ra_ptr < ra_max; ra_ptr++)
...@@ -926,7 +924,7 @@ static struct buffer_head * ext3_dx_find_entry(struct dentry *dentry, ...@@ -926,7 +924,7 @@ static struct buffer_head * ext3_dx_find_entry(struct dentry *dentry,
int namelen = dentry->d_name.len; int namelen = dentry->d_name.len;
const u8 *name = dentry->d_name.name; const u8 *name = dentry->d_name.name;
struct inode *dir = dentry->d_parent->d_inode; struct inode *dir = dentry->d_parent->d_inode;
sb = dir->i_sb; sb = dir->i_sb;
if (!(frame = dx_probe (dentry, 0, &hinfo, frames, err))) if (!(frame = dx_probe (dentry, 0, &hinfo, frames, err)))
return NULL; return NULL;
...@@ -963,7 +961,7 @@ static struct buffer_head * ext3_dx_find_entry(struct dentry *dentry, ...@@ -963,7 +961,7 @@ static struct buffer_head * ext3_dx_find_entry(struct dentry *dentry,
goto errout; goto errout;
} }
} while (retval == 1); } while (retval == 1);
*err = -ENOENT; *err = -ENOENT;
errout: errout:
dxtrace(printk("%s not found\n", name)); dxtrace(printk("%s not found\n", name));
...@@ -1191,7 +1189,7 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry, ...@@ -1191,7 +1189,7 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry,
unsigned short reclen; unsigned short reclen;
int nlen, rlen, err; int nlen, rlen, err;
char *top; char *top;
reclen = EXT3_DIR_REC_LEN(namelen); reclen = EXT3_DIR_REC_LEN(namelen);
if (!de) { if (!de) {
de = (struct ext3_dir_entry_2 *)bh->b_data; de = (struct ext3_dir_entry_2 *)bh->b_data;
...@@ -1223,7 +1221,7 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry, ...@@ -1223,7 +1221,7 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry,
brelse(bh); brelse(bh);
return err; return err;
} }
/* By now the buffer is marked for journaling */ /* By now the buffer is marked for journaling */
nlen = EXT3_DIR_REC_LEN(de->name_len); nlen = EXT3_DIR_REC_LEN(de->name_len);
rlen = le16_to_cpu(de->rec_len); rlen = le16_to_cpu(de->rec_len);
...@@ -1286,7 +1284,7 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry, ...@@ -1286,7 +1284,7 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
unsigned blocksize; unsigned blocksize;
struct dx_hash_info hinfo; struct dx_hash_info hinfo;
u32 block; u32 block;
blocksize = dir->i_sb->s_blocksize; blocksize = dir->i_sb->s_blocksize;
dxtrace(printk("Creating index\n")); dxtrace(printk("Creating index\n"));
retval = ext3_journal_get_write_access(handle, bh); retval = ext3_journal_get_write_access(handle, bh);
...@@ -1296,7 +1294,7 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry, ...@@ -1296,7 +1294,7 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
return retval; return retval;
} }
root = (struct dx_root *) bh->b_data; root = (struct dx_root *) bh->b_data;
EXT3_I(dir)->i_flags |= EXT3_INDEX_FL; EXT3_I(dir)->i_flags |= EXT3_INDEX_FL;
bh2 = ext3_append (handle, dir, &block, &retval); bh2 = ext3_append (handle, dir, &block, &retval);
if (!(bh2)) { if (!(bh2)) {
...@@ -1479,13 +1477,13 @@ static int ext3_dx_add_entry(handle_t *handle, struct dentry *dentry, ...@@ -1479,13 +1477,13 @@ static int ext3_dx_add_entry(handle_t *handle, struct dentry *dentry,
unsigned icount1 = icount/2, icount2 = icount - icount1; unsigned icount1 = icount/2, icount2 = icount - icount1;
unsigned hash2 = dx_get_hash(entries + icount1); unsigned hash2 = dx_get_hash(entries + icount1);
dxtrace(printk("Split index %i/%i\n", icount1, icount2)); dxtrace(printk("Split index %i/%i\n", icount1, icount2));
BUFFER_TRACE(frame->bh, "get_write_access"); /* index root */ BUFFER_TRACE(frame->bh, "get_write_access"); /* index root */
err = ext3_journal_get_write_access(handle, err = ext3_journal_get_write_access(handle,
frames[0].bh); frames[0].bh);
if (err) if (err)
goto journal_error; goto journal_error;
memcpy ((char *) entries2, (char *) (entries + icount1), memcpy ((char *) entries2, (char *) (entries + icount1),
icount2 * sizeof(struct dx_entry)); icount2 * sizeof(struct dx_entry));
dx_set_count (entries, icount1); dx_set_count (entries, icount1);
...@@ -1535,7 +1533,7 @@ static int ext3_dx_add_entry(handle_t *handle, struct dentry *dentry, ...@@ -1535,7 +1533,7 @@ static int ext3_dx_add_entry(handle_t *handle, struct dentry *dentry,
err = add_dirent_to_buf(handle, dentry, inode, de, bh); err = add_dirent_to_buf(handle, dentry, inode, de, bh);
bh = 0; bh = 0;
goto cleanup; goto cleanup;
journal_error: journal_error:
ext3_std_error(dir->i_sb, err); ext3_std_error(dir->i_sb, err);
cleanup: cleanup:
...@@ -1831,7 +1829,7 @@ int ext3_orphan_add(handle_t *handle, struct inode *inode) ...@@ -1831,7 +1829,7 @@ int ext3_orphan_add(handle_t *handle, struct inode *inode)
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;
struct ext3_iloc iloc; struct ext3_iloc iloc;
int err = 0, rc; int err = 0, rc;
lock_super(sb); lock_super(sb);
if (!list_empty(&EXT3_I(inode)->i_orphan)) if (!list_empty(&EXT3_I(inode)->i_orphan))
goto out_unlock; goto out_unlock;
...@@ -1852,7 +1850,7 @@ int ext3_orphan_add(handle_t *handle, struct inode *inode) ...@@ -1852,7 +1850,7 @@ int ext3_orphan_add(handle_t *handle, struct inode *inode)
err = ext3_journal_get_write_access(handle, EXT3_SB(sb)->s_sbh); err = ext3_journal_get_write_access(handle, EXT3_SB(sb)->s_sbh);
if (err) if (err)
goto out_unlock; goto out_unlock;
err = ext3_reserve_inode_write(handle, inode, &iloc); err = ext3_reserve_inode_write(handle, inode, &iloc);
if (err) if (err)
goto out_unlock; goto out_unlock;
...@@ -2045,7 +2043,7 @@ static int ext3_unlink(struct inode * dir, struct dentry *dentry) ...@@ -2045,7 +2043,7 @@ static int ext3_unlink(struct inode * dir, struct dentry *dentry)
retval = -EIO; retval = -EIO;
if (le32_to_cpu(de->inode) != inode->i_ino) if (le32_to_cpu(de->inode) != inode->i_ino)
goto end_unlink; goto end_unlink;
if (!inode->i_nlink) { if (!inode->i_nlink) {
ext3_warning (inode->i_sb, "ext3_unlink", ext3_warning (inode->i_sb, "ext3_unlink",
"Deleting nonexistent file (%lu), %d", "Deleting nonexistent file (%lu), %d",
...@@ -2251,7 +2249,7 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry, ...@@ -2251,7 +2249,7 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry,
*/ */
struct buffer_head *old_bh2; struct buffer_head *old_bh2;
struct ext3_dir_entry_2 *old_de2; struct ext3_dir_entry_2 *old_de2;
old_bh2 = ext3_find_entry(old_dentry, &old_de2); old_bh2 = ext3_find_entry(old_dentry, &old_de2);
if (old_bh2) { if (old_bh2) {
retval = ext3_delete_entry(handle, old_dir, retval = ext3_delete_entry(handle, old_dir,
...@@ -2316,9 +2314,9 @@ struct inode_operations ext3_dir_inode_operations = { ...@@ -2316,9 +2314,9 @@ struct inode_operations ext3_dir_inode_operations = {
.mknod = ext3_mknod, .mknod = ext3_mknod,
.rename = ext3_rename, .rename = ext3_rename,
.setattr = ext3_setattr, .setattr = ext3_setattr,
.setxattr = ext3_setxattr, .setxattr = ext3_setxattr,
.getxattr = ext3_getxattr, .getxattr = ext3_getxattr,
.listxattr = ext3_listxattr, .listxattr = ext3_listxattr,
.removexattr = ext3_removexattr, .removexattr = ext3_removexattr,
.permission = ext3_permission, .permission = ext3_permission,
}; };
......
...@@ -119,7 +119,7 @@ static void clear_ro_after(struct super_block *sb) ...@@ -119,7 +119,7 @@ static void clear_ro_after(struct super_block *sb)
handle_t *ext3_journal_start(struct inode *inode, int nblocks) handle_t *ext3_journal_start(struct inode *inode, int nblocks)
{ {
journal_t *journal; journal_t *journal;
if (inode->i_sb->s_flags & MS_RDONLY) if (inode->i_sb->s_flags & MS_RDONLY)
return ERR_PTR(-EROFS); return ERR_PTR(-EROFS);
...@@ -132,7 +132,7 @@ handle_t *ext3_journal_start(struct inode *inode, int nblocks) ...@@ -132,7 +132,7 @@ handle_t *ext3_journal_start(struct inode *inode, int nblocks)
"Detected aborted journal"); "Detected aborted journal");
return ERR_PTR(-EROFS); return ERR_PTR(-EROFS);
} }
return journal_start(journal, nblocks); return journal_start(journal, nblocks);
} }
...@@ -164,7 +164,7 @@ void ext3_journal_abort_handle(const char *caller, const char *err_fn, ...@@ -164,7 +164,7 @@ void ext3_journal_abort_handle(const char *caller, const char *err_fn,
{ {
char nbuf[16]; char nbuf[16];
const char *errstr = ext3_decode_error(NULL, err, nbuf); const char *errstr = ext3_decode_error(NULL, err, nbuf);
printk(KERN_ERR "%s: aborting transaction: %s in %s", printk(KERN_ERR "%s: aborting transaction: %s in %s",
caller, errstr, err_fn); caller, errstr, err_fn);
...@@ -236,7 +236,7 @@ void ext3_error (struct super_block * sb, const char * function, ...@@ -236,7 +236,7 @@ void ext3_error (struct super_block * sb, const char * function,
const char *ext3_decode_error(struct super_block * sb, int errno, char nbuf[16]) const char *ext3_decode_error(struct super_block * sb, int errno, char nbuf[16])
{ {
char *errstr = NULL; char *errstr = NULL;
switch (errno) { switch (errno) {
case -EIO: case -EIO:
errstr = "IO failure"; errstr = "IO failure";
...@@ -259,7 +259,6 @@ const char *ext3_decode_error(struct super_block * sb, int errno, char nbuf[16]) ...@@ -259,7 +259,6 @@ const char *ext3_decode_error(struct super_block * sb, int errno, char nbuf[16])
if (snprintf(nbuf, 16, "error %d", -errno) >= 0) if (snprintf(nbuf, 16, "error %d", -errno) >= 0)
errstr = nbuf; errstr = nbuf;
} }
break; break;
} }
...@@ -277,7 +276,7 @@ void __ext3_std_error (struct super_block * sb, const char * function, ...@@ -277,7 +276,7 @@ void __ext3_std_error (struct super_block * sb, const char * function,
printk (KERN_CRIT "EXT3-fs error (device %s) in %s: %s\n", printk (KERN_CRIT "EXT3-fs error (device %s) in %s: %s\n",
sb->s_id, function, errstr); sb->s_id, function, errstr);
ext3_handle_error(sb); ext3_handle_error(sb);
} }
...@@ -311,7 +310,7 @@ void ext3_abort (struct super_block * sb, const char * function, ...@@ -311,7 +310,7 @@ void ext3_abort (struct super_block * sb, const char * function,
if (sb->s_flags & MS_RDONLY) if (sb->s_flags & MS_RDONLY)
return; return;
printk (KERN_CRIT "Remounting filesystem read-only\n"); printk (KERN_CRIT "Remounting filesystem read-only\n");
EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS; EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS;
sb->s_flags |= MS_RDONLY; sb->s_flags |= MS_RDONLY;
...@@ -426,10 +425,10 @@ static inline struct inode *orphan_list_entry(struct list_head *l) ...@@ -426,10 +425,10 @@ static inline struct inode *orphan_list_entry(struct list_head *l)
static void dump_orphan_list(struct super_block *sb, struct ext3_sb_info *sbi) static void dump_orphan_list(struct super_block *sb, struct ext3_sb_info *sbi)
{ {
struct list_head *l; struct list_head *l;
printk(KERN_ERR "sb orphan head is %d\n", printk(KERN_ERR "sb orphan head is %d\n",
le32_to_cpu(sbi->s_es->s_last_orphan)); le32_to_cpu(sbi->s_es->s_last_orphan));
printk(KERN_ERR "sb_info orphan list:\n"); printk(KERN_ERR "sb_info orphan list:\n");
list_for_each(l, &sbi->s_orphan) { list_for_each(l, &sbi->s_orphan) {
struct inode *inode = orphan_list_entry(l); struct inode *inode = orphan_list_entry(l);
...@@ -1062,7 +1061,7 @@ static unsigned long descriptor_loc(struct super_block *sb, ...@@ -1062,7 +1061,7 @@ static unsigned long descriptor_loc(struct super_block *sb,
struct ext3_sb_info *sbi = EXT3_SB(sb); struct ext3_sb_info *sbi = EXT3_SB(sb);
unsigned long bg, first_data_block, first_meta_bg; unsigned long bg, first_data_block, first_meta_bg;
int has_super = 0; int has_super = 0;
first_data_block = le32_to_cpu(sbi->s_es->s_first_data_block); first_data_block = le32_to_cpu(sbi->s_es->s_first_data_block);
first_meta_bg = le32_to_cpu(sbi->s_es->s_first_meta_bg); first_meta_bg = le32_to_cpu(sbi->s_es->s_first_meta_bg);
...@@ -1138,7 +1137,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) ...@@ -1138,7 +1137,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
sb->s_id); sb->s_id);
goto failed_mount; goto failed_mount;
} }
/* Set defaults before we parse the mount options */ /* Set defaults before we parse the mount options */
def_mount_opts = le32_to_cpu(es->s_default_mount_opts); def_mount_opts = le32_to_cpu(es->s_default_mount_opts);
if (def_mount_opts & EXT3_DEFM_DEBUG) if (def_mount_opts & EXT3_DEFM_DEBUG)
...@@ -1162,7 +1161,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) ...@@ -1162,7 +1161,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
set_opt(sbi->s_mount_opt, ERRORS_PANIC); set_opt(sbi->s_mount_opt, ERRORS_PANIC);
else if (le16_to_cpu(sbi->s_es->s_errors) == EXT3_ERRORS_RO) else if (le16_to_cpu(sbi->s_es->s_errors) == EXT3_ERRORS_RO)
set_opt(sbi->s_mount_opt, ERRORS_RO); set_opt(sbi->s_mount_opt, ERRORS_RO);
sbi->s_resuid = le16_to_cpu(es->s_def_resuid); sbi->s_resuid = le16_to_cpu(es->s_def_resuid);
sbi->s_resgid = le16_to_cpu(es->s_def_resgid); sbi->s_resgid = le16_to_cpu(es->s_def_resgid);
...@@ -1539,7 +1538,7 @@ static journal_t *ext3_get_dev_journal(struct super_block *sb, ...@@ -1539,7 +1538,7 @@ static journal_t *ext3_get_dev_journal(struct super_block *sb,
"EXT3-fs: blocksize too small for journal device.\n"); "EXT3-fs: blocksize too small for journal device.\n");
goto out_bdev; goto out_bdev;
} }
sb_block = EXT3_MIN_BLOCK_SIZE / blocksize; sb_block = EXT3_MIN_BLOCK_SIZE / blocksize;
offset = EXT3_MIN_BLOCK_SIZE % blocksize; offset = EXT3_MIN_BLOCK_SIZE % blocksize;
set_blocksize(bdev, blocksize); set_blocksize(bdev, blocksize);
...@@ -1753,7 +1752,7 @@ static void ext3_clear_journal_err(struct super_block * sb, ...@@ -1753,7 +1752,7 @@ static void ext3_clear_journal_err(struct super_block * sb,
journal_t *journal; journal_t *journal;
int j_errno; int j_errno;
const char *errstr; const char *errstr;
journal = EXT3_SB(sb)->s_journal; journal = EXT3_SB(sb)->s_journal;
/* /*
...@@ -1764,13 +1763,13 @@ static void ext3_clear_journal_err(struct super_block * sb, ...@@ -1764,13 +1763,13 @@ static void ext3_clear_journal_err(struct super_block * sb,
j_errno = journal_errno(journal); j_errno = journal_errno(journal);
if (j_errno) { if (j_errno) {
char nbuf[16]; char nbuf[16];
errstr = ext3_decode_error(sb, j_errno, nbuf); errstr = ext3_decode_error(sb, j_errno, nbuf);
ext3_warning(sb, __FUNCTION__, "Filesystem error recorded " ext3_warning(sb, __FUNCTION__, "Filesystem error recorded "
"from previous mount: %s", errstr); "from previous mount: %s", errstr);
ext3_warning(sb, __FUNCTION__, "Marking fs in need of " ext3_warning(sb, __FUNCTION__, "Marking fs in need of "
"filesystem check."); "filesystem check.");
EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS; EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS;
es->s_state |= cpu_to_le16(EXT3_ERROR_FS); es->s_state |= cpu_to_le16(EXT3_ERROR_FS);
ext3_commit_super (sb, es, 1); ext3_commit_super (sb, es, 1);
...@@ -1886,7 +1885,7 @@ int ext3_remount (struct super_block * sb, int * flags, char * data) ...@@ -1886,7 +1885,7 @@ int ext3_remount (struct super_block * sb, int * flags, char * data)
es = sbi->s_es; es = sbi->s_es;
ext3_init_journal_params(sbi, sbi->s_journal); ext3_init_journal_params(sbi, sbi->s_journal);
if ((*flags & MS_RDONLY) != (sb->s_flags & MS_RDONLY)) { if ((*flags & MS_RDONLY) != (sb->s_flags & MS_RDONLY)) {
if (sbi->s_mount_opt & EXT3_MOUNT_ABORT) if (sbi->s_mount_opt & EXT3_MOUNT_ABORT)
return -EROFS; return -EROFS;
......
...@@ -481,7 +481,7 @@ ext3_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index, ...@@ -481,7 +481,7 @@ ext3_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
unsigned int name_len; unsigned int name_len;
int min_offs = sb->s_blocksize, not_found = 1, free, error; int min_offs = sb->s_blocksize, not_found = 1, free, error;
char *end; char *end;
/* /*
* header -- Points either into bh, or to a temporarily * header -- Points either into bh, or to a temporarily
* allocated buffer. * allocated buffer.
...@@ -493,7 +493,7 @@ ext3_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index, ...@@ -493,7 +493,7 @@ ext3_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
* towards the end of the block). * towards the end of the block).
* end -- Points right after the block pointed to by header. * end -- Points right after the block pointed to by header.
*/ */
ea_idebug(inode, "name=%d.%s, value=%p, value_len=%ld", ea_idebug(inode, "name=%d.%s, value=%p, value_len=%ld",
name_index, name, value, (long)value_len); name_index, name, value, (long)value_len);
...@@ -736,11 +736,11 @@ ext3_xattr_set_handle2(handle_t *handle, struct inode *inode, ...@@ -736,11 +736,11 @@ ext3_xattr_set_handle2(handle_t *handle, struct inode *inode,
ea_bdebug(new_bh, "%s block %ld", ea_bdebug(new_bh, "%s block %ld",
(old_bh == new_bh) ? "keeping" : "reusing", (old_bh == new_bh) ? "keeping" : "reusing",
new_bh->b_blocknr); new_bh->b_blocknr);
error = -EDQUOT; error = -EDQUOT;
if (DQUOT_ALLOC_BLOCK(inode, 1)) if (DQUOT_ALLOC_BLOCK(inode, 1))
goto cleanup; goto cleanup;
error = ext3_journal_get_write_access(handle, new_bh); error = ext3_journal_get_write_access(handle, new_bh);
if (error) if (error)
goto cleanup; goto cleanup;
...@@ -782,7 +782,7 @@ ext3_xattr_set_handle2(handle_t *handle, struct inode *inode, ...@@ -782,7 +782,7 @@ ext3_xattr_set_handle2(handle_t *handle, struct inode *inode,
set_buffer_uptodate(new_bh); set_buffer_uptodate(new_bh);
unlock_buffer(new_bh); unlock_buffer(new_bh);
ext3_xattr_cache_insert(new_bh); ext3_xattr_cache_insert(new_bh);
ext3_xattr_update_super_block(handle, sb); ext3_xattr_update_super_block(handle, sb);
} }
error = ext3_journal_dirty_metadata(handle, new_bh); error = ext3_journal_dirty_metadata(handle, new_bh);
...@@ -1108,7 +1108,7 @@ static void ext3_xattr_rehash(struct ext3_xattr_header *header, ...@@ -1108,7 +1108,7 @@ static void ext3_xattr_rehash(struct ext3_xattr_header *header,
{ {
struct ext3_xattr_entry *here; struct ext3_xattr_entry *here;
__u32 hash = 0; __u32 hash = 0;
ext3_xattr_hash_entry(header, entry); ext3_xattr_hash_entry(header, entry);
here = ENTRY(header+1); here = ENTRY(header+1);
while (!IS_LAST_ENTRY(here)) { while (!IS_LAST_ENTRY(here)) {
...@@ -1131,7 +1131,7 @@ int __init ...@@ -1131,7 +1131,7 @@ int __init
init_ext3_xattr(void) init_ext3_xattr(void)
{ {
int err; int err;
err = ext3_xattr_register(EXT3_XATTR_INDEX_USER, err = ext3_xattr_register(EXT3_XATTR_INDEX_USER,
&ext3_xattr_user_handler); &ext3_xattr_user_handler);
if (err) if (err)
......
...@@ -85,7 +85,7 @@ void __log_wait_for_space(journal_t *journal, int nblocks) ...@@ -85,7 +85,7 @@ void __log_wait_for_space(journal_t *journal, int nblocks)
return; return;
spin_unlock(&journal->j_state_lock); spin_unlock(&journal->j_state_lock);
down(&journal->j_checkpoint_sem); down(&journal->j_checkpoint_sem);
/* /*
* Test again, another process may have checkpointed while we * Test again, another process may have checkpointed while we
* were waiting for the checkpoint lock * were waiting for the checkpoint lock
...@@ -232,7 +232,7 @@ static int __flush_buffer(journal_t *journal, struct journal_head *jh, ...@@ -232,7 +232,7 @@ static int __flush_buffer(journal_t *journal, struct journal_head *jh,
if (buffer_dirty(bh) && !buffer_locked(bh) && jh->b_jlist == BJ_None) { if (buffer_dirty(bh) && !buffer_locked(bh) && jh->b_jlist == BJ_None) {
J_ASSERT_JH(jh, jh->b_transaction == NULL); J_ASSERT_JH(jh, jh->b_transaction == NULL);
/* /*
* Important: we are about to write the buffer, and * Important: we are about to write the buffer, and
* possibly block, while still holding the journal lock. * possibly block, while still holding the journal lock.
...@@ -267,7 +267,6 @@ static int __flush_buffer(journal_t *journal, struct journal_head *jh, ...@@ -267,7 +267,6 @@ static int __flush_buffer(journal_t *journal, struct journal_head *jh,
return ret; return ret;
} }
/* /*
* Perform an actual checkpoint. We don't write out only enough to * Perform an actual checkpoint. We don't write out only enough to
* satisfy the current blocked requests: rather we submit a reasonably * satisfy the current blocked requests: rather we submit a reasonably
...@@ -373,7 +372,7 @@ int log_do_checkpoint(journal_t *journal, int nblocks) ...@@ -373,7 +372,7 @@ int log_do_checkpoint(journal_t *journal, int nblocks)
result = cleanup_journal_tail(journal); result = cleanup_journal_tail(journal);
if (result < 0) if (result < 0)
return result; return result;
return 0; return 0;
} }
...@@ -524,7 +523,7 @@ void __journal_remove_checkpoint(struct journal_head *jh) ...@@ -524,7 +523,7 @@ void __journal_remove_checkpoint(struct journal_head *jh)
journal_t *journal; journal_t *journal;
JBUFFER_TRACE(jh, "entry"); JBUFFER_TRACE(jh, "entry");
if ((transaction = jh->b_cp_transaction) == NULL) { if ((transaction = jh->b_cp_transaction) == NULL) {
JBUFFER_TRACE(jh, "not on transaction"); JBUFFER_TRACE(jh, "not on transaction");
goto out; goto out;
......
...@@ -197,7 +197,7 @@ void journal_commit_transaction(journal_t *journal) ...@@ -197,7 +197,7 @@ void journal_commit_transaction(journal_t *journal)
commit_transaction->t_log_start = journal->j_head; commit_transaction->t_log_start = journal->j_head;
wake_up(&journal->j_wait_transaction_locked); wake_up(&journal->j_wait_transaction_locked);
spin_unlock(&journal->j_state_lock); spin_unlock(&journal->j_state_lock);
jbd_debug (3, "JBD: commit phase 2\n"); jbd_debug (3, "JBD: commit phase 2\n");
/* /*
...@@ -368,7 +368,7 @@ void journal_commit_transaction(journal_t *journal) ...@@ -368,7 +368,7 @@ void journal_commit_transaction(journal_t *journal)
__journal_abort_hard(journal); __journal_abort_hard(journal);
continue; continue;
} }
bh = jh2bh(descriptor); bh = jh2bh(descriptor);
jbd_debug(4, "JBD: got buffer %llu (%p)\n", jbd_debug(4, "JBD: got buffer %llu (%p)\n",
(unsigned long long)bh->b_blocknr, bh->b_data); (unsigned long long)bh->b_blocknr, bh->b_data);
...@@ -622,7 +622,7 @@ void journal_commit_transaction(journal_t *journal) ...@@ -622,7 +622,7 @@ void journal_commit_transaction(journal_t *journal)
if (err) if (err)
__journal_abort_hard(journal); __journal_abort_hard(journal);
/* /*
* Call any callbacks that had been registered for handles in this * Call any callbacks that had been registered for handles in this
* transaction. It is up to the callback to free any allocated * transaction. It is up to the callback to free any allocated
...@@ -714,7 +714,7 @@ void journal_commit_transaction(journal_t *journal) ...@@ -714,7 +714,7 @@ void journal_commit_transaction(journal_t *journal)
clear_buffer_freed(bh); clear_buffer_freed(bh);
clear_buffer_jbddirty(bh); clear_buffer_jbddirty(bh);
} }
if (buffer_jbddirty(bh)) { if (buffer_jbddirty(bh)) {
JBUFFER_TRACE(jh, "add to new checkpointing trans"); JBUFFER_TRACE(jh, "add to new checkpointing trans");
__journal_insert_checkpoint(jh, commit_transaction); __journal_insert_checkpoint(jh, commit_transaction);
......
...@@ -175,7 +175,6 @@ int kjournald(void *arg) ...@@ -175,7 +175,6 @@ int kjournald(void *arg)
spin_unlock(&journal->j_state_lock); spin_unlock(&journal->j_state_lock);
refrigerator(PF_IOTHREAD); refrigerator(PF_IOTHREAD);
spin_lock(&journal->j_state_lock); spin_lock(&journal->j_state_lock);
jbd_debug(1, "Resuming kjournald\n");
} else { } else {
/* /*
* We assume on resume that commits are already there, * We assume on resume that commits are already there,
...@@ -185,7 +184,7 @@ int kjournald(void *arg) ...@@ -185,7 +184,7 @@ int kjournald(void *arg)
int should_sleep = 1; int should_sleep = 1;
prepare_to_wait(&journal->j_wait_commit, &wait, prepare_to_wait(&journal->j_wait_commit, &wait,
TASK_INTERRUPTIBLE); TASK_INTERRUPTIBLE);
if (journal->j_commit_sequence != journal->j_commit_request) if (journal->j_commit_sequence != journal->j_commit_request)
should_sleep = 0; should_sleep = 0;
transaction = journal->j_running_transaction; transaction = journal->j_running_transaction;
...@@ -733,7 +732,7 @@ journal_t * journal_init_inode (struct inode *inode) ...@@ -733,7 +732,7 @@ journal_t * journal_init_inode (struct inode *inode)
kfree(journal); kfree(journal);
return NULL; return NULL;
} }
bh = __getblk(journal->j_dev, blocknr, journal->j_blocksize); bh = __getblk(journal->j_dev, blocknr, journal->j_blocksize);
J_ASSERT(bh != NULL); J_ASSERT(bh != NULL);
journal->j_sb_buffer = bh; journal->j_sb_buffer = bh;
...@@ -927,7 +926,7 @@ static int journal_get_superblock(journal_t *journal) ...@@ -927,7 +926,7 @@ static int journal_get_superblock(journal_t *journal)
struct buffer_head *bh; struct buffer_head *bh;
journal_superblock_t *sb; journal_superblock_t *sb;
int err = -EIO; int err = -EIO;
bh = journal->j_sb_buffer; bh = journal->j_sb_buffer;
J_ASSERT(bh != NULL); J_ASSERT(bh != NULL);
...@@ -944,7 +943,7 @@ static int journal_get_superblock(journal_t *journal) ...@@ -944,7 +943,7 @@ static int journal_get_superblock(journal_t *journal)
sb = journal->j_superblock; sb = journal->j_superblock;
err = -EINVAL; err = -EINVAL;
if (sb->s_header.h_magic != htonl(JFS_MAGIC_NUMBER) || if (sb->s_header.h_magic != htonl(JFS_MAGIC_NUMBER) ||
sb->s_blocksize != htonl(journal->j_blocksize)) { sb->s_blocksize != htonl(journal->j_blocksize)) {
printk(KERN_WARNING "JBD: no valid journal superblock found\n"); printk(KERN_WARNING "JBD: no valid journal superblock found\n");
...@@ -1263,7 +1262,7 @@ int journal_flush(journal_t *journal) ...@@ -1263,7 +1262,7 @@ int journal_flush(journal_t *journal)
unsigned long old_tail; unsigned long old_tail;
spin_lock(&journal->j_state_lock); spin_lock(&journal->j_state_lock);
/* Force everything buffered to the log... */ /* Force everything buffered to the log... */
if (journal->j_running_transaction) { if (journal->j_running_transaction) {
transaction = journal->j_running_transaction; transaction = journal->j_running_transaction;
...@@ -1541,7 +1540,7 @@ int journal_blocks_per_page(struct inode *inode) ...@@ -1541,7 +1540,7 @@ int journal_blocks_per_page(struct inode *inode)
*/ */
void * __jbd_kmalloc (const char *where, size_t size, int flags, int retry) void * __jbd_kmalloc (const char *where, size_t size, int flags, int retry)
{ {
return kmalloc(size, flags | (retry ? __GFP_NOFAIL : 0)); return kmalloc(size, flags | (retry ? __GFP_NOFAIL : 0));
} }
/* /*
......
...@@ -29,9 +29,9 @@ ...@@ -29,9 +29,9 @@
*/ */
struct recovery_info struct recovery_info
{ {
tid_t start_transaction; tid_t start_transaction;
tid_t end_transaction; tid_t end_transaction;
int nr_replays; int nr_replays;
int nr_revokes; int nr_revokes;
int nr_revoke_hits; int nr_revoke_hits;
...@@ -72,9 +72,9 @@ static int do_readahead(journal_t *journal, unsigned int start) ...@@ -72,9 +72,9 @@ static int do_readahead(journal_t *journal, unsigned int start)
unsigned int max, nbufs, next; unsigned int max, nbufs, next;
unsigned long blocknr; unsigned long blocknr;
struct buffer_head *bh; struct buffer_head *bh;
struct buffer_head * bufs[MAXBUF]; struct buffer_head * bufs[MAXBUF];
/* Do up to 128K of readahead */ /* Do up to 128K of readahead */
max = start + (128 * 1024 / journal->j_blocksize); max = start + (128 * 1024 / journal->j_blocksize);
if (max > journal->j_maxlen) if (max > journal->j_maxlen)
...@@ -82,9 +82,9 @@ static int do_readahead(journal_t *journal, unsigned int start) ...@@ -82,9 +82,9 @@ static int do_readahead(journal_t *journal, unsigned int start)
/* Do the readahead itself. We'll submit MAXBUF buffer_heads at /* Do the readahead itself. We'll submit MAXBUF buffer_heads at
* a time to the block device IO layer. */ * a time to the block device IO layer. */
nbufs = 0; nbufs = 0;
for (next = start; next < max; next++) { for (next = start; next < max; next++) {
err = journal_bmap(journal, next, &blocknr); err = journal_bmap(journal, next, &blocknr);
...@@ -115,7 +115,7 @@ static int do_readahead(journal_t *journal, unsigned int start) ...@@ -115,7 +115,7 @@ static int do_readahead(journal_t *journal, unsigned int start)
ll_rw_block(READ, nbufs, bufs); ll_rw_block(READ, nbufs, bufs);
err = 0; err = 0;
failed: failed:
if (nbufs) if (nbufs)
journal_brelse_array(bufs, nbufs); journal_brelse_array(bufs, nbufs);
return err; return err;
...@@ -138,7 +138,7 @@ static int jread(struct buffer_head **bhp, journal_t *journal, ...@@ -138,7 +138,7 @@ static int jread(struct buffer_head **bhp, journal_t *journal,
*bhp = NULL; *bhp = NULL;
J_ASSERT (offset < journal->j_maxlen); J_ASSERT (offset < journal->j_maxlen);
err = journal_bmap(journal, offset, &blocknr); err = journal_bmap(journal, offset, &blocknr);
if (err) { if (err) {
...@@ -224,10 +224,10 @@ int journal_recover(journal_t *journal) ...@@ -224,10 +224,10 @@ int journal_recover(journal_t *journal)
journal_superblock_t * sb; journal_superblock_t * sb;
struct recovery_info info; struct recovery_info info;
memset(&info, 0, sizeof(info)); memset(&info, 0, sizeof(info));
sb = journal->j_superblock; sb = journal->j_superblock;
/* /*
* The journal superblock's s_start field (the current log head) * The journal superblock's s_start field (the current log head)
* is always zero if, and only if, the journal was cleanly * is always zero if, and only if, the journal was cleanly
...@@ -240,7 +240,6 @@ int journal_recover(journal_t *journal) ...@@ -240,7 +240,6 @@ int journal_recover(journal_t *journal)
journal->j_transaction_sequence = ntohl(sb->s_sequence) + 1; journal->j_transaction_sequence = ntohl(sb->s_sequence) + 1;
return 0; return 0;
} }
err = do_one_pass(journal, &info, PASS_SCAN); err = do_one_pass(journal, &info, PASS_SCAN);
if (!err) if (!err)
...@@ -257,7 +256,7 @@ int journal_recover(journal_t *journal) ...@@ -257,7 +256,7 @@ int journal_recover(journal_t *journal)
/* Restart the log at the next transaction ID, thus invalidating /* Restart the log at the next transaction ID, thus invalidating
* any existing commit records in the log. */ * any existing commit records in the log. */
journal->j_transaction_sequence = ++info.end_transaction; journal->j_transaction_sequence = ++info.end_transaction;
journal_clear_revoke(journal); journal_clear_revoke(journal);
sync_blockdev(journal->j_fs_dev); sync_blockdev(journal->j_fs_dev);
return err; return err;
...@@ -282,10 +281,10 @@ int journal_skip_recovery(journal_t *journal) ...@@ -282,10 +281,10 @@ int journal_skip_recovery(journal_t *journal)
journal_superblock_t * sb; journal_superblock_t * sb;
struct recovery_info info; struct recovery_info info;
memset (&info, 0, sizeof(info)); memset (&info, 0, sizeof(info));
sb = journal->j_superblock; sb = journal->j_superblock;
err = do_one_pass(journal, &info, PASS_SCAN); err = do_one_pass(journal, &info, PASS_SCAN);
if (err) { if (err) {
...@@ -295,7 +294,6 @@ int journal_skip_recovery(journal_t *journal) ...@@ -295,7 +294,6 @@ int journal_skip_recovery(journal_t *journal)
#ifdef CONFIG_JBD_DEBUG #ifdef CONFIG_JBD_DEBUG
int dropped = info.end_transaction - ntohl(sb->s_sequence); int dropped = info.end_transaction - ntohl(sb->s_sequence);
#endif #endif
jbd_debug(0, jbd_debug(0,
"JBD: ignoring %d transaction%s from the journal.\n", "JBD: ignoring %d transaction%s from the journal.\n",
dropped, (dropped == 1) ? "" : "s"); dropped, (dropped == 1) ? "" : "s");
...@@ -303,14 +301,12 @@ int journal_skip_recovery(journal_t *journal) ...@@ -303,14 +301,12 @@ int journal_skip_recovery(journal_t *journal)
} }
journal->j_tail = 0; journal->j_tail = 0;
return err; return err;
} }
static int do_one_pass(journal_t *journal, static int do_one_pass(journal_t *journal,
struct recovery_info *info, enum passtype pass) struct recovery_info *info, enum passtype pass)
{ {
unsigned int first_commit_ID, next_commit_ID; unsigned int first_commit_ID, next_commit_ID;
unsigned long next_log_block; unsigned long next_log_block;
int err, success = 0; int err, success = 0;
...@@ -319,7 +315,7 @@ static int do_one_pass(journal_t *journal, ...@@ -319,7 +315,7 @@ static int do_one_pass(journal_t *journal,
struct buffer_head * bh; struct buffer_head * bh;
unsigned int sequence; unsigned int sequence;
int blocktype; int blocktype;
/* Precompute the maximum metadata descriptors in a descriptor block */ /* Precompute the maximum metadata descriptors in a descriptor block */
int MAX_BLOCKS_PER_DESC; int MAX_BLOCKS_PER_DESC;
MAX_BLOCKS_PER_DESC = ((journal->j_blocksize-sizeof(journal_header_t)) MAX_BLOCKS_PER_DESC = ((journal->j_blocksize-sizeof(journal_header_t))
...@@ -354,11 +350,11 @@ static int do_one_pass(journal_t *journal, ...@@ -354,11 +350,11 @@ static int do_one_pass(journal_t *journal,
journal_block_tag_t * tag; journal_block_tag_t * tag;
struct buffer_head * obh; struct buffer_head * obh;
struct buffer_head * nbh; struct buffer_head * nbh;
/* If we already know where to stop the log traversal, /* If we already know where to stop the log traversal,
* check right now that we haven't gone past the end of * check right now that we haven't gone past the end of
* the log. */ * the log. */
if (pass != PASS_SCAN) if (pass != PASS_SCAN)
if (tid_geq(next_commit_ID, info->end_transaction)) if (tid_geq(next_commit_ID, info->end_transaction))
break; break;
...@@ -369,7 +365,7 @@ static int do_one_pass(journal_t *journal, ...@@ -369,7 +365,7 @@ static int do_one_pass(journal_t *journal,
/* Skip over each chunk of the transaction looking /* Skip over each chunk of the transaction looking
* either the next descriptor block or the final commit * either the next descriptor block or the final commit
* record. */ * record. */
jbd_debug(3, "JBD: checking block %ld\n", next_log_block); jbd_debug(3, "JBD: checking block %ld\n", next_log_block);
err = jread(&bh, journal, next_log_block); err = jread(&bh, journal, next_log_block);
if (err) if (err)
...@@ -377,7 +373,7 @@ static int do_one_pass(journal_t *journal, ...@@ -377,7 +373,7 @@ static int do_one_pass(journal_t *journal,
next_log_block++; next_log_block++;
wrap(journal, next_log_block); wrap(journal, next_log_block);
/* What kind of buffer is it? /* What kind of buffer is it?
* *
* If it is a descriptor block, check that it has the * If it is a descriptor block, check that it has the
...@@ -385,7 +381,7 @@ static int do_one_pass(journal_t *journal, ...@@ -385,7 +381,7 @@ static int do_one_pass(journal_t *journal,
* here. */ * here. */
tmp = (journal_header_t *)bh->b_data; tmp = (journal_header_t *)bh->b_data;
if (tmp->h_magic != htonl(JFS_MAGIC_NUMBER)) { if (tmp->h_magic != htonl(JFS_MAGIC_NUMBER)) {
brelse(bh); brelse(bh);
break; break;
...@@ -395,12 +391,12 @@ static int do_one_pass(journal_t *journal, ...@@ -395,12 +391,12 @@ static int do_one_pass(journal_t *journal,
sequence = ntohl(tmp->h_sequence); sequence = ntohl(tmp->h_sequence);
jbd_debug(3, "Found magic %d, sequence %d\n", jbd_debug(3, "Found magic %d, sequence %d\n",
blocktype, sequence); blocktype, sequence);
if (sequence != next_commit_ID) { if (sequence != next_commit_ID) {
brelse(bh); brelse(bh);
break; break;
} }
/* OK, we have a valid descriptor block which matches /* OK, we have a valid descriptor block which matches
* all of the sequence number checks. What are we going * all of the sequence number checks. What are we going
* to do with it? That depends on the pass... */ * to do with it? That depends on the pass... */
...@@ -429,7 +425,7 @@ static int do_one_pass(journal_t *journal, ...@@ -429,7 +425,7 @@ static int do_one_pass(journal_t *journal,
tag = (journal_block_tag_t *) tagp; tag = (journal_block_tag_t *) tagp;
flags = ntohl(tag->t_flags); flags = ntohl(tag->t_flags);
io_block = next_log_block++; io_block = next_log_block++;
wrap(journal, next_log_block); wrap(journal, next_log_block);
err = jread(&obh, journal, io_block); err = jread(&obh, journal, io_block);
...@@ -443,7 +439,7 @@ static int do_one_pass(journal_t *journal, ...@@ -443,7 +439,7 @@ static int do_one_pass(journal_t *journal,
err, io_block); err, io_block);
} else { } else {
unsigned long blocknr; unsigned long blocknr;
J_ASSERT(obh != NULL); J_ASSERT(obh != NULL);
blocknr = ntohl(tag->t_blocknr); blocknr = ntohl(tag->t_blocknr);
...@@ -457,7 +453,7 @@ static int do_one_pass(journal_t *journal, ...@@ -457,7 +453,7 @@ static int do_one_pass(journal_t *journal,
++info->nr_revoke_hits; ++info->nr_revoke_hits;
goto skip_write; goto skip_write;
} }
/* Find a buffer for the new /* Find a buffer for the new
* data being restored */ * data being restored */
nbh = __getblk(journal->j_fs_dev, nbh = __getblk(journal->j_fs_dev,
...@@ -491,7 +487,7 @@ static int do_one_pass(journal_t *journal, ...@@ -491,7 +487,7 @@ static int do_one_pass(journal_t *journal,
brelse(obh); brelse(obh);
brelse(nbh); brelse(nbh);
} }
skip_write: skip_write:
tagp += sizeof(journal_block_tag_t); tagp += sizeof(journal_block_tag_t);
if (!(flags & JFS_FLAG_SAME_UUID)) if (!(flags & JFS_FLAG_SAME_UUID))
...@@ -500,7 +496,7 @@ static int do_one_pass(journal_t *journal, ...@@ -500,7 +496,7 @@ static int do_one_pass(journal_t *journal,
if (flags & JFS_FLAG_LAST_TAG) if (flags & JFS_FLAG_LAST_TAG)
break; break;
} }
brelse(bh); brelse(bh);
continue; continue;
...@@ -541,7 +537,7 @@ static int do_one_pass(journal_t *journal, ...@@ -541,7 +537,7 @@ static int do_one_pass(journal_t *journal,
* log. If the latter happened, then we know that the "current" * log. If the latter happened, then we know that the "current"
* transaction marks the end of the valid log. * transaction marks the end of the valid log.
*/ */
if (pass == PASS_SCAN) if (pass == PASS_SCAN)
info->end_transaction = next_commit_ID; info->end_transaction = next_commit_ID;
else { else {
...@@ -574,11 +570,11 @@ static int scan_revoke_records(journal_t *journal, struct buffer_head *bh, ...@@ -574,11 +570,11 @@ static int scan_revoke_records(journal_t *journal, struct buffer_head *bh,
header = (journal_revoke_header_t *) bh->b_data; header = (journal_revoke_header_t *) bh->b_data;
offset = sizeof(journal_revoke_header_t); offset = sizeof(journal_revoke_header_t);
max = ntohl(header->r_count); max = ntohl(header->r_count);
while (offset < max) { while (offset < max) {
unsigned long blocknr; unsigned long blocknr;
int err; int err;
blocknr = ntohl(* ((unsigned int *) (bh->b_data+offset))); blocknr = ntohl(* ((unsigned int *) (bh->b_data+offset)));
offset += 4; offset += 4;
err = journal_set_revoke(journal, blocknr, sequence); err = journal_set_revoke(journal, blocknr, sequence);
......
...@@ -81,7 +81,7 @@ struct jbd_revoke_record_s ...@@ -81,7 +81,7 @@ struct jbd_revoke_record_s
{ {
struct list_head hash; struct list_head hash;
tid_t sequence; /* Used for recovery only */ tid_t sequence; /* Used for recovery only */
unsigned long blocknr; unsigned long blocknr;
}; };
...@@ -110,7 +110,7 @@ static inline int hash(journal_t *journal, unsigned long block) ...@@ -110,7 +110,7 @@ static inline int hash(journal_t *journal, unsigned long block)
{ {
struct jbd_revoke_table_s *table = journal->j_revoke; struct jbd_revoke_table_s *table = journal->j_revoke;
int hash_shift = table->hash_shift; int hash_shift = table->hash_shift;
return ((block << (hash_shift - 6)) ^ return ((block << (hash_shift - 6)) ^
(block >> 13) ^ (block >> 13) ^
(block << (hash_shift - 12))) & (table->hash_size - 1); (block << (hash_shift - 12))) & (table->hash_size - 1);
...@@ -149,7 +149,7 @@ static struct jbd_revoke_record_s *find_revoke_record(journal_t *journal, ...@@ -149,7 +149,7 @@ static struct jbd_revoke_record_s *find_revoke_record(journal_t *journal,
{ {
struct list_head *hash_list; struct list_head *hash_list;
struct jbd_revoke_record_s *record; struct jbd_revoke_record_s *record;
hash_list = &journal->j_revoke->hash_table[hash(journal, blocknr)]; hash_list = &journal->j_revoke->hash_table[hash(journal, blocknr)];
spin_lock(&journal->j_revoke_lock); spin_lock(&journal->j_revoke_lock);
...@@ -161,7 +161,7 @@ static struct jbd_revoke_record_s *find_revoke_record(journal_t *journal, ...@@ -161,7 +161,7 @@ static struct jbd_revoke_record_s *find_revoke_record(journal_t *journal,
} }
record = (struct jbd_revoke_record_s *) record->hash.next; record = (struct jbd_revoke_record_s *) record->hash.next;
} }
spin_unlock(&journal->j_revoke_lock); spin_unlock(&journal->j_revoke_lock);
return NULL; return NULL;
} }
...@@ -182,7 +182,7 @@ int __init journal_init_revoke_caches(void) ...@@ -182,7 +182,7 @@ int __init journal_init_revoke_caches(void)
return -ENOMEM; return -ENOMEM;
} }
return 0; return 0;
} }
void journal_destroy_revoke_caches(void) void journal_destroy_revoke_caches(void)
{ {
...@@ -197,9 +197,9 @@ void journal_destroy_revoke_caches(void) ...@@ -197,9 +197,9 @@ void journal_destroy_revoke_caches(void)
int journal_init_revoke(journal_t *journal, int hash_size) int journal_init_revoke(journal_t *journal, int hash_size)
{ {
int shift, tmp; int shift, tmp;
J_ASSERT (journal->j_revoke_table[0] == NULL); J_ASSERT (journal->j_revoke_table[0] == NULL);
shift = 0; shift = 0;
tmp = hash_size; tmp = hash_size;
while((tmp >>= 1UL) != 0UL) while((tmp >>= 1UL) != 0UL)
...@@ -209,7 +209,7 @@ int journal_init_revoke(journal_t *journal, int hash_size) ...@@ -209,7 +209,7 @@ int journal_init_revoke(journal_t *journal, int hash_size)
if (!journal->j_revoke_table[0]) if (!journal->j_revoke_table[0])
return -ENOMEM; return -ENOMEM;
journal->j_revoke = journal->j_revoke_table[0]; journal->j_revoke = journal->j_revoke_table[0];
/* Check that the hash_size is a power of two */ /* Check that the hash_size is a power of two */
J_ASSERT ((hash_size & (hash_size-1)) == 0); J_ASSERT ((hash_size & (hash_size-1)) == 0);
...@@ -224,19 +224,19 @@ int journal_init_revoke(journal_t *journal, int hash_size) ...@@ -224,19 +224,19 @@ int journal_init_revoke(journal_t *journal, int hash_size)
journal->j_revoke = NULL; journal->j_revoke = NULL;
return -ENOMEM; return -ENOMEM;
} }
for (tmp = 0; tmp < hash_size; tmp++) for (tmp = 0; tmp < hash_size; tmp++)
INIT_LIST_HEAD(&journal->j_revoke->hash_table[tmp]); INIT_LIST_HEAD(&journal->j_revoke->hash_table[tmp]);
journal->j_revoke_table[1] = kmem_cache_alloc(revoke_table_cache, GFP_KERNEL); journal->j_revoke_table[1] = kmem_cache_alloc(revoke_table_cache, GFP_KERNEL);
if (!journal->j_revoke_table[1]) { if (!journal->j_revoke_table[1]) {
kfree(journal->j_revoke_table[0]->hash_table); kfree(journal->j_revoke_table[0]->hash_table);
kmem_cache_free(revoke_table_cache, journal->j_revoke_table[0]); kmem_cache_free(revoke_table_cache, journal->j_revoke_table[0]);
return -ENOMEM; return -ENOMEM;
} }
journal->j_revoke = journal->j_revoke_table[1]; journal->j_revoke = journal->j_revoke_table[1];
/* Check that the hash_size is a power of two */ /* Check that the hash_size is a power of two */
J_ASSERT ((hash_size & (hash_size-1)) == 0); J_ASSERT ((hash_size & (hash_size-1)) == 0);
...@@ -253,7 +253,7 @@ int journal_init_revoke(journal_t *journal, int hash_size) ...@@ -253,7 +253,7 @@ int journal_init_revoke(journal_t *journal, int hash_size)
journal->j_revoke = NULL; journal->j_revoke = NULL;
return -ENOMEM; return -ENOMEM;
} }
for (tmp = 0; tmp < hash_size; tmp++) for (tmp = 0; tmp < hash_size; tmp++)
INIT_LIST_HEAD(&journal->j_revoke->hash_table[tmp]); INIT_LIST_HEAD(&journal->j_revoke->hash_table[tmp]);
...@@ -269,16 +269,16 @@ void journal_destroy_revoke(journal_t *journal) ...@@ -269,16 +269,16 @@ void journal_destroy_revoke(journal_t *journal)
struct jbd_revoke_table_s *table; struct jbd_revoke_table_s *table;
struct list_head *hash_list; struct list_head *hash_list;
int i; int i;
table = journal->j_revoke_table[0]; table = journal->j_revoke_table[0];
if (!table) if (!table)
return; return;
for (i=0; i<table->hash_size; i++) { for (i=0; i<table->hash_size; i++) {
hash_list = &table->hash_table[i]; hash_list = &table->hash_table[i];
J_ASSERT (list_empty(hash_list)); J_ASSERT (list_empty(hash_list));
} }
kfree(table->hash_table); kfree(table->hash_table);
kmem_cache_free(revoke_table_cache, table); kmem_cache_free(revoke_table_cache, table);
journal->j_revoke = NULL; journal->j_revoke = NULL;
...@@ -286,12 +286,12 @@ void journal_destroy_revoke(journal_t *journal) ...@@ -286,12 +286,12 @@ void journal_destroy_revoke(journal_t *journal)
table = journal->j_revoke_table[1]; table = journal->j_revoke_table[1];
if (!table) if (!table)
return; return;
for (i=0; i<table->hash_size; i++) { for (i=0; i<table->hash_size; i++) {
hash_list = &table->hash_table[i]; hash_list = &table->hash_table[i];
J_ASSERT (list_empty(hash_list)); J_ASSERT (list_empty(hash_list));
} }
kfree(table->hash_table); kfree(table->hash_table);
kmem_cache_free(revoke_table_cache, table); kmem_cache_free(revoke_table_cache, table);
journal->j_revoke = NULL; journal->j_revoke = NULL;
...@@ -420,7 +420,7 @@ int journal_cancel_revoke(handle_t *handle, struct journal_head *jh) ...@@ -420,7 +420,7 @@ int journal_cancel_revoke(handle_t *handle, struct journal_head *jh)
int need_cancel; int need_cancel;
int did_revoke = 0; /* akpm: debug */ int did_revoke = 0; /* akpm: debug */
struct buffer_head *bh = jh2bh(jh); struct buffer_head *bh = jh2bh(jh);
jbd_debug(4, "journal_head %p, cancelling revoke\n", jh); jbd_debug(4, "journal_head %p, cancelling revoke\n", jh);
/* Is the existing Revoke bit valid? If so, we trust it, and /* Is the existing Revoke bit valid? If so, we trust it, and
...@@ -466,7 +466,6 @@ int journal_cancel_revoke(handle_t *handle, struct journal_head *jh) ...@@ -466,7 +466,6 @@ int journal_cancel_revoke(handle_t *handle, struct journal_head *jh)
__brelse(bh2); __brelse(bh2);
} }
} }
return did_revoke; return did_revoke;
} }
...@@ -482,7 +481,7 @@ void journal_switch_revoke_table(journal_t *journal) ...@@ -482,7 +481,7 @@ void journal_switch_revoke_table(journal_t *journal)
journal->j_revoke = journal->j_revoke_table[1]; journal->j_revoke = journal->j_revoke_table[1];
else else
journal->j_revoke = journal->j_revoke_table[0]; journal->j_revoke = journal->j_revoke_table[0];
for (i = 0; i < journal->j_revoke->hash_size; i++) for (i = 0; i < journal->j_revoke->hash_size; i++)
INIT_LIST_HEAD(&journal->j_revoke->hash_table[i]); INIT_LIST_HEAD(&journal->j_revoke->hash_table[i]);
} }
...@@ -506,11 +505,11 @@ void journal_write_revoke_records(journal_t *journal, ...@@ -506,11 +505,11 @@ void journal_write_revoke_records(journal_t *journal,
descriptor = NULL; descriptor = NULL;
offset = 0; offset = 0;
count = 0; count = 0;
/* select revoke table for committing transaction */ /* select revoke table for committing transaction */
revoke = journal->j_revoke == journal->j_revoke_table[0] ? revoke = journal->j_revoke == journal->j_revoke_table[0] ?
journal->j_revoke_table[1] : journal->j_revoke_table[0]; journal->j_revoke_table[1] : journal->j_revoke_table[0];
for (i = 0; i < revoke->hash_size; i++) { for (i = 0; i < revoke->hash_size; i++) {
hash_list = &revoke->hash_table[i]; hash_list = &revoke->hash_table[i];
...@@ -562,7 +561,7 @@ static void write_one_revoke_record(journal_t *journal, ...@@ -562,7 +561,7 @@ static void write_one_revoke_record(journal_t *journal,
descriptor = NULL; descriptor = NULL;
} }
} }
if (!descriptor) { if (!descriptor) {
descriptor = journal_get_descriptor_buffer(journal); descriptor = journal_get_descriptor_buffer(journal);
if (!descriptor) if (!descriptor)
...@@ -579,7 +578,7 @@ static void write_one_revoke_record(journal_t *journal, ...@@ -579,7 +578,7 @@ static void write_one_revoke_record(journal_t *journal,
offset = sizeof(journal_revoke_header_t); offset = sizeof(journal_revoke_header_t);
*descriptorp = descriptor; *descriptorp = descriptor;
} }
* ((unsigned int *)(&jh2bh(descriptor)->b_data[offset])) = * ((unsigned int *)(&jh2bh(descriptor)->b_data[offset])) =
htonl(record->blocknr); htonl(record->blocknr);
offset += 4; offset += 4;
...@@ -604,7 +603,7 @@ static void flush_descriptor(journal_t *journal, ...@@ -604,7 +603,7 @@ static void flush_descriptor(journal_t *journal,
__brelse(jh2bh(descriptor)); __brelse(jh2bh(descriptor));
return; return;
} }
header = (journal_revoke_header_t *) jh2bh(descriptor)->b_data; header = (journal_revoke_header_t *) jh2bh(descriptor)->b_data;
header->r_count = htonl(offset); header->r_count = htonl(offset);
set_bit(BH_JWrite, &jh2bh(descriptor)->b_state); set_bit(BH_JWrite, &jh2bh(descriptor)->b_state);
...@@ -645,7 +644,7 @@ int journal_set_revoke(journal_t *journal, ...@@ -645,7 +644,7 @@ int journal_set_revoke(journal_t *journal,
tid_t sequence) tid_t sequence)
{ {
struct jbd_revoke_record_s *record; struct jbd_revoke_record_s *record;
record = find_revoke_record(journal, blocknr); record = find_revoke_record(journal, blocknr);
if (record) { if (record) {
/* If we have multiple occurrences, only record the /* If we have multiple occurrences, only record the
...@@ -669,7 +668,7 @@ int journal_test_revoke(journal_t *journal, ...@@ -669,7 +668,7 @@ int journal_test_revoke(journal_t *journal,
tid_t sequence) tid_t sequence)
{ {
struct jbd_revoke_record_s *record; struct jbd_revoke_record_s *record;
record = find_revoke_record(journal, blocknr); record = find_revoke_record(journal, blocknr);
if (!record) if (!record)
return 0; return 0;
...@@ -689,9 +688,9 @@ void journal_clear_revoke(journal_t *journal) ...@@ -689,9 +688,9 @@ void journal_clear_revoke(journal_t *journal)
struct list_head *hash_list; struct list_head *hash_list;
struct jbd_revoke_record_s *record; struct jbd_revoke_record_s *record;
struct jbd_revoke_table_s *revoke; struct jbd_revoke_table_s *revoke;
revoke = journal->j_revoke; revoke = journal->j_revoke;
for (i = 0; i < revoke->hash_size; i++) { for (i = 0; i < revoke->hash_size; i++) {
hash_list = &revoke->hash_table[i]; hash_list = &revoke->hash_table[i];
while (!list_empty(hash_list)) { while (!list_empty(hash_list)) {
...@@ -701,4 +700,3 @@ void journal_clear_revoke(journal_t *journal) ...@@ -701,4 +700,3 @@ void journal_clear_revoke(journal_t *journal)
} }
} }
} }
...@@ -57,7 +57,7 @@ get_transaction(journal_t *journal, transaction_t *transaction) ...@@ -57,7 +57,7 @@ get_transaction(journal_t *journal, transaction_t *transaction)
/* Set up the commit timer for the new transaction. */ /* Set up the commit timer for the new transaction. */
journal->j_commit_timer->expires = transaction->t_expires; journal->j_commit_timer->expires = transaction->t_expires;
add_timer(journal->j_commit_timer); add_timer(journal->j_commit_timer);
J_ASSERT(journal->j_running_transaction == NULL); J_ASSERT(journal->j_running_transaction == NULL);
journal->j_running_transaction = transaction; journal->j_running_transaction = transaction;
...@@ -130,7 +130,7 @@ static int start_this_handle(journal_t *journal, handle_t *handle) ...@@ -130,7 +130,7 @@ static int start_this_handle(journal_t *journal, handle_t *handle)
journal->j_barrier_count == 0); journal->j_barrier_count == 0);
goto repeat; goto repeat;
} }
if (!journal->j_running_transaction) { if (!journal->j_running_transaction) {
if (!new_transaction) { if (!new_transaction) {
spin_unlock(&journal->j_state_lock); spin_unlock(&journal->j_state_lock);
...@@ -153,7 +153,7 @@ static int start_this_handle(journal_t *journal, handle_t *handle) ...@@ -153,7 +153,7 @@ static int start_this_handle(journal_t *journal, handle_t *handle)
transaction->t_state != T_LOCKED); transaction->t_state != T_LOCKED);
goto repeat; goto repeat;
} }
/* /*
* If there is not enough space left in the log to write all potential * If there is not enough space left in the log to write all potential
* buffers requested by this operation, we need to stall pending a log * buffers requested by this operation, we need to stall pending a log
...@@ -210,7 +210,7 @@ static int start_this_handle(journal_t *journal, handle_t *handle) ...@@ -210,7 +210,7 @@ static int start_this_handle(journal_t *journal, handle_t *handle)
if (journal->j_committing_transaction) if (journal->j_committing_transaction)
needed += journal->j_committing_transaction-> needed += journal->j_committing_transaction->
t_outstanding_credits; t_outstanding_credits;
if (__log_space_left(journal) < needed) { if (__log_space_left(journal) < needed) {
jbd_debug(2, "Handle %p waiting for checkpoint...\n", handle); jbd_debug(2, "Handle %p waiting for checkpoint...\n", handle);
spin_unlock(&transaction->t_handle_lock); spin_unlock(&transaction->t_handle_lock);
...@@ -268,7 +268,7 @@ handle_t *journal_start(journal_t *journal, int nblocks) ...@@ -268,7 +268,7 @@ handle_t *journal_start(journal_t *journal, int nblocks)
{ {
handle_t *handle = journal_current_handle(); handle_t *handle = journal_current_handle();
int err; int err;
if (!journal) if (!journal)
return ERR_PTR(-EROFS); return ERR_PTR(-EROFS);
...@@ -337,7 +337,7 @@ int journal_extend(handle_t *handle, int nblocks) ...@@ -337,7 +337,7 @@ int journal_extend(handle_t *handle, int nblocks)
spin_lock(&transaction->t_handle_lock); spin_lock(&transaction->t_handle_lock);
wanted = transaction->t_outstanding_credits + nblocks; wanted = transaction->t_outstanding_credits + nblocks;
if (wanted > journal->j_max_transaction_buffers) { if (wanted > journal->j_max_transaction_buffers) {
jbd_debug(3, "denied handle %p %d blocks: " jbd_debug(3, "denied handle %p %d blocks: "
"transaction too large\n", handle, nblocks); "transaction too large\n", handle, nblocks);
...@@ -349,7 +349,7 @@ int journal_extend(handle_t *handle, int nblocks) ...@@ -349,7 +349,7 @@ int journal_extend(handle_t *handle, int nblocks)
"insufficient log space\n", handle, nblocks); "insufficient log space\n", handle, nblocks);
goto unlock; goto unlock;
} }
handle->h_buffer_credits += nblocks; handle->h_buffer_credits += nblocks;
transaction->t_outstanding_credits += nblocks; transaction->t_outstanding_credits += nblocks;
result = 0; result = 0;
...@@ -388,7 +388,7 @@ int journal_restart(handle_t *handle, int nblocks) ...@@ -388,7 +388,7 @@ int journal_restart(handle_t *handle, int nblocks)
* actually doing the restart! */ * actually doing the restart! */
if (is_handle_aborted(handle)) if (is_handle_aborted(handle))
return 0; return 0;
/* /*
* First unlink the handle from its current transaction, and start the * First unlink the handle from its current transaction, and start the
* commit on that. * commit on that.
...@@ -496,7 +496,7 @@ static void jbd_unexpected_dirty_buffer(struct journal_head *jh) ...@@ -496,7 +496,7 @@ static void jbd_unexpected_dirty_buffer(struct journal_head *jh)
{ {
struct buffer_head *bh = jh2bh(jh); struct buffer_head *bh = jh2bh(jh);
int jlist; int jlist;
if (buffer_dirty(bh)) { if (buffer_dirty(bh)) {
/* If this buffer is one which might reasonably be dirty /* If this buffer is one which might reasonably be dirty
* --- ie. data, or not part of this journal --- then * --- ie. data, or not part of this journal --- then
...@@ -504,7 +504,7 @@ static void jbd_unexpected_dirty_buffer(struct journal_head *jh) ...@@ -504,7 +504,7 @@ static void jbd_unexpected_dirty_buffer(struct journal_head *jh)
* move the dirty bit to the journal's own internal * move the dirty bit to the journal's own internal
* JBDDirty bit. */ * JBDDirty bit. */
jlist = jh->b_jlist; jlist = jh->b_jlist;
if (jlist == BJ_Metadata || jlist == BJ_Reserved || if (jlist == BJ_Metadata || jlist == BJ_Reserved ||
jlist == BJ_Shadow || jlist == BJ_Forget) { jlist == BJ_Shadow || jlist == BJ_Forget) {
if (test_clear_buffer_dirty(jh2bh(jh))) { if (test_clear_buffer_dirty(jh2bh(jh))) {
...@@ -609,7 +609,7 @@ do_get_write_access(handle_t *handle, struct journal_head *jh, ...@@ -609,7 +609,7 @@ do_get_write_access(handle_t *handle, struct journal_head *jh,
(*credits)++; (*credits)++;
goto done_locked; goto done_locked;
} }
/* Is there data here we need to preserve? */ /* Is there data here we need to preserve? */
if (jh->b_transaction && jh->b_transaction != transaction) { if (jh->b_transaction && jh->b_transaction != transaction) {
...@@ -638,7 +638,7 @@ do_get_write_access(handle_t *handle, struct journal_head *jh, ...@@ -638,7 +638,7 @@ do_get_write_access(handle_t *handle, struct journal_head *jh,
wait_event(*wqh, (jh->b_jlist != BJ_Shadow)); wait_event(*wqh, (jh->b_jlist != BJ_Shadow));
goto repeat; goto repeat;
} }
/* Only do the copy if the currently-owning transaction /* Only do the copy if the currently-owning transaction
* still needs it. If it is on the Forget list, the * still needs it. If it is on the Forget list, the
* committing transaction is past that stage. The * committing transaction is past that stage. The
...@@ -697,7 +697,7 @@ do_get_write_access(handle_t *handle, struct journal_head *jh, ...@@ -697,7 +697,7 @@ do_get_write_access(handle_t *handle, struct journal_head *jh,
JBUFFER_TRACE(jh, "file as BJ_Reserved"); JBUFFER_TRACE(jh, "file as BJ_Reserved");
__journal_file_buffer(jh, transaction, BJ_Reserved); __journal_file_buffer(jh, transaction, BJ_Reserved);
} }
done_locked: done_locked:
spin_unlock(&journal->j_list_lock); spin_unlock(&journal->j_list_lock);
if (need_copy) { if (need_copy) {
...@@ -778,13 +778,13 @@ int journal_get_create_access(handle_t *handle, struct buffer_head *bh) ...@@ -778,13 +778,13 @@ int journal_get_create_access(handle_t *handle, struct buffer_head *bh)
journal_t *journal = transaction->t_journal; journal_t *journal = transaction->t_journal;
struct journal_head *jh = journal_add_journal_head(bh); struct journal_head *jh = journal_add_journal_head(bh);
int err; int err;
jbd_debug(5, "journal_head %p\n", jh); jbd_debug(5, "journal_head %p\n", jh);
err = -EROFS; err = -EROFS;
if (is_handle_aborted(handle)) if (is_handle_aborted(handle))
goto out; goto out;
err = 0; err = 0;
JBUFFER_TRACE(jh, "entry"); JBUFFER_TRACE(jh, "entry");
/* /*
* The buffer may already belong to this transaction due to pre-zeroing * The buffer may already belong to this transaction due to pre-zeroing
...@@ -932,7 +932,7 @@ int journal_dirty_data(handle_t *handle, struct buffer_head *bh) ...@@ -932,7 +932,7 @@ int journal_dirty_data(handle_t *handle, struct buffer_head *bh)
if (is_handle_aborted(handle)) if (is_handle_aborted(handle))
return 0; return 0;
jh = journal_add_journal_head(bh); jh = journal_add_journal_head(bh);
JBUFFER_TRACE(jh, "entry"); JBUFFER_TRACE(jh, "entry");
...@@ -1098,7 +1098,7 @@ int journal_dirty_metadata(handle_t *handle, struct buffer_head *bh) ...@@ -1098,7 +1098,7 @@ int journal_dirty_metadata(handle_t *handle, struct buffer_head *bh)
JBUFFER_TRACE(jh, "entry"); JBUFFER_TRACE(jh, "entry");
if (is_handle_aborted(handle)) if (is_handle_aborted(handle))
goto out; goto out;
jbd_lock_bh_state(bh); jbd_lock_bh_state(bh);
/* /*
...@@ -1130,7 +1130,7 @@ int journal_dirty_metadata(handle_t *handle, struct buffer_head *bh) ...@@ -1130,7 +1130,7 @@ int journal_dirty_metadata(handle_t *handle, struct buffer_head *bh)
set_buffer_jbddirty(bh); set_buffer_jbddirty(bh);
J_ASSERT_JH(jh, jh->b_transaction != NULL); J_ASSERT_JH(jh, jh->b_transaction != NULL);
/* /*
* Metadata already on the current transaction list doesn't * Metadata already on the current transaction list doesn't
* need to be filed. Metadata on another transaction's list must * need to be filed. Metadata on another transaction's list must
...@@ -1272,7 +1272,6 @@ void journal_forget(handle_t *handle, struct buffer_head *bh) ...@@ -1272,7 +1272,6 @@ void journal_forget(handle_t *handle, struct buffer_head *bh)
return; return;
} }
} }
} else if (jh->b_transaction) { } else if (jh->b_transaction) {
J_ASSERT_JH(jh, (jh->b_transaction == J_ASSERT_JH(jh, (jh->b_transaction ==
journal->j_committing_transaction)); journal->j_committing_transaction));
...@@ -1346,18 +1345,18 @@ int journal_stop(handle_t *handle) ...@@ -1346,18 +1345,18 @@ int journal_stop(handle_t *handle)
transaction_t *transaction = handle->h_transaction; transaction_t *transaction = handle->h_transaction;
journal_t *journal = transaction->t_journal; journal_t *journal = transaction->t_journal;
int old_handle_count, err; int old_handle_count, err;
if (!handle) if (!handle)
return 0; return 0;
J_ASSERT(transaction->t_updates > 0); J_ASSERT(transaction->t_updates > 0);
J_ASSERT(journal_current_handle() == handle); J_ASSERT(journal_current_handle() == handle);
if (is_handle_aborted(handle)) if (is_handle_aborted(handle))
err = -EIO; err = -EIO;
else else
err = 0; err = 0;
if (--handle->h_ref > 0) { if (--handle->h_ref > 0) {
jbd_debug(4, "h_ref %d -> %d\n", handle->h_ref + 1, jbd_debug(4, "h_ref %d -> %d\n", handle->h_ref + 1,
handle->h_ref); handle->h_ref);
...@@ -1413,7 +1412,7 @@ int journal_stop(handle_t *handle) ...@@ -1413,7 +1412,7 @@ int journal_stop(handle_t *handle)
* completes the commit thread, it just doesn't write * completes the commit thread, it just doesn't write
* anything to disk. */ * anything to disk. */
tid_t tid = transaction->t_tid; tid_t tid = transaction->t_tid;
spin_unlock(&transaction->t_handle_lock); spin_unlock(&transaction->t_handle_lock);
jbd_debug(2, "transaction too old, requesting commit for " jbd_debug(2, "transaction too old, requesting commit for "
"handle %p\n", handle); "handle %p\n", handle);
...@@ -1563,7 +1562,7 @@ void __journal_unfile_buffer(struct journal_head *jh) ...@@ -1563,7 +1562,7 @@ void __journal_unfile_buffer(struct journal_head *jh)
list = &transaction->t_reserved_list; list = &transaction->t_reserved_list;
break; break;
} }
__blist_del_buffer(list, jh); __blist_del_buffer(list, jh);
jh->b_jlist = BJ_None; jh->b_jlist = BJ_None;
if (test_clear_buffer_jbddirty(bh)) if (test_clear_buffer_jbddirty(bh))
...@@ -1811,7 +1810,7 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh) ...@@ -1811,7 +1810,7 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
JBUFFER_TRACE(jh, "not on any transaction: zap"); JBUFFER_TRACE(jh, "not on any transaction: zap");
goto zap_buffer; goto zap_buffer;
} }
if (!buffer_dirty(bh)) { if (!buffer_dirty(bh)) {
/* bdflush has written it. We can drop it now */ /* bdflush has written it. We can drop it now */
goto zap_buffer; goto zap_buffer;
...@@ -1910,7 +1909,7 @@ int journal_invalidatepage(journal_t *journal, ...@@ -1910,7 +1909,7 @@ int journal_invalidatepage(journal_t *journal,
struct buffer_head *head, *bh, *next; struct buffer_head *head, *bh, *next;
unsigned int curr_off = 0; unsigned int curr_off = 0;
int may_free = 1; int may_free = 1;
if (!PageLocked(page)) if (!PageLocked(page))
BUG(); BUG();
if (!page_has_buffers(page)) if (!page_has_buffers(page))
...@@ -1967,7 +1966,7 @@ void __journal_file_buffer(struct journal_head *jh, ...@@ -1967,7 +1966,7 @@ void __journal_file_buffer(struct journal_head *jh,
if (jh->b_transaction && jh->b_jlist == jlist) if (jh->b_transaction && jh->b_jlist == jlist)
return; return;
/* The following list of buffer states needs to be consistent /* The following list of buffer states needs to be consistent
* with __jbd_unexpected_dirty_buffer()'s handling of dirty * with __jbd_unexpected_dirty_buffer()'s handling of dirty
* state. */ * state. */
...@@ -2055,7 +2054,7 @@ void __journal_refile_buffer(struct journal_head *jh) ...@@ -2055,7 +2054,7 @@ void __journal_refile_buffer(struct journal_head *jh)
jh->b_transaction = NULL; jh->b_transaction = NULL;
return; return;
} }
/* /*
* It has been modified by a later transaction: add it to the new * It has been modified by a later transaction: add it to the new
* transaction's metadata list. * transaction's metadata list.
......
...@@ -66,7 +66,7 @@ struct ext3_inode_info { ...@@ -66,7 +66,7 @@ struct ext3_inode_info {
struct posix_acl *i_acl; struct posix_acl *i_acl;
struct posix_acl *i_default_acl; struct posix_acl *i_default_acl;
#endif #endif
struct list_head i_orphan; /* unlinked but open inodes */ struct list_head i_orphan; /* unlinked but open inodes */
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment