I wrote: > You can do a little trick here and combine this flag with the counter t: > Simply say t = 1 for "this device is open and has no outstanding > transactions yet". Then increment and decrement for requests and > responses. Also do t-- once on close(). Then t == 0 means "closed and > all transactions completed". And any t != 0 means of course "there are > t - 1 transactions pending". You could also shift it all by one and say > "t == -1 means device closed and 0 transactions pending" but the former > way allows you to use the kref API. (However, if you ever need to know > whether the device is open or closed, independently whether there are > transactions pending or not, then you can't fold this "open?" flag into > the transaction counter t.) Also, of course you can't use the kref API for this counter t if you want to read the number of pending transactions somewhere. Use an atomic_t then, or an int whose accessors are serialized by a lock. -- Stefan Richter -=====-==--= ---= -==== http://arcgraph.de/sr/ -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html