Can we take a step back and figure out if page_endio is a good idea to start with? The zram usage seems clearly wrong to me. zram is a block driver and does not own the pages, so it shouldn't touch any of the page state. It seems like this mostly operates on it's own pages allocated using alloc_page so the harm might not be horrible at least. orangefs uses it on readahead pages, with ret known for the whole iteration. So one quick loop for the success and one for the failure case would look simpler an more obvious. mpage really should use separate end_io handler for read vs write as well like most other aops do. So overall I'd be happier to just kill the helper.