Re: [PATCH 3/7] zsmalloc: switch handle type to struct zs_handle

From: Sergey Senozhatsky

Date: Mon Nov 09 2026 - 21:43:19 EST


On (26/11/05 17:03), Yosry Ahmed wrote:
[..]
> > -void zs_obj_read_sg_begin(struct zs_pool *pool, unsigned long handle,
> > +void zs_obj_read_sg_begin(struct zs_pool *pool, struct zs_handle *handle,
> > struct scatterlist *sg, size_t mem_len);
> > -void zs_obj_read_sg_end(struct zs_pool *pool, unsigned long handle);
> > -void zs_obj_write(struct zs_pool *pool, unsigned long handle,
> > +void zs_obj_read_sg_end(struct zs_pool *pool, struct zs_handle *handle);
> > +void zs_obj_write(struct zs_pool *pool, struct zs_handle *handle,
> > void *handle_mem, size_t mem_len);
>
> I would squash patch 7's constification here.

Ack.

[..]
> > static inline bool obj_allocated(struct zpdesc *zpdesc, void *obj,
> > - unsigned long *phandle)
> > + struct zs_handle **phandle)
> > {
> > unsigned long handle;
> > struct zspage *zspage = get_zspage(zpdesc);
> > @@ -839,7 +843,7 @@ static inline bool obj_allocated(struct zpdesc *zpdesc, void *obj,
> > return false;
> >
> > /* Clear all tags before returning the handle */
> > - *phandle = handle & ~OBJ_TAG_MASK;
> > + *phandle = (struct zs_handle *)(handle & ~OBJ_TAG_MASK);
> > return true;
> > }
>
> Would it be cleaerer if obj_allocated() just returned the handle here? I
> believe this can be done separately in a prep patch.

Ack.