inode->i_op = &jfs_file_inode_operations;
init_special_inode(inode, inode->i_mode, inode->i_rdev);
}
- jfs_set_inode_flags(inode);
}
/*
}
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;
}
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
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)
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);
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,
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;
}
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 */
}