diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-02-29 02:48:05 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-02-29 02:48:05 -0500 |
commit | cdd0972945dbcb8ea24db365d9b0e100af2a27bb (patch) | |
tree | d41204db20ccc81cecf99a332e2fa764075e8637 /fs/nfs | |
parent | 5e4424af9a1f062c6451681dff24a26e27741cc6 (diff) | |
parent | cbc20059259edee4ea24c923e6627c394830c972 (diff) |
Merge branch 'cleanups' into next
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/write.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 30513029c00c..1667e3984418 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -351,15 +351,13 @@ int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc) | |||
351 | /* | 351 | /* |
352 | * Insert a write request into an inode | 352 | * Insert a write request into an inode |
353 | */ | 353 | */ |
354 | static int nfs_inode_add_request(struct inode *inode, struct nfs_page *req) | 354 | static void nfs_inode_add_request(struct inode *inode, struct nfs_page *req) |
355 | { | 355 | { |
356 | struct nfs_inode *nfsi = NFS_I(inode); | 356 | struct nfs_inode *nfsi = NFS_I(inode); |
357 | int error; | 357 | int error; |
358 | 358 | ||
359 | error = radix_tree_insert(&nfsi->nfs_page_tree, req->wb_index, req); | 359 | error = radix_tree_insert(&nfsi->nfs_page_tree, req->wb_index, req); |
360 | BUG_ON(error == -EEXIST); | 360 | BUG_ON(error); |
361 | if (error) | ||
362 | return error; | ||
363 | if (!nfsi->npages) { | 361 | if (!nfsi->npages) { |
364 | igrab(inode); | 362 | igrab(inode); |
365 | if (nfs_have_delegation(inode, FMODE_WRITE)) | 363 | if (nfs_have_delegation(inode, FMODE_WRITE)) |
@@ -369,8 +367,8 @@ static int nfs_inode_add_request(struct inode *inode, struct nfs_page *req) | |||
369 | set_page_private(req->wb_page, (unsigned long)req); | 367 | set_page_private(req->wb_page, (unsigned long)req); |
370 | nfsi->npages++; | 368 | nfsi->npages++; |
371 | kref_get(&req->wb_kref); | 369 | kref_get(&req->wb_kref); |
372 | radix_tree_tag_set(&nfsi->nfs_page_tree, req->wb_index, NFS_PAGE_TAG_LOCKED); | 370 | radix_tree_tag_set(&nfsi->nfs_page_tree, req->wb_index, |
373 | return 0; | 371 | NFS_PAGE_TAG_LOCKED); |
374 | } | 372 | } |
375 | 373 | ||
376 | /* | 374 | /* |
@@ -582,6 +580,13 @@ static struct nfs_page * nfs_update_request(struct nfs_open_context* ctx, | |||
582 | /* Loop over all inode entries and see if we find | 580 | /* Loop over all inode entries and see if we find |
583 | * A request for the page we wish to update | 581 | * A request for the page we wish to update |
584 | */ | 582 | */ |
583 | if (new) { | ||
584 | if (radix_tree_preload(GFP_NOFS)) { | ||
585 | nfs_release_request(new); | ||
586 | return ERR_PTR(-ENOMEM); | ||
587 | } | ||
588 | } | ||
589 | |||
585 | spin_lock(&inode->i_lock); | 590 | spin_lock(&inode->i_lock); |
586 | req = nfs_page_find_request_locked(page); | 591 | req = nfs_page_find_request_locked(page); |
587 | if (req) { | 592 | if (req) { |
@@ -592,28 +597,27 @@ static struct nfs_page * nfs_update_request(struct nfs_open_context* ctx, | |||
592 | error = nfs_wait_on_request(req); | 597 | error = nfs_wait_on_request(req); |
593 | nfs_release_request(req); | 598 | nfs_release_request(req); |
594 | if (error < 0) { | 599 | if (error < 0) { |
595 | if (new) | 600 | if (new) { |
601 | radix_tree_preload_end(); | ||
596 | nfs_release_request(new); | 602 | nfs_release_request(new); |
603 | } | ||
597 | return ERR_PTR(error); | 604 | return ERR_PTR(error); |
598 | } | 605 | } |
599 | continue; | 606 | continue; |
600 | } | 607 | } |
601 | spin_unlock(&inode->i_lock); | 608 | spin_unlock(&inode->i_lock); |
602 | if (new) | 609 | if (new) { |
610 | radix_tree_preload_end(); | ||
603 | nfs_release_request(new); | 611 | nfs_release_request(new); |
612 | } | ||
604 | break; | 613 | break; |
605 | } | 614 | } |
606 | 615 | ||
607 | if (new) { | 616 | if (new) { |
608 | int error; | ||
609 | nfs_lock_request_dontget(new); | 617 | nfs_lock_request_dontget(new); |
610 | error = nfs_inode_add_request(inode, new); | 618 | nfs_inode_add_request(inode, new); |
611 | if (error) { | ||
612 | spin_unlock(&inode->i_lock); | ||
613 | nfs_unlock_request(new); | ||
614 | return ERR_PTR(error); | ||
615 | } | ||
616 | spin_unlock(&inode->i_lock); | 619 | spin_unlock(&inode->i_lock); |
620 | radix_tree_preload_end(); | ||
617 | req = new; | 621 | req = new; |
618 | goto zero_page; | 622 | goto zero_page; |
619 | } | 623 | } |