NFSv4/pnfs: Replace pnfs_put_lseg_locked() with pnfs_put_lseg()
authorTrond Myklebust <trond.myklebust@primarydata.com>
Tue, 1 Aug 2017 21:07:02 +0000 (17:07 -0400)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Tue, 15 Aug 2017 15:54:48 +0000 (11:54 -0400)
Now that we no longer hold the inode->i_lock when manipulating the
commit lists, it is safe to call pnfs_put_lseg() again.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/pnfs.c
fs/nfs/pnfs.h
fs/nfs/pnfs_nfs.c

index c383d0913b54c90fb96020a62faaf989a5d946b3..3125a9d7b23772f03f9aeae5c4f8547b6f8e1280 100644 (file)
@@ -529,47 +529,6 @@ pnfs_put_lseg(struct pnfs_layout_segment *lseg)
 }
 EXPORT_SYMBOL_GPL(pnfs_put_lseg);
 
-static void pnfs_free_lseg_async_work(struct work_struct *work)
-{
-       struct pnfs_layout_segment *lseg;
-       struct pnfs_layout_hdr *lo;
-
-       lseg = container_of(work, struct pnfs_layout_segment, pls_work);
-       lo = lseg->pls_layout;
-
-       pnfs_free_lseg(lseg);
-       pnfs_put_layout_hdr(lo);
-}
-
-static void pnfs_free_lseg_async(struct pnfs_layout_segment *lseg)
-{
-       INIT_WORK(&lseg->pls_work, pnfs_free_lseg_async_work);
-       schedule_work(&lseg->pls_work);
-}
-
-void
-pnfs_put_lseg_locked(struct pnfs_layout_segment *lseg)
-{
-       if (!lseg)
-               return;
-
-       assert_spin_locked(&lseg->pls_layout->plh_inode->i_lock);
-
-       dprintk("%s: lseg %p ref %d valid %d\n", __func__, lseg,
-               atomic_read(&lseg->pls_refcount),
-               test_bit(NFS_LSEG_VALID, &lseg->pls_flags));
-       if (atomic_dec_and_test(&lseg->pls_refcount)) {
-               struct pnfs_layout_hdr *lo = lseg->pls_layout;
-               if (test_bit(NFS_LSEG_VALID, &lseg->pls_flags))
-                       return;
-               pnfs_layout_remove_lseg(lo, lseg);
-               if (!pnfs_cache_lseg_for_layoutreturn(lo, lseg)) {
-                       pnfs_get_layout_hdr(lo);
-                       pnfs_free_lseg_async(lseg);
-               }
-       }
-}
-
 /*
  * is l2 fully contained in l1?
  *   start1                             end1
index 99731e3e332f3ec32eec26cca47556193dcf68fe..87f144f14d1e0c0c6c3232cc54c6e6b4167d5c24 100644 (file)
@@ -67,7 +67,6 @@ struct pnfs_layout_segment {
        u32 pls_seq;
        unsigned long pls_flags;
        struct pnfs_layout_hdr *pls_layout;
-       struct work_struct pls_work;
 };
 
 enum pnfs_try_status {
@@ -230,7 +229,6 @@ extern int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp, bool sync);
 /* pnfs.c */
 void pnfs_get_layout_hdr(struct pnfs_layout_hdr *lo);
 void pnfs_put_lseg(struct pnfs_layout_segment *lseg);
-void pnfs_put_lseg_locked(struct pnfs_layout_segment *lseg);
 
 void set_pnfs_layoutdriver(struct nfs_server *, const struct nfs_fh *, struct nfs_fsinfo *);
 void unset_pnfs_layoutdriver(struct nfs_server *);
index 2cdee8ce209492903115df0e513a01665e6bb6b9..4b0a809653d185fb451a1578c29a36aec1606957 100644 (file)
@@ -83,7 +83,7 @@ pnfs_generic_clear_request_commit(struct nfs_page *req,
        }
 out:
        nfs_request_remove_commit_list(req, cinfo);
-       pnfs_put_lseg_locked(freeme);
+       pnfs_put_lseg(freeme);
 }
 EXPORT_SYMBOL_GPL(pnfs_generic_clear_request_commit);
 
@@ -126,7 +126,7 @@ pnfs_generic_scan_ds_commit_list(struct pnfs_commit_bucket *bucket,
                if (bucket->clseg == NULL)
                        bucket->clseg = pnfs_get_lseg(bucket->wlseg);
                if (list_empty(src)) {
-                       pnfs_put_lseg_locked(bucket->wlseg);
+                       pnfs_put_lseg(bucket->wlseg);
                        bucket->wlseg = NULL;
                }
        }