> > Yup, it's already not too bad. I haven't looked into it in much > > detail, but I'd like to reduce it even a bit more. In particular, the > > backup_info field in the BlockDriverState feels wrong to me. In the > > long term the generic block layer shouldn't know at all what a backup > > is, and baking it into BDS couples it very tightly. > > My plan was to have something like bs->job->job_type->{before,after}_write. > > int coroutine_fn (*before_write)(BlockDriverState *bs, > int64_t sector_num, int nb_sectors, QEMUIOVector *qiov, > void **cookie); > int coroutine_fn (*after_write)(BlockDriverState *bs, > int64_t sector_num, int nb_sectors, QEMUIOVector *qiov, > void *cookie); > > > The before_write could optionally return a "cookie" that is passed back to > the after_write callback.
I don't really understand why a filter is related to the job? This is sometimes useful, but not a generic filter infrastructure (maybe someone want to use filters without a job).