2006-03-30 08:17:43

by Akinobu Mita

[permalink] [raw]
Subject: [patch 3/8] use list_add_tail() instead of list_add()

This patch converts list_add(A, B.prev) to list_add_tail(A, &B)
for readability.

CC: Karsten Keil <[email protected]>
CC: Jan Harkes <[email protected]>
CC: Jan Kara <[email protected]>
CC: David Woodhouse <[email protected]>
CC: Sridhar Samudrala <[email protected]>
Signed-off-by: Akinobu Mita <[email protected]>

drivers/isdn/capi/capi.c | 2 +-
fs/coda/psdev.c | 2 +-
fs/coda/upcall.c | 2 +-
fs/dcache.c | 2 +-
fs/dquot.c | 4 ++--
fs/jffs2/compr.c | 4 ++--
net/sctp/outqueue.c | 2 +-
7 files changed, 9 insertions(+), 9 deletions(-)

Index: 2.6-git/drivers/isdn/capi/capi.c
===================================================================
--- 2.6-git.orig/drivers/isdn/capi/capi.c
+++ 2.6-git/drivers/isdn/capi/capi.c
@@ -238,7 +238,7 @@ static struct capiminor *capiminor_alloc

if (minor < capi_ttyminors) {
mp->minor = minor;
- list_add(&mp->list, p->list.prev);
+ list_add_tail(&mp->list, &p->list);
}
}
write_unlock_irqrestore(&capiminor_list_lock, flags);
Index: 2.6-git/fs/coda/psdev.c
===================================================================
--- 2.6-git.orig/fs/coda/psdev.c
+++ 2.6-git/fs/coda/psdev.c
@@ -259,7 +259,7 @@ static ssize_t coda_psdev_read(struct fi
/* If request was not a signal, enqueue and don't free */
if (!(req->uc_flags & REQ_ASYNC)) {
req->uc_flags |= REQ_READ;
- list_add(&(req->uc_chain), vcp->vc_processing.prev);
+ list_add_tail(&(req->uc_chain), &vcp->vc_processing);
goto out;
}

Index: 2.6-git/fs/coda/upcall.c
===================================================================
--- 2.6-git.orig/fs/coda/upcall.c
+++ 2.6-git/fs/coda/upcall.c
@@ -725,7 +725,7 @@ static int coda_upcall(struct coda_sb_in
((union inputArgs *)buffer)->ih.unique = req->uc_unique;

/* Append msg to pending queue and poke Venus. */
- list_add(&(req->uc_chain), vcommp->vc_pending.prev);
+ list_add_tail(&(req->uc_chain), &vcommp->vc_pending);

wake_up_interruptible(&vcommp->vc_waitq);
/* We can be interrupted while we wait for Venus to process
Index: 2.6-git/fs/dcache.c
===================================================================
--- 2.6-git.orig/fs/dcache.c
+++ 2.6-git/fs/dcache.c
@@ -584,7 +584,7 @@ resume:
* of the unused list for prune_dcache
*/
if (!atomic_read(&dentry->d_count)) {
- list_add(&dentry->d_lru, dentry_unused.prev);
+ list_add_tail(&dentry->d_lru, &dentry_unused);
dentry_stat.nr_unused++;
found++;
}
Index: 2.6-git/fs/dquot.c
===================================================================
--- 2.6-git.orig/fs/dquot.c
+++ 2.6-git/fs/dquot.c
@@ -250,7 +250,7 @@ static inline struct dquot *find_dquot(u
/* Add a dquot to the tail of the free list */
static inline void put_dquot_last(struct dquot *dquot)
{
- list_add(&dquot->dq_free, free_dquots.prev);
+ list_add_tail(&dquot->dq_free, &free_dquots);
dqstats.free_dquots++;
}

@@ -266,7 +266,7 @@ static inline void put_inuse(struct dquo
{
/* We add to the back of inuse list so we don't have to restart
* when traversing this list and we block */
- list_add(&dquot->dq_inuse, inuse_list.prev);
+ list_add_tail(&dquot->dq_inuse, &inuse_list);
dqstats.allocated_dquots++;
}

Index: 2.6-git/fs/jffs2/compr.c
===================================================================
--- 2.6-git.orig/fs/jffs2/compr.c
+++ 2.6-git/fs/jffs2/compr.c
@@ -231,7 +231,7 @@ int jffs2_register_compressor(struct jff

list_for_each_entry(this, &jffs2_compressor_list, list) {
if (this->priority < comp->priority) {
- list_add(&comp->list, this->list.prev);
+ list_add_tail(&comp->list, &this->list);
goto out;
}
}
@@ -394,7 +394,7 @@ reinsert:
list_del(&comp->list);
list_for_each_entry(this, &jffs2_compressor_list, list) {
if (this->priority < comp->priority) {
- list_add(&comp->list, this->list.prev);
+ list_add_tail(&comp->list, &this->list);
spin_unlock(&jffs2_compressor_list_lock);
return 0;
}
Index: 2.6-git/net/sctp/outqueue.c
===================================================================
--- 2.6-git.orig/net/sctp/outqueue.c
+++ 2.6-git/net/sctp/outqueue.c
@@ -370,7 +370,7 @@ static void sctp_insert_list(struct list
lchunk = list_entry(pos, struct sctp_chunk, transmitted_list);
ltsn = ntohl(lchunk->subh.data_hdr->tsn);
if (TSN_lt(ntsn, ltsn)) {
- list_add(new, pos->prev);
+ list_add_tail(new, pos);
done = 1;
break;
}

--


2006-03-30 08:26:25

by Karsten Keil

[permalink] [raw]
Subject: Re: [patch 3/8] use list_add_tail() instead of list_add()

On Thu, Mar 30, 2006 at 04:16:08PM +0800, Akinobu Mita wrote:

This patch converts list_add(A, B.prev) to list_add_tail(A, &B)
for readability.

Acked-by: Karsten Keil <[email protected]>
for the ISDN/CAPI part.


CC: Jan Harkes <[email protected]>
CC: Jan Kara <[email protected]>
CC: David Woodhouse <[email protected]>
CC: Sridhar Samudrala <[email protected]>
Signed-off-by: Akinobu Mita <[email protected]>

drivers/isdn/capi/capi.c | 2 +-
fs/coda/psdev.c | 2 +-
fs/coda/upcall.c | 2 +-
fs/dcache.c | 2 +-
fs/dquot.c | 4 ++--
fs/jffs2/compr.c | 4 ++--
net/sctp/outqueue.c | 2 +-
7 files changed, 9 insertions(+), 9 deletions(-)

Index: 2.6-git/drivers/isdn/capi/capi.c
===================================================================
--- 2.6-git.orig/drivers/isdn/capi/capi.c
+++ 2.6-git/drivers/isdn/capi/capi.c
@@ -238,7 +238,7 @@ static struct capiminor *capiminor_alloc

if (minor < capi_ttyminors) {
mp->minor = minor;
- list_add(&mp->list, p->list.prev);
+ list_add_tail(&mp->list, &p->list);
}
}
write_unlock_irqrestore(&capiminor_list_lock, flags);



--
Karsten Keil
SuSE Labs
ISDN development

2006-03-30 08:30:42

by Jan Kara

[permalink] [raw]
Subject: Re: [patch 3/8] use list_add_tail() instead of list_add()

> This patch converts list_add(A, B.prev) to list_add_tail(A, &B)
> for readability.
>
> CC: Karsten Keil <[email protected]>
> CC: Jan Harkes <[email protected]>
> CC: Jan Kara <[email protected]>
> CC: David Woodhouse <[email protected]>
> CC: Sridhar Samudrala <[email protected]>
> Signed-off-by: Akinobu Mita <[email protected]>
Acked-by: Jan Kara <[email protected]>

Honza
--
Jan Kara <[email protected]>
SuSE CR Labs

2006-03-30 10:25:33

by David Woodhouse

[permalink] [raw]
Subject: Re: [patch 3/8] use list_add_tail() instead of list_add()

On Thu, 2006-03-30 at 10:30 +0200, Jan Kara wrote:
> > CC: Karsten Keil <[email protected]>
> > CC: Jan Harkes <[email protected]>
> > CC: Jan Kara <[email protected]>
> > CC: David Woodhouse <[email protected]>
> > CC: Sridhar Samudrala <[email protected]>
> > Signed-off-by: Akinobu Mita <[email protected]>
> Acked-by: Jan Kara <[email protected]>

<AOL/>

--
dwmw2

2006-03-31 03:54:38

by Akinobu Mita

[permalink] [raw]
Subject: Re: [patch 3/8] use list_add_tail() instead of list_add()

On Thu, Mar 30, 2006 at 04:16:08PM +0800, Akinobu Mita wrote:
> This patch converts list_add(A, B.prev) to list_add_tail(A, &B)
> for readability.

> drivers/isdn/capi/capi.c | 2 +-
> fs/coda/psdev.c | 2 +-
> fs/coda/upcall.c | 2 +-
> fs/dcache.c | 2 +-
> fs/dquot.c | 4 ++--
> fs/jffs2/compr.c | 4 ++--
> net/sctp/outqueue.c | 2 +-
> 7 files changed, 9 insertions(+), 9 deletions(-)

I realized that the replacements in isdn, jffs2, and sctp made them less
readable. Because these are trying to insert the list node into right
place, not trying to insert the tail of the list head.

This patch reverts them.

Index: 2.6-git/net/sctp/outqueue.c
===================================================================
--- 2.6-git.orig/net/sctp/outqueue.c
+++ 2.6-git/net/sctp/outqueue.c
@@ -370,7 +370,7 @@ static void sctp_insert_list(struct list
lchunk = list_entry(pos, struct sctp_chunk, transmitted_list);
ltsn = ntohl(lchunk->subh.data_hdr->tsn);
if (TSN_lt(ntsn, ltsn)) {
- list_add_tail(new, pos);
+ list_add(new, pos->prev);
done = 1;
break;
}
Index: 2.6-git/drivers/isdn/capi/capi.c
===================================================================
--- 2.6-git.orig/drivers/isdn/capi/capi.c
+++ 2.6-git/drivers/isdn/capi/capi.c
@@ -238,7 +238,7 @@ static struct capiminor *capiminor_alloc

if (minor < capi_ttyminors) {
mp->minor = minor;
- list_add_tail(&mp->list, &p->list);
+ list_add(&mp->list, p->list.prev);
}
}
write_unlock_irqrestore(&capiminor_list_lock, flags);
Index: 2.6-git/fs/jffs2/compr.c
===================================================================
--- 2.6-git.orig/fs/jffs2/compr.c
+++ 2.6-git/fs/jffs2/compr.c
@@ -231,7 +231,7 @@ int jffs2_register_compressor(struct jff

list_for_each_entry(this, &jffs2_compressor_list, list) {
if (this->priority < comp->priority) {
- list_add_tail(&comp->list, &this->list);
+ list_add(&comp->list, this->list.prev);
goto out;
}
}
@@ -394,7 +394,7 @@ reinsert:
list_del(&comp->list);
list_for_each_entry(this, &jffs2_compressor_list, list) {
if (this->priority < comp->priority) {
- list_add_tail(&comp->list, &this->list);
+ list_add(&comp->list, this->list.prev);
spin_unlock(&jffs2_compressor_list_lock);
return 0;
}