X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=include%2Flinux%2Fdcache_compat.h;fp=include%2Flinux%2Fdcache_compat.h;h=2b9e5c1c405095cd7b11e4ae8a0a953d58557846;hb=bf01b5e6161b4aa94c69792e50de4102a033be09;hp=271a0cbef76adfd8bdb72f07363aa0549f7bb3c8;hpb=1305d33a4b0f8b10cea61989330cc5d059cfa7cb;p=zfs.git diff --git a/include/linux/dcache_compat.h b/include/linux/dcache_compat.h index 271a0cb..2b9e5c1 100644 --- a/include/linux/dcache_compat.h +++ b/include/linux/dcache_compat.h @@ -60,4 +60,24 @@ d_set_d_op(struct dentry *dentry, dentry_operations_t *op) } #endif /* HAVE_D_SET_D_OP */ +/* + * 2.6.38 API addition, + * Added d_clear_d_op() helper function which clears some flags and the + * registered dentry->d_op table. This is required because d_set_d_op() + * issues a warning when the dentry operations table is already set. + * For the .zfs control directory to work properly we must be able to + * override the default operations table and register custom .d_automount + * and .d_revalidate callbacks. + */ +static inline void +d_clear_d_op(struct dentry *dentry) +{ +#ifdef HAVE_D_SET_D_OP + dentry->d_op = NULL; + dentry->d_flags &= + ~(DCACHE_OP_HASH | DCACHE_OP_COMPARE | + DCACHE_OP_REVALIDATE | DCACHE_OP_DELETE); +#endif /* HAVE_D_SET_D_OP */ +} + #endif /* _ZFS_DCACHE_H */