mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-12 08:48:48 +00:00
[XFS] Simplify pagebuf_rele Remove a conditional that can not be true
anymore and simplify the final put path a little SGI-PV: 908809 SGI-Modid: xfs-linux:xfs-kern:200790a Signed-off-by: Christoph Hellwig <hch@sgi.com> Signed-off-by: Nathan Scott <nathans@sgi.com>
This commit is contained in:
parent
e718eeb4fe
commit
7f14d0a013
@ -830,39 +830,18 @@ pagebuf_rele(
|
|||||||
|
|
||||||
PB_TRACE(pb, "rele", pb->pb_relse);
|
PB_TRACE(pb, "rele", pb->pb_relse);
|
||||||
|
|
||||||
/*
|
|
||||||
* pagebuf_lookup buffers are not hashed, not delayed write,
|
|
||||||
* and don't have their own release routines. Special case.
|
|
||||||
*/
|
|
||||||
if (unlikely(!hash)) {
|
|
||||||
ASSERT(!pb->pb_relse);
|
|
||||||
if (atomic_dec_and_test(&pb->pb_hold))
|
|
||||||
xfs_buf_free(pb);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (atomic_dec_and_lock(&pb->pb_hold, &hash->bh_lock)) {
|
if (atomic_dec_and_lock(&pb->pb_hold, &hash->bh_lock)) {
|
||||||
int do_free = 1;
|
|
||||||
|
|
||||||
if (pb->pb_relse) {
|
if (pb->pb_relse) {
|
||||||
atomic_inc(&pb->pb_hold);
|
atomic_inc(&pb->pb_hold);
|
||||||
spin_unlock(&hash->bh_lock);
|
spin_unlock(&hash->bh_lock);
|
||||||
(*(pb->pb_relse)) (pb);
|
(*(pb->pb_relse)) (pb);
|
||||||
spin_lock(&hash->bh_lock);
|
} else if (pb->pb_flags & PBF_FS_MANAGED) {
|
||||||
do_free = 0;
|
spin_unlock(&hash->bh_lock);
|
||||||
}
|
} else {
|
||||||
|
ASSERT(!(pb->pb_flags & (PBF_DELWRI|_PBF_DELWRI_Q)));
|
||||||
if (pb->pb_flags & PBF_FS_MANAGED) {
|
|
||||||
do_free = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (do_free) {
|
|
||||||
ASSERT((pb->pb_flags & (PBF_DELWRI|_PBF_DELWRI_Q)) == 0);
|
|
||||||
list_del_init(&pb->pb_hash_list);
|
list_del_init(&pb->pb_hash_list);
|
||||||
spin_unlock(&hash->bh_lock);
|
spin_unlock(&hash->bh_lock);
|
||||||
pagebuf_free(pb);
|
pagebuf_free(pb);
|
||||||
} else {
|
|
||||||
spin_unlock(&hash->bh_lock);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user