diff options
| author | Anton Altaparmakov <aia21@cantab.net> | 2005-10-31 05:06:46 -0500 |
|---|---|---|
| committer | Anton Altaparmakov <aia21@cantab.net> | 2005-10-31 05:06:46 -0500 |
| commit | 1f04c0a24b2f3cfe89c802a24396263623e3512d (patch) | |
| tree | d7e2216b6e65b833c0c2b79b478d13ce17dbf296 /fs/fs-writeback.c | |
| parent | 07b188ab773e183871e57b33ae37bf635c9f12ba (diff) | |
| parent | e2f2e58e7968f8446b1078a20a18bf8ea12b4fbc (diff) | |
Merge branch 'master' of /usr/src/ntfs-2.6/
Diffstat (limited to 'fs/fs-writeback.c')
| -rw-r--r-- | fs/fs-writeback.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index e94ab398b717..ffab4783ac64 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
| @@ -230,7 +230,6 @@ __sync_single_inode(struct inode *inode, struct writeback_control *wbc) | |||
| 230 | * The inode is clean, unused | 230 | * The inode is clean, unused |
| 231 | */ | 231 | */ |
| 232 | list_move(&inode->i_list, &inode_unused); | 232 | list_move(&inode->i_list, &inode_unused); |
| 233 | inodes_stat.nr_unused++; | ||
| 234 | } | 233 | } |
| 235 | } | 234 | } |
| 236 | wake_up_inode(inode); | 235 | wake_up_inode(inode); |
| @@ -238,14 +237,20 @@ __sync_single_inode(struct inode *inode, struct writeback_control *wbc) | |||
| 238 | } | 237 | } |
| 239 | 238 | ||
| 240 | /* | 239 | /* |
| 241 | * Write out an inode's dirty pages. Called under inode_lock. | 240 | * Write out an inode's dirty pages. Called under inode_lock. Either the |
| 241 | * caller has ref on the inode (either via __iget or via syscall against an fd) | ||
| 242 | * or the inode has I_WILL_FREE set (via generic_forget_inode) | ||
| 242 | */ | 243 | */ |
| 243 | static int | 244 | static int |
| 244 | __writeback_single_inode(struct inode *inode, | 245 | __writeback_single_inode(struct inode *inode, struct writeback_control *wbc) |
| 245 | struct writeback_control *wbc) | ||
| 246 | { | 246 | { |
| 247 | wait_queue_head_t *wqh; | 247 | wait_queue_head_t *wqh; |
| 248 | 248 | ||
| 249 | if (!atomic_read(&inode->i_count)) | ||
| 250 | WARN_ON(!(inode->i_state & I_WILL_FREE)); | ||
| 251 | else | ||
| 252 | WARN_ON(inode->i_state & I_WILL_FREE); | ||
| 253 | |||
| 249 | if ((wbc->sync_mode != WB_SYNC_ALL) && (inode->i_state & I_LOCK)) { | 254 | if ((wbc->sync_mode != WB_SYNC_ALL) && (inode->i_state & I_LOCK)) { |
| 250 | list_move(&inode->i_list, &inode->i_sb->s_dirty); | 255 | list_move(&inode->i_list, &inode->i_sb->s_dirty); |
| 251 | return 0; | 256 | return 0; |
| @@ -259,11 +264,9 @@ __writeback_single_inode(struct inode *inode, | |||
| 259 | 264 | ||
| 260 | wqh = bit_waitqueue(&inode->i_state, __I_LOCK); | 265 | wqh = bit_waitqueue(&inode->i_state, __I_LOCK); |
| 261 | do { | 266 | do { |
| 262 | __iget(inode); | ||
| 263 | spin_unlock(&inode_lock); | 267 | spin_unlock(&inode_lock); |
| 264 | __wait_on_bit(wqh, &wq, inode_wait, | 268 | __wait_on_bit(wqh, &wq, inode_wait, |
| 265 | TASK_UNINTERRUPTIBLE); | 269 | TASK_UNINTERRUPTIBLE); |
| 266 | iput(inode); | ||
| 267 | spin_lock(&inode_lock); | 270 | spin_lock(&inode_lock); |
| 268 | } while (inode->i_state & I_LOCK); | 271 | } while (inode->i_state & I_LOCK); |
| 269 | } | 272 | } |
| @@ -541,14 +544,15 @@ void sync_inodes(int wait) | |||
| 541 | } | 544 | } |
| 542 | 545 | ||
| 543 | /** | 546 | /** |
| 544 | * write_inode_now - write an inode to disk | 547 | * write_inode_now - write an inode to disk |
| 545 | * @inode: inode to write to disk | 548 | * @inode: inode to write to disk |
| 546 | * @sync: whether the write should be synchronous or not | 549 | * @sync: whether the write should be synchronous or not |
| 550 | * | ||
| 551 | * This function commits an inode to disk immediately if it is dirty. This is | ||
| 552 | * primarily needed by knfsd. | ||
| 547 | * | 553 | * |
| 548 | * This function commits an inode to disk immediately if it is | 554 | * The caller must either have a ref on the inode or must have set I_WILL_FREE. |
| 549 | * dirty. This is primarily needed by knfsd. | ||
| 550 | */ | 555 | */ |
| 551 | |||
| 552 | int write_inode_now(struct inode *inode, int sync) | 556 | int write_inode_now(struct inode *inode, int sync) |
| 553 | { | 557 | { |
| 554 | int ret; | 558 | int ret; |
