dajhorn/pkg-spl — comment on commit d14c800dd9f6bb1283b77f284012b53beb693ce4
File:  line 0
By behlendorf:

I just saw you were working on this and might like a little feedback.

While what your proposing will work I think in the long term it's wiser to just add an autoconf check for the sem->wait\_lock type. Then for raw\_spin\_lock's use the raw\_spin\_{un}lock\_irqr{save|restore} functions and if its a normal spinlock use the usual spinlock functions. This ensures that if functionality differences do emerge they won't cause problems. Since the spin lock implementation can be optimized pre-architecture I don't think we can to count on there never being any functional differences.

You can use the SPL\_AC\_MUTEX\_OWNER\_TASK\_STRUCT autoconf check as an example of how to check a kernel type in autoconf. From there I would add two new conditionally defined static inline functions in include/linux/rwsem\_compat called called spl\_rwsem\_wait\_lock\_irqsave() and spl\_rwsem\_wait\_unlock\_irqrestore() which do the right thing. Note the spl\_rwsem\_ prefix is useful here this this compat header will be included lots of places and we want to make sure a collision is very unlikely.