)]}'
{
  "commit": "7eb8d07ad0f2233dc7566bccb4bd20065f9eafbd",
  "tree": "2d64d0f58263f08f6e3b8c18e7638d3381b15133",
  "parents": [
    "d65f53fbdd2fa9da61650a06423b893900001b84"
  ],
  "author": {
    "name": "Dave Chinner",
    "email": "dchinner@redhat.com",
    "time": "Thu Sep 21 10:49:54 2023 +1000"
  },
  "committer": {
    "name": "Dave Chinner",
    "email": "david@fromorbit.com",
    "time": "Thu Sep 21 10:49:54 2023 +1000"
  },
  "message": "xfs: grant heads track byte counts, not LSNs\n\nThe grant heads in the log track the space reserved in the log for\nrunning transactions. They do this by tracking how far ahead of the\ntail that the reservation has reached, and the units for doing this\nare {cycle,bytes} for the reserve head rather than {cycle,blocks}\nwhich are normal used by LSNs.\n\nThis is annoyingly complex because we have to split, crack and\ncombined these tuples for any calculation we do to determine log\nspace and targets. This is computationally expensive as well as\ndifficult to do atomically and locklessly, as well as limiting the\nsize of the log to 2^32 bytes.\n\nReally, though, all the grant heads are tracking is how much space\nis currently available for use in the log. We can track this as a\nsimply byte count - we just don\u0027t care what the actual physical\nlocation in the log the head and tail are at, just how much space we\nhave remaining before the head and tail overlap.\n\nSo, convert the grant heads to track the byte reservations that are\nactive rather than the current (cycle, offset) tuples. This means an\nempty log has zero bytes consumed, and a full log is when the the\nreservations reach the size of the log minus the space consumed by\nthe AIL.\n\nThis greatly simplifies the accounting and checks for whether there\nis space available. We no longer need to crack or combine LSNs to\ndetermine how much space the log has left, nor do we need to look at\nthe head or tail of the log to determine how close to full we are.\n\nThere is, however, a complexity that needs to be handled. We know\nhow much space is being tracked in the AIL now via log-\u003el_tail_space\nand the log tickets track active reservations and return the unused\nportions to the grant heads when ungranted.  Unfortunately, we don\u0027t\ntrack the used portion of the grant, so when we transfer log items\nfrom the CIL to the AIL, the space accounted to the grant heads is\ntransferred to the log tail space.  Hence when we move the AIL head\nforwards on item insert, we have to remove that space from the grant\nheads.\n\nWe also remove the xlog_verify_grant_tail() debug function as it is\nno longer useful. The check it performs has been racy since delayed\nlogging was introduced, but now it is clearly only detecting false\npositives so remove it.\n\nThe result of this substantially simpler accounting algorithm is an\nincrease in sustained transaction rate from ~1.3 million\ntransactions/s to ~1.9 million transactions/s with no increase in\nCPU usage. We also remove the 32 bit space limitation on the grant\nheads, which will allow us to increase the journal size beyond 2GB\nin future.\n\nSigned-off-by: Dave Chinner \u003cdchinner@redhat.com\u003e\nReviewed-by: Darrick J. Wong \u003cdjwong@kernel.org\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "ed1e1f1dc8e4cab20e28a2a7e601b0fdd94778df",
      "old_mode": 33188,
      "old_path": "fs/xfs/xfs_log.c",
      "new_id": "09a2ae5e62f3c88103890a5bf24561ca34c2801b",
      "new_mode": 33188,
      "new_path": "fs/xfs/xfs_log.c"
    },
    {
      "type": "modify",
      "old_id": "6c05097ebfdfb91ce3c4c48eb7e3fc41cacc30d5",
      "old_mode": 33188,
      "old_path": "fs/xfs/xfs_log_cil.c",
      "new_id": "3aec5589d71750a2636c471b405922e8d3c42cb6",
      "new_mode": 33188,
      "new_path": "fs/xfs/xfs_log_cil.c"
    },
    {
      "type": "modify",
      "old_id": "24dc788c02d31d7a3eb99570e42ea7ea198ec3cb",
      "old_mode": 33188,
      "old_path": "fs/xfs/xfs_log_priv.h",
      "new_id": "9e276514cfb5192227653dcb72e4cb9e21631073",
      "new_mode": 33188,
      "new_path": "fs/xfs/xfs_log_priv.h"
    },
    {
      "type": "modify",
      "old_id": "8d963c3db4f337170b832b4c7a5ef09aa79a87cd",
      "old_mode": 33188,
      "old_path": "fs/xfs/xfs_log_recover.c",
      "new_id": "69466ad30cfa7abcfff97a9834a3dc5e1403e253",
      "new_mode": 33188,
      "new_path": "fs/xfs/xfs_log_recover.c"
    },
    {
      "type": "modify",
      "old_id": "a3c6b15487237d2fa813107cdbfd71fe51ab919c",
      "old_mode": 33188,
      "old_path": "fs/xfs/xfs_sysfs.c",
      "new_id": "741704fea2b021a4f382eb8bd511a8ade66a4e03",
      "new_mode": 33188,
      "new_path": "fs/xfs/xfs_sysfs.c"
    },
    {
      "type": "modify",
      "old_id": "784c6d63daa90a3c98fabb710fcfaa4ed41a62cc",
      "old_mode": 33188,
      "old_path": "fs/xfs/xfs_trace.h",
      "new_id": "fb12d638b6dc0eb5ca29dac5699fda6cae3947f2",
      "new_mode": 33188,
      "new_path": "fs/xfs/xfs_trace.h"
    }
  ]
}
