X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=fs%2Fjfs%2Finode.c;fp=fs%2Fjfs%2Finode.c;h=3df78573b424c9dc772a745203b254bd035baa7c;hb=64ba3f394c830ec48a1c31b53dcae312c56f1604;hp=f8a1714baf918d70d47a21f5e49dbed8bd5db09a;hpb=be1e6109ac94a859551f8e1774eb9a8469fe055c;p=linux-2.6.git diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c index f8a1714ba..3df78573b 100644 --- a/fs/jfs/inode.c +++ b/fs/jfs/inode.c @@ -56,7 +56,6 @@ void jfs_read_inode(struct inode *inode) inode->i_op = &jfs_file_inode_operations; init_special_inode(inode, inode->i_mode, inode->i_rdev); } - jfs_set_inode_flags(inode); } /* @@ -91,16 +90,16 @@ int jfs_commit_inode(struct inode *inode, int wait) } tid = txBegin(inode->i_sb, COMMIT_INODE); - mutex_lock(&JFS_IP(inode)->commit_mutex); + down(&JFS_IP(inode)->commit_sem); /* - * Retest inode state after taking commit_mutex + * Retest inode state after taking commit_sem */ if (inode->i_nlink && test_cflag(COMMIT_Dirty, inode)) rc = txCommit(tid, 1, &inode, wait ? COMMIT_SYNC : 0); txEnd(tid); - mutex_unlock(&JFS_IP(inode)->commit_mutex); + up(&JFS_IP(inode)->commit_sem); return rc; } @@ -170,15 +169,16 @@ void jfs_dirty_inode(struct inode *inode) set_cflag(COMMIT_Dirty, inode); } -int jfs_get_block(struct inode *ip, sector_t lblock, - struct buffer_head *bh_result, int create) +static int +jfs_get_blocks(struct inode *ip, sector_t lblock, unsigned long max_blocks, + struct buffer_head *bh_result, int create) { s64 lblock64 = lblock; int rc = 0; xad_t xad; s64 xaddr; int xflag; - s32 xlen = bh_result->b_size >> ip->i_blkbits; + s32 xlen = max_blocks; /* * Take appropriate lock on inode @@ -189,7 +189,7 @@ int jfs_get_block(struct inode *ip, sector_t lblock, IREAD_LOCK(ip); if (((lblock64 << ip->i_sb->s_blocksize_bits) < ip->i_size) && - (!xtLookup(ip, lblock64, xlen, &xflag, &xaddr, &xlen, 0)) && + (!xtLookup(ip, lblock64, max_blocks, &xflag, &xaddr, &xlen, 0)) && xaddr) { if (xflag & XAD_NOTRECORDED) { if (!create) @@ -256,6 +256,12 @@ int jfs_get_block(struct inode *ip, sector_t lblock, return rc; } +static int jfs_get_block(struct inode *ip, sector_t lblock, + struct buffer_head *bh_result, int create) +{ + return jfs_get_blocks(ip, lblock, 1, bh_result, create); +} + static int jfs_writepage(struct page *page, struct writeback_control *wbc) { return nobh_writepage(page, jfs_get_block, wbc); @@ -296,10 +302,10 @@ static ssize_t jfs_direct_IO(int rw, struct kiocb *iocb, struct inode *inode = file->f_mapping->host; return blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov, - offset, nr_segs, jfs_get_block, NULL); + offset, nr_segs, jfs_get_blocks, NULL); } -const struct address_space_operations jfs_aops = { +struct address_space_operations jfs_aops = { .readpage = jfs_readpage, .readpages = jfs_readpages, .writepage = jfs_writepage, @@ -331,18 +337,18 @@ void jfs_truncate_nolock(struct inode *ip, loff_t length) tid = txBegin(ip->i_sb, 0); /* - * The commit_mutex cannot be taken before txBegin. + * The commit_sem cannot be taken before txBegin. * txBegin may block and there is a chance the inode * could be marked dirty and need to be committed * before txBegin unblocks */ - mutex_lock(&JFS_IP(ip)->commit_mutex); + down(&JFS_IP(ip)->commit_sem); newsize = xtTruncate(tid, ip, length, COMMIT_TRUNCATE | COMMIT_PWMAP); if (newsize < 0) { txEnd(tid); - mutex_unlock(&JFS_IP(ip)->commit_mutex); + up(&JFS_IP(ip)->commit_sem); break; } @@ -351,7 +357,7 @@ void jfs_truncate_nolock(struct inode *ip, loff_t length) txCommit(tid, 1, &ip, 0); txEnd(tid); - mutex_unlock(&JFS_IP(ip)->commit_mutex); + up(&JFS_IP(ip)->commit_sem); } while (newsize > length); /* Truncate isn't always atomic */ }