On Fri, Oct 04, 2019 at 12:06:02AM +0200, Jan Kara wrote: > Currently, journal descriptor blocks were not accounted in > transaction->t_outstanding_credits and we were just leaving some slack > space in the journal for them (in jbd2_log_space_left() and > jbd2_space_needed()). This is making proper accounting (and reservation > we want to add) of descriptor blocks difficult so switch to accounting > descriptor blocks in transaction->t_outstanding_credits and just reserve > the same amount of credits in t_outstanding credits for journal > descriptor blocks when creating transaction. This changes the meaning of t_oustanding credits; in particular the documentation of t_outstanding_credits in include/linux/jbd2.h is no longer correct, as it currently defines it has containing: Number of buffers reserved for use by all handles in this transaction handle but not yet modified. [none] Previously, t_outstanding_credits would go to zero once all of the handles attached to the transaction were closed. Now, it is initialized to j_max_transaction_buffers >> 32, and once all of the handles are closed t_outstanding_credits will go back to that value. It then gets decremented as we write each jbd descriptor block (whether it is for a revoke block or a data block) during the commit and we throw a warning if we ever write more than j_max_transaction_buffers >> 32 descriptor blocks. Is that a fair summary of what happens after this commit? The thing is, I don't see how this helps the rest of the patch series; we account for space needed for the revoke blocks in later patches, but I don't see that adjusting t_outstanding credits. We reserve extra space for the revoke blocks, and we then account for that space, but the fact that we have accounted for all of the extra descriptor blocks in t_outstanding_credits doesn't seem to be changed. As a result, we appear to be double-counting the space needed for the revoke descriptor blocks. Which is fine; I don't mind the accounting being a bit more conservative, but I find myself being a bit puzzled about why this change is necessary or adds value. What am I missing? - Ted