Messages in this thread |  | | From | NeilBrown <> | Date | Tue, 03 Apr 2018 13:41:26 +1000 | Subject | Re: [PATCH v2 0/2] gfs2: Stop using rhashtable_walk_peek |
| |
On Fri, Mar 30 2018, Herbert Xu wrote:
> On Thu, Mar 29, 2018 at 06:52:34PM +0200, Andreas Gruenbacher wrote: >> >> Should rhashtable_walk_peek be kept around even if there are no more >> users? I have my doubts. > > Absolutely. All netlink dumps using rhashtable_walk_next are buggy > and need to switch over to rhashtable_walk_peek. As otherwise > the object that triggers the out-of-space condition will be skipped > upon resumption.
Do we really need a rhashtable_walk_peek() interface? I imagine that a seqfile ->start function can do:
if (*ppos == 0 && last_pos != 0) { rhashtable_walk_exit(&iter); rhashtable_walk_enter(&table, &iter); last_pos = 0; } rhashtable_walk_start(&iter); if (*ppos == last_pos && iter.p) return iter.p; last_pos = *ppos; return rhashtable_walk_next(&iter)
and the ->next function just does
last_pos = *ppos; *ppos += 1; do p = rhashtable_walk_next(&iter); while (IS_ERR(p)); return p;
It might be OK to have a function call instead of expecting people to use iter.p directly.
static inline void *rhashtable_walk_prev(struct rhashtable_iter *iter) { return iter->p; }
Thoughts?
Thanks, NeilBrown [unhandled content-type:application/pgp-signature] |  |