Re: How to understand statements on FIFO j->pin in bch_journal_next

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 28, 2018 at 04:22:56PM +0800, Wang Sheng-Hui wrote:
> Hi,
> 
> Sorry to trouble you.
> 
> I noticed some statements in the function:
> ---------------------------------------------------------
> void bch_journal_next(struct journal *j)
> {
>     atomic_t p = { 1 };
>     ...
>     BUG_ON(!fifo_push(&j->pin, p));
>     atomic_set(&fifo_back(&j->pin), 1);
> 
>     ...
> 
> fifo_push would add atomic_t {1} to the back of the FIFO, while next
> atomic_set would set the back element of FIFO to 1, which is atomic_t {1}.
> 
> I wonder why there is additional atomic_set statement ?

Because the first fifo_push() isn't an atomic.
--
To unsubscribe from this list: send the line "unsubscribe linux-bcache" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux ARM Kernel]     [Linux Filesystem Development]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux