Re: [PATCH v2 1/3] zram: Replace bit spinlocks with a spinlock_t.

From: Sebastian Andrzej Siewior
Date: Thu Jul 04 2024 - 08:19:22 EST


On 2024-07-04 13:38:04 [+0200], Alexander Lobakin wrote:
> > index 3acd7006ad2cc..036845cd4f25e 100644
> > --- a/drivers/block/zram/zram_drv.c
> > +++ b/drivers/block/zram/zram_drv.c
> > @@ -57,19 +57,34 @@ static void zram_free_page(struct zram *zram, size_t index);
> > static int zram_read_page(struct zram *zram, struct page *page, u32 index,
> > struct bio *parent);
> >
> > +static void zram_meta_init_table_locks(struct zram *zram, size_t num_pages)
> > +{
> > + size_t index;
> > +
> > + for (index = 0; index < num_pages; index++)
>
> Maybe declare @index right here?

But why? Declarations at the top followed by code.

>
> > + spin_lock_init(&zram->table[index].lock);
> > +}
>
> [...]
>
> Thanks,
> Olek

Sebastian