This looks correct, but why don't we simply have a special cased function looking or any delalloc page for xfs_aops_discard_page instead of having one that is fairly over-general? Reviewed-by: Christoph Hellwig <hch at lst.de> if you want to go down this route anyway.