Commit 72c45511 authored by Oleg Drokin's avatar Oleg Drokin

Merge angband.namesys.com:/home/green/bk/linux-2.5

into angband.namesys.com:/home/green/bk_work/reiser3-linux-2.5-test
parents a9907091 4cf11356
...@@ -314,7 +314,7 @@ o <http://oss.software.ibm.com/jfs> ...@@ -314,7 +314,7 @@ o <http://oss.software.ibm.com/jfs>
Reiserfsprogs Reiserfsprogs
------------- -------------
o <ftp://ftp.namesys.com/pub/reiserfsprogs/reiserfsprogs-3.x.0b.tar.gz> o <ftp://ftp.namesys.com/pub/reiserfsprogs/reiserfsprogs-3.x.1b.tar.gz>
LVM toolset LVM toolset
----------- -----------
......
...@@ -103,7 +103,7 @@ static void _reiserfs_free_block (struct reiserfs_transaction_handle *th, unsign ...@@ -103,7 +103,7 @@ static void _reiserfs_free_block (struct reiserfs_transaction_handle *th, unsign
if (nr >= sb_bmap_nr (rs)) { if (nr >= sb_bmap_nr (rs)) {
reiserfs_warning ("vs-4075: reiserfs_free_block: " reiserfs_warning ("vs-4075: reiserfs_free_block: "
"block %lu is out of range on %s\n", "block %lu is out of range on %s\n",
block, s->s_id); block, reiserfs_bdevname (s));
return; return;
} }
...@@ -113,7 +113,7 @@ static void _reiserfs_free_block (struct reiserfs_transaction_handle *th, unsign ...@@ -113,7 +113,7 @@ static void _reiserfs_free_block (struct reiserfs_transaction_handle *th, unsign
if (!reiserfs_test_and_clear_le_bit (offset, apbh[nr]->b_data)) { if (!reiserfs_test_and_clear_le_bit (offset, apbh[nr]->b_data)) {
reiserfs_warning ("vs-4080: reiserfs_free_block: " reiserfs_warning ("vs-4080: reiserfs_free_block: "
"free_block (%s:%lu)[dev:blocknr]: bit already cleared\n", "free_block (%s:%lu)[dev:blocknr]: bit already cleared\n",
s->s_id, block); reiserfs_bdevname (s), block);
} }
journal_mark_dirty (th, s, apbh[nr]); journal_mark_dirty (th, s, apbh[nr]);
...@@ -139,10 +139,8 @@ void reiserfs_free_block (struct reiserfs_transaction_handle *th, ...@@ -139,10 +139,8 @@ void reiserfs_free_block (struct reiserfs_transaction_handle *th,
/* preallocated blocks don't need to be run through journal_mark_freed */ /* preallocated blocks don't need to be run through journal_mark_freed */
void reiserfs_free_prealloc_block (struct reiserfs_transaction_handle *th, void reiserfs_free_prealloc_block (struct reiserfs_transaction_handle *th,
unsigned long block) { unsigned long block) {
struct super_block * s = th->t_super; RFALSE(!th->t_super, "vs-4060: trying to free block on nonexistent device");
RFALSE(is_reusable (th->t_super, block, 1) == 0, "vs-4070: can not free such block");
RFALSE(!s, "vs-4060: trying to free block on nonexistent device");
RFALSE(is_reusable (s, block, 1) == 0, "vs-4070: can not free such block");
_reiserfs_free_block(th, block) ; _reiserfs_free_block(th, block) ;
} }
...@@ -670,10 +668,7 @@ int reiserfs_new_unf_blocknrs2 (struct reiserfs_transaction_handle *th, ...@@ -670,10 +668,7 @@ int reiserfs_new_unf_blocknrs2 (struct reiserfs_transaction_handle *th,
return ret; return ret;
} }
//
// a portion of this function, was derived from minix or ext2's
// analog. You should be able to tell which portion by looking at the
// ext2 code and comparing.
static void __discard_prealloc (struct reiserfs_transaction_handle * th, static void __discard_prealloc (struct reiserfs_transaction_handle * th,
struct reiserfs_inode_info *ei) struct reiserfs_inode_info *ei)
{ {
......
...@@ -24,9 +24,10 @@ struct file_operations reiserfs_dir_operations = { ...@@ -24,9 +24,10 @@ struct file_operations reiserfs_dir_operations = {
}; };
int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry, int datasync) { int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry, int datasync) {
lock_kernel(); struct inode *inode = dentry->d_inode;
reiserfs_commit_for_inode(dentry->d_inode) ; reiserfs_write_lock(inode->i_sb);
unlock_kernel() ; reiserfs_commit_for_inode(inode) ;
reiserfs_write_unlock(inode->i_sb) ;
return 0 ; return 0 ;
} }
...@@ -50,7 +51,7 @@ static int reiserfs_readdir (struct file * filp, void * dirent, filldir_t filldi ...@@ -50,7 +51,7 @@ static int reiserfs_readdir (struct file * filp, void * dirent, filldir_t filldi
struct reiserfs_dir_entry de; struct reiserfs_dir_entry de;
int ret = 0; int ret = 0;
lock_kernel(); reiserfs_write_lock(inode->i_sb);
reiserfs_check_lock_depth("readdir") ; reiserfs_check_lock_depth("readdir") ;
...@@ -109,7 +110,7 @@ static int reiserfs_readdir (struct file * filp, void * dirent, filldir_t filldi ...@@ -109,7 +110,7 @@ static int reiserfs_readdir (struct file * filp, void * dirent, filldir_t filldi
if (!d_name[d_reclen - 1]) if (!d_name[d_reclen - 1])
d_reclen = strlen (d_name); d_reclen = strlen (d_name);
if (d_reclen > REISERFS_MAX_NAME_LEN(inode->i_sb->s_blocksize)){ if (d_reclen > REISERFS_MAX_NAME(inode->i_sb->s_blocksize)){
/* too big to send back to VFS */ /* too big to send back to VFS */
continue ; continue ;
} }
...@@ -181,13 +182,12 @@ static int reiserfs_readdir (struct file * filp, void * dirent, filldir_t filldi ...@@ -181,13 +182,12 @@ static int reiserfs_readdir (struct file * filp, void * dirent, filldir_t filldi
end: end:
// FIXME: ext2_readdir does not reset f_pos
filp->f_pos = next_pos; filp->f_pos = next_pos;
pathrelse (&path_to_entry); pathrelse (&path_to_entry);
reiserfs_check_path(&path_to_entry) ; reiserfs_check_path(&path_to_entry) ;
UPDATE_ATIME(inode) ; UPDATE_ATIME(inode) ;
out: out:
unlock_kernel(); reiserfs_write_unlock(inode->i_sb);
return ret; return ret;
} }
......
...@@ -39,7 +39,7 @@ static int reiserfs_file_release (struct inode * inode, struct file * filp) ...@@ -39,7 +39,7 @@ static int reiserfs_file_release (struct inode * inode, struct file * filp)
return 0; return 0;
} }
lock_kernel() ; reiserfs_write_lock(inode->i_sb);
down (&inode->i_sem); down (&inode->i_sem);
journal_begin(&th, inode->i_sb, JOURNAL_PER_BALANCE_CNT * 3) ; journal_begin(&th, inode->i_sb, JOURNAL_PER_BALANCE_CNT * 3) ;
reiserfs_update_inode_transaction(inode) ; reiserfs_update_inode_transaction(inode) ;
...@@ -61,14 +61,12 @@ static int reiserfs_file_release (struct inode * inode, struct file * filp) ...@@ -61,14 +61,12 @@ static int reiserfs_file_release (struct inode * inode, struct file * filp)
pop_journal_writer(windex) ; pop_journal_writer(windex) ;
} }
up (&inode->i_sem); up (&inode->i_sem);
unlock_kernel() ; reiserfs_write_unlock(inode->i_sb);
return 0; return 0;
} }
static void reiserfs_vfs_truncate_file(struct inode *inode) { static void reiserfs_vfs_truncate_file(struct inode *inode) {
lock_kernel();
reiserfs_truncate_file(inode, 1) ; reiserfs_truncate_file(inode, 1) ;
unlock_kernel();
} }
/* Sync a reiserfs file. */ /* Sync a reiserfs file. */
...@@ -86,21 +84,21 @@ static int reiserfs_sync_file( ...@@ -86,21 +84,21 @@ static int reiserfs_sync_file(
struct inode * p_s_inode = p_s_dentry->d_inode; struct inode * p_s_inode = p_s_dentry->d_inode;
int n_err; int n_err;
lock_kernel() ; reiserfs_write_lock(p_s_inode->i_sb);
if (!S_ISREG(p_s_inode->i_mode)) if (!S_ISREG(p_s_inode->i_mode))
BUG (); BUG ();
n_err = sync_mapping_buffers(p_s_inode->i_mapping) ; n_err = sync_mapping_buffers(p_s_inode->i_mapping) ;
reiserfs_commit_for_inode(p_s_inode) ; reiserfs_commit_for_inode(p_s_inode) ;
unlock_kernel() ; reiserfs_write_unlock(p_s_inode->i_sb);
return ( n_err < 0 ) ? -EIO : 0; return ( n_err < 0 ) ? -EIO : 0;
} }
static int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) { static int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) {
struct inode *inode = dentry->d_inode ; struct inode *inode = dentry->d_inode ;
int error ; int error ;
lock_kernel(); reiserfs_write_lock(inode->i_sb);
if (attr->ia_valid & ATTR_SIZE) { if (attr->ia_valid & ATTR_SIZE) {
/* version 2 items will be caught by the s_maxbytes check /* version 2 items will be caught by the s_maxbytes check
** done for us in vmtruncate ** done for us in vmtruncate
...@@ -138,7 +136,7 @@ static int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) { ...@@ -138,7 +136,7 @@ static int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) {
inode_setattr(inode, attr) ; inode_setattr(inode, attr) ;
out: out:
unlock_kernel(); reiserfs_write_unlock(inode->i_sb);
return error ; return error ;
} }
......
...@@ -2092,21 +2092,27 @@ static void tb_buffer_sanity_check (struct super_block * p_s_sb, ...@@ -2092,21 +2092,27 @@ static void tb_buffer_sanity_check (struct super_block * p_s_sb,
if (p_s_bh) { if (p_s_bh) {
if (atomic_read (&(p_s_bh->b_count)) <= 0) { if (atomic_read (&(p_s_bh->b_count)) <= 0) {
reiserfs_panic (p_s_sb, "tb_buffer_sanity_check(): negative or zero reference counter for buffer %s[%d] (%b)\n", descr, level, p_s_bh); reiserfs_panic (p_s_sb, "jmacd-1: tb_buffer_sanity_check(): negative or zero reference counter for buffer %s[%d] (%b)\n", descr, level, p_s_bh);
} }
if ( ! buffer_uptodate (p_s_bh) ) { if ( ! buffer_uptodate (p_s_bh) ) {
reiserfs_panic (p_s_sb, "tb_buffer_sanity_check(): buffer is not up to date %s[%d] (%b)\n", descr, level, p_s_bh); reiserfs_panic (p_s_sb, "jmacd-2: tb_buffer_sanity_check(): buffer is not up to date %s[%d] (%b)\n", descr, level, p_s_bh);
} }
if ( ! B_IS_IN_TREE (p_s_bh) ) { if ( ! B_IS_IN_TREE (p_s_bh) ) {
reiserfs_panic (p_s_sb, "tb_buffer_sanity_check(): buffer is not in tree %s[%d] (%b)\n", descr, level, p_s_bh); reiserfs_panic (p_s_sb, "jmacd-3: tb_buffer_sanity_check(): buffer is not in tree %s[%d] (%b)\n", descr, level, p_s_bh);
} }
if (p_s_bh->b_bdev != p_s_sb->s_bdev || if (p_s_bh->b_bdev != p_s_sb->s_bdev) {
p_s_bh->b_size != p_s_sb->s_blocksize || reiserfs_panic (p_s_sb, "jmacd-4: tb_buffer_sanity_check(): buffer has wrong device %s[%d] (%b)\n", descr, level, p_s_bh);
p_s_bh->b_blocknr > SB_BLOCK_COUNT(p_s_sb)) { }
reiserfs_panic (p_s_sb, "tb_buffer_sanity_check(): check failed for buffer %s[%d] (%b)\n", descr, level, p_s_bh);
if (p_s_bh->b_size != p_s_sb->s_blocksize) {
reiserfs_panic (p_s_sb, "jmacd-5: tb_buffer_sanity_check(): buffer has wrong blocksize %s[%d] (%b)\n", descr, level, p_s_bh);
}
if (p_s_bh->b_blocknr > SB_BLOCK_COUNT(p_s_sb)) {
reiserfs_panic (p_s_sb, "jmacd-6: tb_buffer_sanity_check(): buffer block number too high %s[%d] (%b)\n", descr, level, p_s_bh);
} }
} }
} }
......
...@@ -20,10 +20,7 @@ ...@@ -20,10 +20,7 @@
static int reiserfs_get_block (struct inode * inode, sector_t block, static int reiserfs_get_block (struct inode * inode, sector_t block,
struct buffer_head * bh_result, int create); struct buffer_head * bh_result, int create);
//
// initially this function was derived from minix or ext2's analog and
// evolved as the prototype did
//
void reiserfs_delete_inode (struct inode * inode) void reiserfs_delete_inode (struct inode * inode)
{ {
int jbegin_count = JOURNAL_PER_BALANCE_CNT * 2; int jbegin_count = JOURNAL_PER_BALANCE_CNT * 2;
...@@ -31,7 +28,7 @@ void reiserfs_delete_inode (struct inode * inode) ...@@ -31,7 +28,7 @@ void reiserfs_delete_inode (struct inode * inode)
struct reiserfs_transaction_handle th ; struct reiserfs_transaction_handle th ;
lock_kernel() ; reiserfs_write_lock(inode->i_sb);
/* The = 0 happens when we abort creating a new inode for some reason like lack of space.. */ /* The = 0 happens when we abort creating a new inode for some reason like lack of space.. */
if (!(inode->i_state & I_NEW) && INODE_PKEY(inode)->k_objectid != 0) { /* also handles bad_inode case */ if (!(inode->i_state & I_NEW) && INODE_PKEY(inode)->k_objectid != 0) { /* also handles bad_inode case */
...@@ -56,7 +53,7 @@ void reiserfs_delete_inode (struct inode * inode) ...@@ -56,7 +53,7 @@ void reiserfs_delete_inode (struct inode * inode)
} }
clear_inode (inode); /* note this must go after the journal_end to prevent deadlock */ clear_inode (inode); /* note this must go after the journal_end to prevent deadlock */
inode->i_blocks = 0; inode->i_blocks = 0;
unlock_kernel() ; reiserfs_write_unlock(inode->i_sb);
} }
static void _make_cpu_key (struct cpu_key * key, int version, __u32 dirid, __u32 objectid, static void _make_cpu_key (struct cpu_key * key, int version, __u32 dirid, __u32 objectid,
...@@ -112,8 +109,7 @@ static void add_to_flushlist(struct inode *inode, struct buffer_head *bh) { ...@@ -112,8 +109,7 @@ static void add_to_flushlist(struct inode *inode, struct buffer_head *bh) {
} }
// //
// FIXME: we might cache recently accessed indirect item (or at least // FIXME: we might cache recently accessed indirect item
// first 15 pointers just like ext2 does
// Ugh. Not too eager for that.... // Ugh. Not too eager for that....
// I cut the code until such time as I see a convincing argument (benchmark). // I cut the code until such time as I see a convincing argument (benchmark).
...@@ -412,10 +408,10 @@ int reiserfs_bmap (struct inode * inode, sector_t block, ...@@ -412,10 +408,10 @@ int reiserfs_bmap (struct inode * inode, sector_t block,
if (!file_capable (inode, block)) if (!file_capable (inode, block))
return -EFBIG; return -EFBIG;
lock_kernel() ; reiserfs_write_lock(inode->i_sb);
/* do not read the direct item */ /* do not read the direct item */
_get_block_create_0 (inode, block, bh_result, 0) ; _get_block_create_0 (inode, block, bh_result, 0) ;
unlock_kernel() ; reiserfs_write_unlock(inode->i_sb);
return 0; return 0;
} }
...@@ -521,12 +517,7 @@ static inline int _allocate_block(struct reiserfs_transaction_handle *th, ...@@ -521,12 +517,7 @@ static inline int _allocate_block(struct reiserfs_transaction_handle *th,
#endif #endif
return reiserfs_new_unf_blocknrs (th, allocated_block_nr, tag); return reiserfs_new_unf_blocknrs (th, allocated_block_nr, tag);
} }
//
// initially this function was derived from ext2's analog and evolved
// as the prototype did. You'll need to look at the ext2 version to
// determine which parts are derivative, if any, understanding that
// there are only so many ways to code to a given interface.
//
int reiserfs_get_block (struct inode * inode, sector_t block, int reiserfs_get_block (struct inode * inode, sector_t block,
struct buffer_head * bh_result, int create) struct buffer_head * bh_result, int create)
{ {
...@@ -554,17 +545,17 @@ int reiserfs_get_block (struct inode * inode, sector_t block, ...@@ -554,17 +545,17 @@ int reiserfs_get_block (struct inode * inode, sector_t block,
loff_t new_offset = (((loff_t)block) << inode->i_sb->s_blocksize_bits) + 1 ; loff_t new_offset = (((loff_t)block) << inode->i_sb->s_blocksize_bits) + 1 ;
/* bad.... */ /* bad.... */
lock_kernel() ; reiserfs_write_lock(inode->i_sb);
th.t_trans_id = 0 ; th.t_trans_id = 0 ;
version = get_inode_item_key_version (inode); version = get_inode_item_key_version (inode);
if (block < 0) { if (block < 0) {
unlock_kernel(); reiserfs_write_unlock(inode->i_sb);
return -EIO; return -EIO;
} }
if (!file_capable (inode, block)) { if (!file_capable (inode, block)) {
unlock_kernel() ; reiserfs_write_unlock(inode->i_sb);
return -EFBIG; return -EFBIG;
} }
...@@ -576,7 +567,7 @@ int reiserfs_get_block (struct inode * inode, sector_t block, ...@@ -576,7 +567,7 @@ int reiserfs_get_block (struct inode * inode, sector_t block,
/* find number of block-th logical block of the file */ /* find number of block-th logical block of the file */
ret = _get_block_create_0 (inode, block, bh_result, ret = _get_block_create_0 (inode, block, bh_result,
create | GET_BLOCK_READ_DIRECT) ; create | GET_BLOCK_READ_DIRECT) ;
unlock_kernel() ; reiserfs_write_unlock(inode->i_sb);
return ret; return ret;
} }
...@@ -667,7 +658,7 @@ int reiserfs_get_block (struct inode * inode, sector_t block, ...@@ -667,7 +658,7 @@ int reiserfs_get_block (struct inode * inode, sector_t block,
if (transaction_started) if (transaction_started)
journal_end(&th, inode->i_sb, jbegin_count) ; journal_end(&th, inode->i_sb, jbegin_count) ;
unlock_kernel() ; reiserfs_write_unlock(inode->i_sb);
/* the item was found, so new blocks were not added to the file /* the item was found, so new blocks were not added to the file
** there is no need to make sure the inode is updated with this ** there is no need to make sure the inode is updated with this
...@@ -866,7 +857,6 @@ int reiserfs_get_block (struct inode * inode, sector_t block, ...@@ -866,7 +857,6 @@ int reiserfs_get_block (struct inode * inode, sector_t block,
retval = 0; retval = 0;
reiserfs_check_path(&path) ;
failure: failure:
if (transaction_started) { if (transaction_started) {
...@@ -874,7 +864,7 @@ int reiserfs_get_block (struct inode * inode, sector_t block, ...@@ -874,7 +864,7 @@ int reiserfs_get_block (struct inode * inode, sector_t block,
journal_end(&th, inode->i_sb, jbegin_count) ; journal_end(&th, inode->i_sb, jbegin_count) ;
} }
pop_journal_writer(windex) ; pop_journal_writer(windex) ;
unlock_kernel() ; reiserfs_write_unlock(inode->i_sb);
reiserfs_check_path(&path) ; reiserfs_check_path(&path) ;
return retval; return retval;
} }
...@@ -1353,10 +1343,6 @@ int reiserfs_encode_fh(struct dentry *dentry, __u32 *data, int *lenp, int need_p ...@@ -1353,10 +1343,6 @@ int reiserfs_encode_fh(struct dentry *dentry, __u32 *data, int *lenp, int need_p
} }
//
// initially this function was derived from minix or ext2's analog and
// evolved as the prototype did
//
/* looks for stat data, then copies fields to it, marks the buffer /* looks for stat data, then copies fields to it, marks the buffer
containing stat data as dirty */ containing stat data as dirty */
/* reiserfs inodes are never really dirty, since the dirty inode call /* reiserfs inodes are never really dirty, since the dirty inode call
...@@ -1379,11 +1365,11 @@ void reiserfs_write_inode (struct inode * inode, int do_sync) { ...@@ -1379,11 +1365,11 @@ void reiserfs_write_inode (struct inode * inode, int do_sync) {
** ignored because the altered inode has already been logged. ** ignored because the altered inode has already been logged.
*/ */
if (do_sync && !(current->flags & PF_MEMALLOC)) { if (do_sync && !(current->flags & PF_MEMALLOC)) {
lock_kernel() ; reiserfs_write_lock(inode->i_sb);
journal_begin(&th, inode->i_sb, jbegin_count) ; journal_begin(&th, inode->i_sb, jbegin_count) ;
reiserfs_update_sd (&th, inode); reiserfs_update_sd (&th, inode);
journal_end_sync(&th, inode->i_sb, jbegin_count) ; journal_end_sync(&th, inode->i_sb, jbegin_count) ;
unlock_kernel() ; reiserfs_write_unlock(inode->i_sb);
} }
} }
...@@ -1725,7 +1711,8 @@ static int grab_tail_page(struct inode *p_s_inode, ...@@ -1725,7 +1711,8 @@ static int grab_tail_page(struct inode *p_s_inode,
** call prepare_write ** call prepare_write
*/ */
reiserfs_warning("clm-6000: error reading block %lu on dev %s\n", reiserfs_warning("clm-6000: error reading block %lu on dev %s\n",
bh->b_blocknr, p_s_inode->i_sb->s_id) ; bh->b_blocknr,
reiserfs_bdevname (p_s_inode->i_sb)) ;
error = -EIO ; error = -EIO ;
goto unlock ; goto unlock ;
} }
...@@ -1750,7 +1737,6 @@ static int grab_tail_page(struct inode *p_s_inode, ...@@ -1750,7 +1737,6 @@ static int grab_tail_page(struct inode *p_s_inode,
void reiserfs_truncate_file(struct inode *p_s_inode, int update_timestamps) { void reiserfs_truncate_file(struct inode *p_s_inode, int update_timestamps) {
struct reiserfs_transaction_handle th ; struct reiserfs_transaction_handle th ;
int windex ; int windex ;
/* we want the offset for the first byte after the end of the file */ /* we want the offset for the first byte after the end of the file */
unsigned long offset = p_s_inode->i_size & (PAGE_CACHE_SIZE - 1) ; unsigned long offset = p_s_inode->i_size & (PAGE_CACHE_SIZE - 1) ;
unsigned blocksize = p_s_inode->i_sb->s_blocksize ; unsigned blocksize = p_s_inode->i_sb->s_blocksize ;
...@@ -1759,6 +1745,8 @@ void reiserfs_truncate_file(struct inode *p_s_inode, int update_timestamps) { ...@@ -1759,6 +1745,8 @@ void reiserfs_truncate_file(struct inode *p_s_inode, int update_timestamps) {
int error ; int error ;
struct buffer_head *bh = NULL ; struct buffer_head *bh = NULL ;
reiserfs_write_lock(p_s_inode->i_sb);
if (p_s_inode->i_size > 0) { if (p_s_inode->i_size > 0) {
if ((error = grab_tail_page(p_s_inode, &page, &bh))) { if ((error = grab_tail_page(p_s_inode, &page, &bh))) {
// -ENOENT means we truncated past the end of the file, // -ENOENT means we truncated past the end of the file,
...@@ -1812,7 +1800,7 @@ void reiserfs_truncate_file(struct inode *p_s_inode, int update_timestamps) { ...@@ -1812,7 +1800,7 @@ void reiserfs_truncate_file(struct inode *p_s_inode, int update_timestamps) {
page_cache_release(page) ; page_cache_release(page) ;
} }
return ; reiserfs_write_unlock(p_s_inode->i_sb);
} }
static int map_block_for_writepage(struct inode *inode, static int map_block_for_writepage(struct inode *inode,
...@@ -1836,7 +1824,7 @@ static int map_block_for_writepage(struct inode *inode, ...@@ -1836,7 +1824,7 @@ static int map_block_for_writepage(struct inode *inode,
kmap(bh_result->b_page) ; kmap(bh_result->b_page) ;
start_over: start_over:
lock_kernel() ; reiserfs_write_lock(inode->i_sb);
journal_begin(&th, inode->i_sb, jbegin_count) ; journal_begin(&th, inode->i_sb, jbegin_count) ;
reiserfs_update_inode_transaction(inode) ; reiserfs_update_inode_transaction(inode) ;
...@@ -1894,7 +1882,7 @@ static int map_block_for_writepage(struct inode *inode, ...@@ -1894,7 +1882,7 @@ static int map_block_for_writepage(struct inode *inode,
goto research ; goto research ;
} }
} else { } else {
reiserfs_warning("clm-6003: bad item inode %lu, device %s\n", inode->i_ino, inode->i_sb->s_id) ; reiserfs_warning("clm-6003: bad item inode %lu, device %s\n", inode->i_ino, reiserfs_bdevname (inode->i_sb)) ;
retval = -EIO ; retval = -EIO ;
goto out ; goto out ;
} }
...@@ -1903,7 +1891,7 @@ static int map_block_for_writepage(struct inode *inode, ...@@ -1903,7 +1891,7 @@ static int map_block_for_writepage(struct inode *inode,
out: out:
pathrelse(&path) ; pathrelse(&path) ;
journal_end(&th, inode->i_sb, jbegin_count) ; journal_end(&th, inode->i_sb, jbegin_count) ;
unlock_kernel() ; reiserfs_write_unlock(inode->i_sb);
/* this is where we fill in holes in the file. */ /* this is where we fill in holes in the file. */
if (use_get_block) { if (use_get_block) {
...@@ -2033,18 +2021,13 @@ static int reiserfs_write_full_page(struct page *page) { ...@@ -2033,18 +2021,13 @@ static int reiserfs_write_full_page(struct page *page) {
return error ; return error ;
} }
//
// this is exactly what 2.3.99-pre9's ext2_readpage is
//
static int reiserfs_readpage (struct file *f, struct page * page) static int reiserfs_readpage (struct file *f, struct page * page)
{ {
return block_read_full_page (page, reiserfs_get_block); return block_read_full_page (page, reiserfs_get_block);
} }
//
// modified from ext2_writepage is
//
static int reiserfs_writepage (struct page * page) static int reiserfs_writepage (struct page * page)
{ {
struct inode *inode = page->mapping->host ; struct inode *inode = page->mapping->host ;
...@@ -2053,9 +2036,6 @@ static int reiserfs_writepage (struct page * page) ...@@ -2053,9 +2036,6 @@ static int reiserfs_writepage (struct page * page)
} }
//
// from ext2_prepare_write, but modified
//
int reiserfs_prepare_write(struct file *f, struct page *page, int reiserfs_prepare_write(struct file *f, struct page *page,
unsigned from, unsigned to) { unsigned from, unsigned to) {
struct inode *inode = page->mapping->host ; struct inode *inode = page->mapping->host ;
...@@ -2065,9 +2045,6 @@ int reiserfs_prepare_write(struct file *f, struct page *page, ...@@ -2065,9 +2045,6 @@ int reiserfs_prepare_write(struct file *f, struct page *page,
} }
//
// this is exactly what 2.3.99-pre9's ext2_bmap is
//
static int reiserfs_aop_bmap(struct address_space *as, long block) { static int reiserfs_aop_bmap(struct address_space *as, long block) {
return generic_block_bmap(as, block, reiserfs_bmap) ; return generic_block_bmap(as, block, reiserfs_bmap) ;
} }
...@@ -2086,13 +2063,13 @@ static int reiserfs_commit_write(struct file *f, struct page *page, ...@@ -2086,13 +2063,13 @@ static int reiserfs_commit_write(struct file *f, struct page *page,
*/ */
if (pos > inode->i_size) { if (pos > inode->i_size) {
struct reiserfs_transaction_handle th ; struct reiserfs_transaction_handle th ;
lock_kernel() ; reiserfs_write_lock(inode->i_sb);
journal_begin(&th, inode->i_sb, 1) ; journal_begin(&th, inode->i_sb, 1) ;
reiserfs_update_inode_transaction(inode) ; reiserfs_update_inode_transaction(inode) ;
inode->i_size = pos ; inode->i_size = pos ;
reiserfs_update_sd(&th, inode) ; reiserfs_update_sd(&th, inode) ;
journal_end(&th, inode->i_sb, 1) ; journal_end(&th, inode->i_sb, 1) ;
unlock_kernel() ; reiserfs_write_unlock(inode->i_sb);
} }
ret = generic_commit_write(f, page, from, to) ; ret = generic_commit_write(f, page, from, to) ;
...@@ -2101,9 +2078,9 @@ static int reiserfs_commit_write(struct file *f, struct page *page, ...@@ -2101,9 +2078,9 @@ static int reiserfs_commit_write(struct file *f, struct page *page,
** for any packed tails the file might have had ** for any packed tails the file might have had
*/ */
if (f && (f->f_flags & O_SYNC)) { if (f && (f->f_flags & O_SYNC)) {
lock_kernel() ; reiserfs_write_lock(inode->i_sb);
reiserfs_commit_for_inode(inode) ; reiserfs_commit_for_inode(inode) ;
unlock_kernel(); reiserfs_write_unlock(inode->i_sb);
} }
return ret ; return ret ;
} }
......
...@@ -49,7 +49,7 @@ int reiserfs_unpack (struct inode * inode, struct file * filp) ...@@ -49,7 +49,7 @@ int reiserfs_unpack (struct inode * inode, struct file * filp)
if (REISERFS_I(inode)->i_flags & i_nopack_mask) { if (REISERFS_I(inode)->i_flags & i_nopack_mask) {
return 0 ; return 0 ;
} }
lock_kernel(); reiserfs_write_lock(inode->i_sb);
/* we need to make sure nobody is changing the file size beneath /* we need to make sure nobody is changing the file size beneath
** us ** us
...@@ -88,6 +88,6 @@ int reiserfs_unpack (struct inode * inode, struct file * filp) ...@@ -88,6 +88,6 @@ int reiserfs_unpack (struct inode * inode, struct file * filp)
out: out:
up(&inode->i_sem) ; up(&inode->i_sem) ;
unlock_kernel(); reiserfs_write_unlock(inode->i_sb);
return retval; return retval;
} }
This diff is collapsed.
This diff is collapsed.
...@@ -337,7 +337,7 @@ void reiserfs_panic (struct super_block * sb, const char * fmt, ...) ...@@ -337,7 +337,7 @@ void reiserfs_panic (struct super_block * sb, const char * fmt, ...)
/* this is not actually called, but makes reiserfs_panic() "noreturn" */ /* this is not actually called, but makes reiserfs_panic() "noreturn" */
panic ("REISERFS: panic (device %s): %s\n", panic ("REISERFS: panic (device %s): %s\n",
sb ? sb->s_id : "sb == 0", error_buf); reiserfs_bdevname (sb), error_buf);
} }
...@@ -490,6 +490,7 @@ char * reiserfs_hashname(int code) ...@@ -490,6 +490,7 @@ char * reiserfs_hashname(int code)
return "unknown"; return "unknown";
} }
/* return 1 if this is not super block */ /* return 1 if this is not super block */
static int print_super_block (struct buffer_head * bh) static int print_super_block (struct buffer_head * bh)
{ {
...@@ -509,8 +510,8 @@ static int print_super_block (struct buffer_head * bh) ...@@ -509,8 +510,8 @@ static int print_super_block (struct buffer_head * bh)
return 1; return 1;
} }
printk ("%s\'s super block in block %ld\n======================\n", printk ("%s\'s super block is in block %ld\n", bdevname (bh->b_bdev),
bdevname (bh->b_bdev), bh->b_blocknr); bh->b_blocknr);
printk ("Reiserfs version %s\n", version ); printk ("Reiserfs version %s\n", version );
printk ("Block count %u\n", sb_block_count(rs)); printk ("Block count %u\n", sb_block_count(rs));
printk ("Blocksize %d\n", sb_blocksize(rs)); printk ("Blocksize %d\n", sb_blocksize(rs));
......
...@@ -36,7 +36,7 @@ static struct super_block *procinfo_prologue( kdev_t dev ) ...@@ -36,7 +36,7 @@ static struct super_block *procinfo_prologue( kdev_t dev )
/* get super-block by device */ /* get super-block by device */
result = get_super( dev ); result = get_super( dev );
if( result != NULL ) { if( result != NULL ) {
if( !reiserfs_is_super( result ) ) { if( !is_reiserfs_super( result ) ) {
printk( KERN_DEBUG "reiserfs: procfs-52: " printk( KERN_DEBUG "reiserfs: procfs-52: "
"non-reiserfs super found\n" ); "non-reiserfs super found\n" );
drop_super( result ); drop_super( result );
...@@ -500,7 +500,7 @@ int reiserfs_journal_in_proc( char *buffer, char **start, off_t offset, ...@@ -500,7 +500,7 @@ int reiserfs_journal_in_proc( char *buffer, char **start, off_t offset,
"prepare_retry: \t%12lu\n", "prepare_retry: \t%12lu\n",
DJP( jp_journal_1st_block ), DJP( jp_journal_1st_block ),
DJP( jp_journal_dev ) == 0 ? "none" : __bdevname(to_kdev_t(DJP( jp_journal_dev ))), bdevname(SB_JOURNAL(sb)->j_dev_bd),
DJP( jp_journal_dev ), DJP( jp_journal_dev ),
DJP( jp_journal_size ), DJP( jp_journal_size ),
DJP( jp_journal_trans_max ), DJP( jp_journal_trans_max ),
...@@ -556,13 +556,13 @@ static const char *proc_info_root_name = "fs/reiserfs"; ...@@ -556,13 +556,13 @@ static const char *proc_info_root_name = "fs/reiserfs";
int reiserfs_proc_info_init( struct super_block *sb ) int reiserfs_proc_info_init( struct super_block *sb )
{ {
spin_lock_init( & __PINFO( sb ).lock ); spin_lock_init( & __PINFO( sb ).lock );
REISERFS_SB(sb)->procdir = proc_mkdir(sb->s_id, proc_info_root); REISERFS_SB(sb)->procdir = proc_mkdir(reiserfs_bdevname (sb), proc_info_root);
if( REISERFS_SB(sb)->procdir ) { if( REISERFS_SB(sb)->procdir ) {
REISERFS_SB(sb)->procdir -> owner = THIS_MODULE; REISERFS_SB(sb)->procdir -> owner = THIS_MODULE;
return 0; return 0;
} }
reiserfs_warning( "reiserfs: cannot create /proc/%s/%s\n", reiserfs_warning( "reiserfs: cannot create /proc/%s/%s\n",
proc_info_root_name, sb->s_id ); proc_info_root_name, reiserfs_bdevname (sb) );
return 1; return 1;
} }
...@@ -573,7 +573,7 @@ int reiserfs_proc_info_done( struct super_block *sb ) ...@@ -573,7 +573,7 @@ int reiserfs_proc_info_done( struct super_block *sb )
__PINFO( sb ).exiting = 1; __PINFO( sb ).exiting = 1;
spin_unlock( & __PINFO( sb ).lock ); spin_unlock( & __PINFO( sb ).lock );
if ( proc_info_root ) { if ( proc_info_root ) {
remove_proc_entry( sb->s_id, proc_info_root ); remove_proc_entry( reiserfs_bdevname (sb), proc_info_root );
REISERFS_SB(sb)->procdir = NULL; REISERFS_SB(sb)->procdir = NULL;
} }
return 0; return 0;
......
...@@ -1715,13 +1715,13 @@ void reiserfs_do_truncate (struct reiserfs_transaction_handle *th, ...@@ -1715,13 +1715,13 @@ void reiserfs_do_truncate (struct reiserfs_transaction_handle *th,
/* Cut or delete file item. */ /* Cut or delete file item. */
n_deleted = reiserfs_cut_from_item(th, &s_search_path, &s_item_key, p_s_inode, page, n_new_file_size); n_deleted = reiserfs_cut_from_item(th, &s_search_path, &s_item_key, p_s_inode, page, n_new_file_size);
if (n_deleted < 0) { if (n_deleted < 0) {
reiserfs_warning ("vs-5665: reiserfs_truncate_file: cut_from_item failed"); reiserfs_warning ("vs-5665: reiserfs_do_truncate: reiserfs_cut_from_item failed");
reiserfs_check_path(&s_search_path) ; reiserfs_check_path(&s_search_path) ;
return; return;
} }
RFALSE( n_deleted > n_file_size, RFALSE( n_deleted > n_file_size,
"PAP-5670: reiserfs_truncate_file returns too big number: deleted %d, file_size %lu, item_key %K", "PAP-5670: reiserfs_cut_from_item: too many bytes deleted: deleted %d, file_size %lu, item_key %K",
n_deleted, n_file_size, &s_item_key); n_deleted, n_file_size, &s_item_key);
/* Change key to search the last file item. */ /* Change key to search the last file item. */
......
This diff is collapsed.
...@@ -214,7 +214,7 @@ int indirect2direct (struct reiserfs_transaction_handle *th, ...@@ -214,7 +214,7 @@ int indirect2direct (struct reiserfs_transaction_handle *th,
copy_item_head (&s_ih, PATH_PITEM_HEAD(p_s_path)); copy_item_head (&s_ih, PATH_PITEM_HEAD(p_s_path));
tail_len = (n_new_file_size & (n_block_size - 1)); tail_len = (n_new_file_size & (n_block_size - 1));
if (!old_format_only (p_s_sb)) if (get_inode_sd_version (p_s_inode) == STAT_DATA_V2)
round_tail_len = ROUND_UP (tail_len); round_tail_len = ROUND_UP (tail_len);
else else
round_tail_len = tail_len; round_tail_len = tail_len;
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/smp_lock.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/reiserfs_fs_i.h> #include <linux/reiserfs_fs_i.h>
#include <linux/reiserfs_fs_sb.h> #include <linux/reiserfs_fs_sb.h>
...@@ -1062,9 +1063,7 @@ static inline int entry_length (const struct buffer_head * bh, ...@@ -1062,9 +1063,7 @@ static inline int entry_length (const struct buffer_head * bh,
#define B_I_E_NAME(bh,ih,entry_num) ((char *)(bh->b_data + ih_location(ih) + deh_location(B_I_DEH(bh,ih)+(entry_num)))) #define B_I_E_NAME(bh,ih,entry_num) ((char *)(bh->b_data + ih_location(ih) + deh_location(B_I_DEH(bh,ih)+(entry_num))))
// two entries per block (at least) // two entries per block (at least)
//#define REISERFS_MAX_NAME_LEN(block_size) #define REISERFS_MAX_NAME(block_size) 255
//((block_size - BLKH_SIZE - IH_SIZE - DEH_SIZE * 2) / 2)
#define REISERFS_MAX_NAME_LEN(block_size) 255
/* this structure is used for operations on directory entries. It is /* this structure is used for operations on directory entries. It is
...@@ -1654,6 +1653,11 @@ extern wait_queue_head_t reiserfs_commit_thread_wait ; ...@@ -1654,6 +1653,11 @@ extern wait_queue_head_t reiserfs_commit_thread_wait ;
*/ */
#define JOURNAL_BUFFER(j,n) ((j)->j_ap_blocks[((j)->j_start + (n)) % JOURNAL_BLOCK_COUNT]) #define JOURNAL_BUFFER(j,n) ((j)->j_ap_blocks[((j)->j_start + (n)) % JOURNAL_BLOCK_COUNT])
// We need these to make journal.c code more readable
#define journal_get_hash_table(s, block) __get_hash_table(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize)
#define journal_getblk(s, block) __getblk(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize)
#define journal_bread(s, block) __bread(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize)
void reiserfs_commit_for_inode(struct inode *) ; void reiserfs_commit_for_inode(struct inode *) ;
void reiserfs_update_inode_transaction(struct inode *) ; void reiserfs_update_inode_transaction(struct inode *) ;
void reiserfs_wait_on_write_block(struct super_block *s) ; void reiserfs_wait_on_write_block(struct super_block *s) ;
...@@ -2074,6 +2078,12 @@ int reiserfs_unpack (struct inode * inode, struct file * filp); ...@@ -2074,6 +2078,12 @@ int reiserfs_unpack (struct inode * inode, struct file * filp);
/* ioctl's command */ /* ioctl's command */
#define REISERFS_IOC_UNPACK _IOW(0xCD,1,long) #define REISERFS_IOC_UNPACK _IOW(0xCD,1,long)
/* Locking primitives */
/* Right now we are still falling back to (un)lock_kernel, but eventually that
would evolve into real per-fs locks */
#define reiserfs_write_lock( sb ) lock_kernel()
#define reiserfs_write_unlock( sb ) unlock_kernel()
#endif /* _LINUX_REISER_FS_H */ #endif /* _LINUX_REISER_FS_H */
...@@ -408,6 +408,8 @@ struct reiserfs_sb_info ...@@ -408,6 +408,8 @@ struct reiserfs_sb_info
#define REISERFS_HASHED_RELOCATION 13 #define REISERFS_HASHED_RELOCATION 13
#define REISERFS_TEST4 14 #define REISERFS_TEST4 14
#define REISERFS_ATTRS 15
#define REISERFS_TEST1 11 #define REISERFS_TEST1 11
#define REISERFS_TEST2 12 #define REISERFS_TEST2 12
#define REISERFS_TEST3 13 #define REISERFS_TEST3 13
...@@ -430,7 +432,7 @@ struct reiserfs_sb_info ...@@ -430,7 +432,7 @@ struct reiserfs_sb_info
void reiserfs_file_buffer (struct buffer_head * bh, int list); void reiserfs_file_buffer (struct buffer_head * bh, int list);
int reiserfs_is_super(struct super_block *s) ; int is_reiserfs_super(struct super_block *s) ;
int journal_mark_dirty(struct reiserfs_transaction_handle *, struct super_block *, struct buffer_head *bh) ; int journal_mark_dirty(struct reiserfs_transaction_handle *, struct super_block *, struct buffer_head *bh) ;
int flush_old_commits(struct super_block *s, int) ; int flush_old_commits(struct super_block *s, int) ;
int show_reiserfs_locks(void) ; int show_reiserfs_locks(void) ;
...@@ -456,4 +458,12 @@ int reiserfs_resize(struct super_block *, unsigned long) ; ...@@ -456,4 +458,12 @@ int reiserfs_resize(struct super_block *, unsigned long) ;
#define SB_JOURNAL_MAX_TRANS_AGE(s) (SB_JOURNAL(s)->s_journal_max_trans_age) #define SB_JOURNAL_MAX_TRANS_AGE(s) (SB_JOURNAL(s)->s_journal_max_trans_age)
#define SB_JOURNAL_DEV(s) (SB_JOURNAL(s)->j_dev) #define SB_JOURNAL_DEV(s) (SB_JOURNAL(s)->j_dev)
/* A safe version of the "bdevname", which returns the "s_id" field of
* a superblock or else "Null superblock" if the super block is NULL.
*/
static inline char *reiserfs_bdevname(struct super_block *s)
{
return (s == NULL) ? "Null superblock" : s -> s_id;
}
#endif /* _LINUX_REISER_FS_SB */ #endif /* _LINUX_REISER_FS_SB */
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