mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-07 15:15:29 +00:00
NFSv4.1: Remove redundant reference to the pnfs_layout_hdr
Each layout segment already holds a reference to the pnfs_layout_hdr, so there is no need to hold an extra reference that is released once the last layout segment is freed. Ensure that pnfs_find_alloc_layout() always returns a reference to the pnfs_layout_hdr, which will be matched by the final call to pnfs_put_layout_hdr() in pnfs_update_layout(). Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
parent
57036a3776
commit
01d39ce82b
1 changed files with 4 additions and 9 deletions
|
@ -331,11 +331,8 @@ pnfs_layout_remove_lseg(struct pnfs_layout_hdr *lo,
|
||||||
|
|
||||||
WARN_ON(test_bit(NFS_LSEG_VALID, &lseg->pls_flags));
|
WARN_ON(test_bit(NFS_LSEG_VALID, &lseg->pls_flags));
|
||||||
list_del_init(&lseg->pls_list);
|
list_del_init(&lseg->pls_list);
|
||||||
if (list_empty(&lo->plh_segs)) {
|
if (list_empty(&lo->plh_segs))
|
||||||
set_bit(NFS_LAYOUT_DESTROYED, &lo->plh_flags);
|
set_bit(NFS_LAYOUT_DESTROYED, &lo->plh_flags);
|
||||||
/* Matched by initial refcount set in alloc_init_layout_hdr */
|
|
||||||
pnfs_put_layout_hdr_locked(lo);
|
|
||||||
}
|
|
||||||
rpc_wake_up(&NFS_SERVER(inode)->roc_rpcwaitq);
|
rpc_wake_up(&NFS_SERVER(inode)->roc_rpcwaitq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -468,8 +465,7 @@ pnfs_mark_matching_lsegs_invalid(struct pnfs_layout_hdr *lo,
|
||||||
dprintk("%s:Begin lo %p\n", __func__, lo);
|
dprintk("%s:Begin lo %p\n", __func__, lo);
|
||||||
|
|
||||||
if (list_empty(&lo->plh_segs)) {
|
if (list_empty(&lo->plh_segs)) {
|
||||||
if (!test_and_set_bit(NFS_LAYOUT_DESTROYED, &lo->plh_flags))
|
set_bit(NFS_LAYOUT_DESTROYED, &lo->plh_flags);
|
||||||
pnfs_put_layout_hdr_locked(lo);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
list_for_each_entry_safe(lseg, next, &lo->plh_segs, pls_list)
|
list_for_each_entry_safe(lseg, next, &lo->plh_segs, pls_list)
|
||||||
|
@ -929,7 +925,7 @@ pnfs_find_alloc_layout(struct inode *ino,
|
||||||
if (nfsi->layout) {
|
if (nfsi->layout) {
|
||||||
if (test_bit(NFS_LAYOUT_DESTROYED, &nfsi->layout->plh_flags))
|
if (test_bit(NFS_LAYOUT_DESTROYED, &nfsi->layout->plh_flags))
|
||||||
return NULL;
|
return NULL;
|
||||||
else
|
pnfs_get_layout_hdr(nfsi->layout);
|
||||||
return nfsi->layout;
|
return nfsi->layout;
|
||||||
}
|
}
|
||||||
spin_unlock(&ino->i_lock);
|
spin_unlock(&ino->i_lock);
|
||||||
|
@ -1129,7 +1125,6 @@ pnfs_update_layout(struct inode *ino,
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
atomic_inc(&lo->plh_outstanding);
|
atomic_inc(&lo->plh_outstanding);
|
||||||
|
|
||||||
pnfs_get_layout_hdr(lo);
|
|
||||||
if (list_empty(&lo->plh_segs))
|
if (list_empty(&lo->plh_segs))
|
||||||
first = true;
|
first = true;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue