I see that when disk class driver receives IRP_MJ_FLUSH:
- First, it sends a SCSIOP_SYNCHRONIZE_CACHE [to flush the disk cache
contents to non-volatile media]
- And then it sends a SRB_FUNCTION_FLUSH [to flush the HBA contents to disk]
Shouldn’t the order of these commands be reversed: First all the volatile data from the
HBA should go to disk [SRB_FUNCTION_FLUSH] and since this data [just flushed from HBA] can
potentially be cached in disk cache, it should be flushed to
non-volatile media [SCSIOP_SYNCHRONIZE_CACHE] ?
Thank you.
Can anybody from Microsoft/OSR or any other storage experts please answer this ? I’m really curious to understand the reasoning behind this.
Thank you.
First let me state that I treat these identically in practice. I haven’t encountered a situation where I need to differentiate between the two.
To your question, Mr. Bisht. I look at it this way: Consider a configuration where you have a cache subsystem that’s disconnected from the rotating media subsystem. In THAT case, you’d want to commit the contents of the CACHE to the disk subsystem, and then ensure the contents of the disk subsystem (HBA + internal device cache logic) is flushed to disk. THEN you’re 100% certain you’ve committed the data.
By this way, this is MY interpretation… but I think it makes sense. But in the interest of full disclosure I haven’t asked any of our colleagues at Microsoft if this is what they intended with these specific functions.
You might try being a bit more patient, Mr. Bisht. Many people are still on holiday. I know *I* am…
Peter
OSR
Peter,
Thank you for responding. Yes I should be bit more patient.
The situation where these are different is when HBA has a volatile cache while the disk doesn’t. So a driver below disk.sys will see FLUSH but not SYNCHRONIZE_CACHE.
In your example:
> In THAT case, you’d want to commit the contents of the CACHE to the
> disk subsystem,
which will happen using FLUSH.
> and then ensure the contents of the disk subsystem (HBA +
> internal device cache logic) is flushed to disk.
which will happen using SYNCHRONIZE.
so the order should be FLUSH and then SYNCHRONIZE. correct ? But class driver does the opposite - SYNCHRONIZE and then FLUSH.