+ if ((p->flags& SWP_BLKDEV)&&
+ disk->fops->swap_slot_free_notify)
+ disk->fops->swap_slot_free_notify(p->bdev, offset);
Is this p->flags& SWP_BLKDEV logic reversed? (Don't you want the
notifier called for devices that aren't backed by a block device?)
No, the logic here is correct: ramzswap is a block device for which
we want this callback. Though its a RAM backed, it is still a block
device.
(I hope it answers your question in the other mail also).
I also wonder whether leaving the p->flags& SWP_BLKDEV part out might
be a good idea. Other potential notifier users?
For regular files, 'offset' used here makes little sense. For block devices,
its simply offset in real device. Also, I doubt if *files* would ever
like to have such a callback.