mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
gfs2: Switch to list_{first,last}_entry
Replace open-coded versions of list_first_entry and list_last_entry with those functions. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
This commit is contained in:
parent
40e7e86ef1
commit
969183bc68
7 changed files with 19 additions and 19 deletions
|
@ -2223,7 +2223,7 @@ void gfs2_free_journal_extents(struct gfs2_jdesc *jd)
|
|||
struct gfs2_journal_extent *jext;
|
||||
|
||||
while(!list_empty(&jd->extent_list)) {
|
||||
jext = list_entry(jd->extent_list.next, struct gfs2_journal_extent, list);
|
||||
jext = list_first_entry(&jd->extent_list, struct gfs2_journal_extent, list);
|
||||
list_del(&jext->list);
|
||||
kfree(jext);
|
||||
}
|
||||
|
@ -2244,7 +2244,7 @@ static int gfs2_add_jextent(struct gfs2_jdesc *jd, u64 lblock, u64 dblock, u64 b
|
|||
struct gfs2_journal_extent *jext;
|
||||
|
||||
if (!list_empty(&jd->extent_list)) {
|
||||
jext = list_entry(jd->extent_list.prev, struct gfs2_journal_extent, list);
|
||||
jext = list_last_entry(&jd->extent_list, struct gfs2_journal_extent, list);
|
||||
if ((jext->dblock + jext->blocks) == dblock) {
|
||||
jext->blocks += blocks;
|
||||
return 0;
|
||||
|
|
|
@ -308,7 +308,7 @@ void gfs2_glock_put(struct gfs2_glock *gl)
|
|||
|
||||
static inline int may_grant(const struct gfs2_glock *gl, const struct gfs2_holder *gh)
|
||||
{
|
||||
const struct gfs2_holder *gh_head = list_entry(gl->gl_holders.next, const struct gfs2_holder, gh_list);
|
||||
const struct gfs2_holder *gh_head = list_first_entry(&gl->gl_holders, const struct gfs2_holder, gh_list);
|
||||
if ((gh->gh_state == LM_ST_EXCLUSIVE ||
|
||||
gh_head->gh_state == LM_ST_EXCLUSIVE) && gh != gh_head)
|
||||
return 0;
|
||||
|
@ -690,7 +690,7 @@ static inline struct gfs2_holder *find_first_holder(const struct gfs2_glock *gl)
|
|||
struct gfs2_holder *gh;
|
||||
|
||||
if (!list_empty(&gl->gl_holders)) {
|
||||
gh = list_entry(gl->gl_holders.next, struct gfs2_holder, gh_list);
|
||||
gh = list_first_entry(&gl->gl_holders, struct gfs2_holder, gh_list);
|
||||
if (test_bit(HIF_HOLDER, &gh->gh_iflags))
|
||||
return gh;
|
||||
}
|
||||
|
@ -1240,7 +1240,7 @@ __acquires(&gl->gl_lockref.lock)
|
|||
}
|
||||
list_add_tail(&gh->gh_list, insert_pt);
|
||||
do_cancel:
|
||||
gh = list_entry(gl->gl_holders.next, struct gfs2_holder, gh_list);
|
||||
gh = list_first_entry(&gl->gl_holders, struct gfs2_holder, gh_list);
|
||||
if (!(gh->gh_flags & LM_FLAG_PRIORITY)) {
|
||||
spin_unlock(&gl->gl_lockref.lock);
|
||||
if (sdp->sd_lockstruct.ls_ops->lm_cancel)
|
||||
|
@ -1642,7 +1642,7 @@ __acquires(&lru_lock)
|
|||
list_sort(NULL, list, glock_cmp);
|
||||
|
||||
while(!list_empty(list)) {
|
||||
gl = list_entry(list->next, struct gfs2_glock, gl_lru);
|
||||
gl = list_first_entry(list, struct gfs2_glock, gl_lru);
|
||||
list_del_init(&gl->gl_lru);
|
||||
if (!spin_trylock(&gl->gl_lockref.lock)) {
|
||||
add_back_to_lru:
|
||||
|
@ -1683,7 +1683,7 @@ static long gfs2_scan_glock_lru(int nr)
|
|||
|
||||
spin_lock(&lru_lock);
|
||||
while ((nr-- >= 0) && !list_empty(&lru_list)) {
|
||||
gl = list_entry(lru_list.next, struct gfs2_glock, gl_lru);
|
||||
gl = list_first_entry(&lru_list, struct gfs2_glock, gl_lru);
|
||||
|
||||
/* Test for being demotable */
|
||||
if (!test_bit(GLF_LOCK, &gl->gl_flags)) {
|
||||
|
|
|
@ -518,7 +518,7 @@ static unsigned int current_tail(struct gfs2_sbd *sdp)
|
|||
if (list_empty(&sdp->sd_ail1_list)) {
|
||||
tail = sdp->sd_log_head;
|
||||
} else {
|
||||
tr = list_entry(sdp->sd_ail1_list.prev, struct gfs2_trans,
|
||||
tr = list_last_entry(&sdp->sd_ail1_list, struct gfs2_trans,
|
||||
tr_list);
|
||||
tail = tr->tr_first;
|
||||
}
|
||||
|
@ -580,7 +580,7 @@ static void gfs2_ordered_write(struct gfs2_sbd *sdp)
|
|||
spin_lock(&sdp->sd_ordered_lock);
|
||||
list_sort(NULL, &sdp->sd_log_ordered, &ip_cmp);
|
||||
while (!list_empty(&sdp->sd_log_ordered)) {
|
||||
ip = list_entry(sdp->sd_log_ordered.next, struct gfs2_inode, i_ordered);
|
||||
ip = list_first_entry(&sdp->sd_log_ordered, struct gfs2_inode, i_ordered);
|
||||
if (ip->i_inode.i_mapping->nrpages == 0) {
|
||||
test_and_clear_bit(GIF_ORDERED, &ip->i_flags);
|
||||
list_del(&ip->i_ordered);
|
||||
|
@ -601,7 +601,7 @@ static void gfs2_ordered_wait(struct gfs2_sbd *sdp)
|
|||
|
||||
spin_lock(&sdp->sd_ordered_lock);
|
||||
while (!list_empty(&sdp->sd_log_ordered)) {
|
||||
ip = list_entry(sdp->sd_log_ordered.next, struct gfs2_inode, i_ordered);
|
||||
ip = list_first_entry(&sdp->sd_log_ordered, struct gfs2_inode, i_ordered);
|
||||
list_del(&ip->i_ordered);
|
||||
WARN_ON(!test_and_clear_bit(GIF_ORDERED, &ip->i_flags));
|
||||
if (ip->i_inode.i_mapping->nrpages == 0)
|
||||
|
|
|
@ -734,7 +734,7 @@ static void buf_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
|
|||
|
||||
head = &tr->tr_buf;
|
||||
while (!list_empty(head)) {
|
||||
bd = list_entry(head->next, struct gfs2_bufdata, bd_list);
|
||||
bd = list_first_entry(head, struct gfs2_bufdata, bd_list);
|
||||
list_del_init(&bd->bd_list);
|
||||
gfs2_unpin(sdp, bd->bd_bh, tr);
|
||||
}
|
||||
|
@ -904,7 +904,7 @@ static void revoke_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
|
|||
struct gfs2_glock *gl;
|
||||
|
||||
while (!list_empty(head)) {
|
||||
bd = list_entry(head->next, struct gfs2_bufdata, bd_list);
|
||||
bd = list_first_entry(head, struct gfs2_bufdata, bd_list);
|
||||
list_del_init(&bd->bd_list);
|
||||
gl = bd->bd_gl;
|
||||
gfs2_glock_remove_revoke(gl);
|
||||
|
@ -1083,7 +1083,7 @@ static void databuf_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
|
|||
|
||||
head = &tr->tr_databuf;
|
||||
while (!list_empty(head)) {
|
||||
bd = list_entry(head->next, struct gfs2_bufdata, bd_list);
|
||||
bd = list_first_entry(head, struct gfs2_bufdata, bd_list);
|
||||
list_del_init(&bd->bd_list);
|
||||
gfs2_unpin(sdp, bd->bd_bh, tr);
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ static void gfs2_qd_dispose(struct list_head *list)
|
|||
struct gfs2_sbd *sdp;
|
||||
|
||||
while (!list_empty(list)) {
|
||||
qd = list_entry(list->next, struct gfs2_quota_data, qd_lru);
|
||||
qd = list_first_entry(list, struct gfs2_quota_data, qd_lru);
|
||||
sdp = qd->qd_gl->gl_name.ln_sbd;
|
||||
|
||||
list_del(&qd->qd_lru);
|
||||
|
@ -1441,7 +1441,7 @@ void gfs2_quota_cleanup(struct gfs2_sbd *sdp)
|
|||
|
||||
spin_lock(&qd_lock);
|
||||
while (!list_empty(head)) {
|
||||
qd = list_entry(head->prev, struct gfs2_quota_data, qd_list);
|
||||
qd = list_last_entry(head, struct gfs2_quota_data, qd_list);
|
||||
|
||||
list_del(&qd->qd_list);
|
||||
|
||||
|
@ -1504,7 +1504,7 @@ static void quotad_check_trunc_list(struct gfs2_sbd *sdp)
|
|||
ip = NULL;
|
||||
spin_lock(&sdp->sd_trunc_lock);
|
||||
if (!list_empty(&sdp->sd_trunc_list)) {
|
||||
ip = list_entry(sdp->sd_trunc_list.next,
|
||||
ip = list_first_entry(&sdp->sd_trunc_list,
|
||||
struct gfs2_inode, i_trunc_list);
|
||||
list_del_init(&ip->i_trunc_list);
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ void gfs2_revoke_clean(struct gfs2_jdesc *jd)
|
|||
struct gfs2_revoke_replay *rr;
|
||||
|
||||
while (!list_empty(head)) {
|
||||
rr = list_entry(head->next, struct gfs2_revoke_replay, rr_list);
|
||||
rr = list_first_entry(head, struct gfs2_revoke_replay, rr_list);
|
||||
list_del(&rr->rr_list);
|
||||
kfree(rr);
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ void gfs2_jindex_free(struct gfs2_sbd *sdp)
|
|||
|
||||
sdp->sd_jdesc = NULL;
|
||||
while (!list_empty(&list)) {
|
||||
jd = list_entry(list.next, struct gfs2_jdesc, jd_list);
|
||||
jd = list_first_entry(&list, struct gfs2_jdesc, jd_list);
|
||||
gfs2_free_journal_extents(jd);
|
||||
list_del(&jd->jd_list);
|
||||
iput(jd->jd_inode);
|
||||
|
@ -452,7 +452,7 @@ static int gfs2_lock_fs_check_clean(struct gfs2_sbd *sdp)
|
|||
|
||||
out:
|
||||
while (!list_empty(&list)) {
|
||||
lfcc = list_entry(list.next, struct lfcc, list);
|
||||
lfcc = list_first_entry(&list, struct lfcc, list);
|
||||
list_del(&lfcc->list);
|
||||
gfs2_glock_dq_uninit(&lfcc->gh);
|
||||
kfree(lfcc);
|
||||
|
|
Loading…
Reference in a new issue