Re: 2.6.9-rc1-mm4 sparc reiser4 build broken - undefined atomic_sub_and_test

From: Hugh Dickins
Date: Mon Sep 13 2004 - 07:45:16 EST


On Sun, 12 Sep 2004, Alex Zarochentsev wrote:
> On Sun, Sep 12, 2004 at 11:49:48AM -0700, Paul Jackson wrote:
> >
> > I also saw an email from Bill Irwin go by, explaining that he did not
> > choose to add atomic_sub_and_test to include/asm-sparc/atomic.h, which
> > email is consistent with my observation that sparc atomic.h does not
> > define atomic_sub_and_test.
>
> I think adding the wrappers for atomic_sub_and_test() wouldn't be wrong:

But Bill already said he doesn't want it, and there are several other
architectures than sparc which don't have it - it's unclear why any do.

Several people were working to get atomic_add_return and its friends into
the remaining architectures (such as i386), Andrew's taken those patches
into -mm5, so it would make sense for reiser4 to use atomic_sub_return now.

Oh, except that particular variant is missing from s390: better add it in.

Signed-off-by: Hugh Dickins <hugh@xxxxxxxxxxx>

--- 2.6.9-rc1-mm5/fs/reiser4/flush_queue.c 2004-09-13 12:22:11.472865432 +0100
+++ linux/fs/reiser4/flush_queue.c 2004-09-13 13:15:50.505877800 +0100
@@ -447,7 +447,7 @@ end_io_handler(struct bio *bio, unsigned

/* If all write requests registered in this "fq" are done we up
* the semaphore. */
- if (atomic_sub_and_test(bio->bi_vcnt, &fq->nr_submitted))
+ if (atomic_sub_return(bio->bi_vcnt, &fq->nr_submitted) == 0)
up(&fq->io_sem);
}

--- 2.6.9-rc1-mm5/include/asm-s390/atomic.h 2004-06-16 06:20:36.000000000 +0100
+++ linux/include/asm-s390/atomic.h 2004-09-13 13:18:33.456105600 +0100
@@ -61,6 +61,10 @@ static __inline__ void atomic_sub(int i,
{
__CS_LOOP(v, i, "sr");
}
+static __inline__ int atomic_sub_return(int i, atomic_t * v)
+{
+ return __CS_LOOP(v, i, "sr");
+}
static __inline__ void atomic_inc(volatile atomic_t * v)
{
__CS_LOOP(v, 1, "ar");

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/