diff options
Diffstat (limited to 'fs/jfs/inode.c')
-rw-r--r-- | fs/jfs/inode.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c index 9f942ca8e4e3..04eb78f1252e 100644 --- a/fs/jfs/inode.c +++ b/fs/jfs/inode.c | |||
@@ -55,6 +55,7 @@ void jfs_read_inode(struct inode *inode) | |||
55 | inode->i_op = &jfs_file_inode_operations; | 55 | inode->i_op = &jfs_file_inode_operations; |
56 | init_special_inode(inode, inode->i_mode, inode->i_rdev); | 56 | init_special_inode(inode, inode->i_mode, inode->i_rdev); |
57 | } | 57 | } |
58 | jfs_set_inode_flags(inode); | ||
58 | } | 59 | } |
59 | 60 | ||
60 | /* | 61 | /* |
@@ -89,16 +90,16 @@ int jfs_commit_inode(struct inode *inode, int wait) | |||
89 | } | 90 | } |
90 | 91 | ||
91 | tid = txBegin(inode->i_sb, COMMIT_INODE); | 92 | tid = txBegin(inode->i_sb, COMMIT_INODE); |
92 | down(&JFS_IP(inode)->commit_sem); | 93 | mutex_lock(&JFS_IP(inode)->commit_mutex); |
93 | 94 | ||
94 | /* | 95 | /* |
95 | * Retest inode state after taking commit_sem | 96 | * Retest inode state after taking commit_mutex |
96 | */ | 97 | */ |
97 | if (inode->i_nlink && test_cflag(COMMIT_Dirty, inode)) | 98 | if (inode->i_nlink && test_cflag(COMMIT_Dirty, inode)) |
98 | rc = txCommit(tid, 1, &inode, wait ? COMMIT_SYNC : 0); | 99 | rc = txCommit(tid, 1, &inode, wait ? COMMIT_SYNC : 0); |
99 | 100 | ||
100 | txEnd(tid); | 101 | txEnd(tid); |
101 | up(&JFS_IP(inode)->commit_sem); | 102 | mutex_unlock(&JFS_IP(inode)->commit_mutex); |
102 | return rc; | 103 | return rc; |
103 | } | 104 | } |
104 | 105 | ||
@@ -257,7 +258,8 @@ jfs_get_blocks(struct inode *ip, sector_t lblock, unsigned long max_blocks, | |||
257 | static int jfs_get_block(struct inode *ip, sector_t lblock, | 258 | static int jfs_get_block(struct inode *ip, sector_t lblock, |
258 | struct buffer_head *bh_result, int create) | 259 | struct buffer_head *bh_result, int create) |
259 | { | 260 | { |
260 | return jfs_get_blocks(ip, lblock, 1, bh_result, create); | 261 | return jfs_get_blocks(ip, lblock, bh_result->b_size >> ip->i_blkbits, |
262 | bh_result, create); | ||
261 | } | 263 | } |
262 | 264 | ||
263 | static int jfs_writepage(struct page *page, struct writeback_control *wbc) | 265 | static int jfs_writepage(struct page *page, struct writeback_control *wbc) |
@@ -300,7 +302,7 @@ static ssize_t jfs_direct_IO(int rw, struct kiocb *iocb, | |||
300 | struct inode *inode = file->f_mapping->host; | 302 | struct inode *inode = file->f_mapping->host; |
301 | 303 | ||
302 | return blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov, | 304 | return blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov, |
303 | offset, nr_segs, jfs_get_blocks, NULL); | 305 | offset, nr_segs, jfs_get_block, NULL); |
304 | } | 306 | } |
305 | 307 | ||
306 | struct address_space_operations jfs_aops = { | 308 | struct address_space_operations jfs_aops = { |
@@ -335,18 +337,18 @@ void jfs_truncate_nolock(struct inode *ip, loff_t length) | |||
335 | tid = txBegin(ip->i_sb, 0); | 337 | tid = txBegin(ip->i_sb, 0); |
336 | 338 | ||
337 | /* | 339 | /* |
338 | * The commit_sem cannot be taken before txBegin. | 340 | * The commit_mutex cannot be taken before txBegin. |
339 | * txBegin may block and there is a chance the inode | 341 | * txBegin may block and there is a chance the inode |
340 | * could be marked dirty and need to be committed | 342 | * could be marked dirty and need to be committed |
341 | * before txBegin unblocks | 343 | * before txBegin unblocks |
342 | */ | 344 | */ |
343 | down(&JFS_IP(ip)->commit_sem); | 345 | mutex_lock(&JFS_IP(ip)->commit_mutex); |
344 | 346 | ||
345 | newsize = xtTruncate(tid, ip, length, | 347 | newsize = xtTruncate(tid, ip, length, |
346 | COMMIT_TRUNCATE | COMMIT_PWMAP); | 348 | COMMIT_TRUNCATE | COMMIT_PWMAP); |
347 | if (newsize < 0) { | 349 | if (newsize < 0) { |
348 | txEnd(tid); | 350 | txEnd(tid); |
349 | up(&JFS_IP(ip)->commit_sem); | 351 | mutex_unlock(&JFS_IP(ip)->commit_mutex); |
350 | break; | 352 | break; |
351 | } | 353 | } |
352 | 354 | ||
@@ -355,7 +357,7 @@ void jfs_truncate_nolock(struct inode *ip, loff_t length) | |||
355 | 357 | ||
356 | txCommit(tid, 1, &ip, 0); | 358 | txCommit(tid, 1, &ip, 0); |
357 | txEnd(tid); | 359 | txEnd(tid); |
358 | up(&JFS_IP(ip)->commit_sem); | 360 | mutex_unlock(&JFS_IP(ip)->commit_mutex); |
359 | } while (newsize > length); /* Truncate isn't always atomic */ | 361 | } while (newsize > length); /* Truncate isn't always atomic */ |
360 | } | 362 | } |
361 | 363 | ||