aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/write.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2006-12-05 00:35:39 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-12-06 10:46:37 -0500
commit87a4ce16082e92b4b6d27596a517b302f3692650 (patch)
tree5cc37898459d69135b09ed9485d54745d15922ba /fs/nfs/write.c
parent49a70f278658894d2899824cd4037095fb6711fe (diff)
NFS: Remove call to igrab() from nfs_writepage()
We always ensure that the nfs_open_context holds a reference to the dentry, so the test in nfs_writepage() for whether or not the inode is referenced is redundant. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/write.c')
-rw-r--r--fs/nfs/write.c16
1 files changed, 1 insertions, 15 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 3f6ca5229562..74e86601d978 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -317,24 +317,12 @@ int nfs_writepage(struct page *page, struct writeback_control *wbc)
317 struct nfs_open_context *ctx; 317 struct nfs_open_context *ctx;
318 struct inode *inode = page->mapping->host; 318 struct inode *inode = page->mapping->host;
319 unsigned offset; 319 unsigned offset;
320 int inode_referenced = 0;
321 int priority = wb_priority(wbc); 320 int priority = wb_priority(wbc);
322 int err; 321 int err;
323 322
324 nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGE); 323 nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGE);
325 nfs_add_stats(inode, NFSIOS_WRITEPAGES, 1); 324 nfs_add_stats(inode, NFSIOS_WRITEPAGES, 1);
326 325
327 /*
328 * Note: We need to ensure that we have a reference to the inode
329 * if we are to do asynchronous writes. If not, waiting
330 * in nfs_wait_on_request() may deadlock with clear_inode().
331 *
332 * If igrab() fails here, then it is in any case safe to
333 * call nfs_wb_page(), since there will be no pending writes.
334 */
335 if (igrab(inode) != 0)
336 inode_referenced = 1;
337
338 /* Ensure we've flushed out any previous writes */ 326 /* Ensure we've flushed out any previous writes */
339 nfs_wb_page_priority(inode, page, priority); 327 nfs_wb_page_priority(inode, page, priority);
340 328
@@ -349,7 +337,7 @@ int nfs_writepage(struct page *page, struct writeback_control *wbc)
349 goto out; 337 goto out;
350 } 338 }
351 lock_kernel(); 339 lock_kernel();
352 if (!IS_SYNC(inode) && inode_referenced) { 340 if (!IS_SYNC(inode)) {
353 err = nfs_writepage_async(ctx, inode, page, 0, offset); 341 err = nfs_writepage_async(ctx, inode, page, 0, offset);
354 if (!wbc->for_writepages) 342 if (!wbc->for_writepages)
355 nfs_flush_mapping(page->mapping, wbc, wb_priority(wbc)); 343 nfs_flush_mapping(page->mapping, wbc, wb_priority(wbc));
@@ -366,8 +354,6 @@ int nfs_writepage(struct page *page, struct writeback_control *wbc)
366 put_nfs_open_context(ctx); 354 put_nfs_open_context(ctx);
367out: 355out:
368 unlock_page(page); 356 unlock_page(page);
369 if (inode_referenced)
370 iput(inode);
371 return err; 357 return err;
372} 358}
373 359