)]}'
{
  "commit": "10f525a8cd7a525e9fc73288bb35428c9cad5e63",
  "tree": "b6f8d6ad9b2c042ec55c437ee23f0088b61d8efe",
  "parents": [
    "92acdc4f37207c556baee0ea28ce0823d22b9812"
  ],
  "author": {
    "name": "Al Viro",
    "email": "viro@zeniv.linux.org.uk",
    "time": "Wed Jun 15 02:02:51 2022 -0400"
  },
  "committer": {
    "name": "Al Viro",
    "email": "viro@zeniv.linux.org.uk",
    "time": "Mon Aug 08 22:37:18 2022 -0400"
  },
  "message": "ITER_PIPE: cache the type of last buffer\n\nWe often need to find whether the last buffer is anon or not, and\ncurrently it\u0027s rather clumsy:\n\tcheck if -\u003eiov_offset is non-zero (i.e. that pipe is not empty)\n\tif so, get the corresponding pipe_buffer and check its -\u003eops\n\tif it\u0027s \u0026default_pipe_buf_ops, we have an anon buffer.\n\nLet\u0027s replace the use of -\u003eiov_offset (which is nowhere near similar to\nits role for other flavours) with signed field (-\u003elast_offset), with\nthe following rules:\n\tempty, no buffers occupied:\t\t0\n\tanon, with bytes up to N-1 filled:\tN\n\tzero-copy, with bytes up to N-1 filled:\t-N\n\nThat way abs(i-\u003elast_offset) is equal to what used to be in i-\u003eiov_offset\nand empty vs. anon vs. zero-copy can be distinguished by the sign of\ni-\u003elast_offset.\n\n\tChecks for \"should we extend the last buffer or should we start\na new one?\" become easier to follow that way.\n\n\tNote that most of the operations can only be done in a sane\nstate - i.e. when the pipe has nothing past the current position of\niterator.  About the only thing that could be done outside of that\nstate is iov_iter_advance(), which transitions to the sane state by\ntruncating the pipe.  There are only two cases where we leave the\nsane state:\n\t1) iov_iter_get_pages()/iov_iter_get_pages_alloc().  Will be\ndealt with later, when we make get_pages advancing - the callers are\nactually happier that way.\n\t2) iov_iter copied, then something is put into the copy.  Since\nthey share the underlying pipe, the original gets behind.  When we\ndecide that we are done with the copy (original is not usable until then)\nwe advance the original.  direct_io used to be done that way; nowadays\nit operates on the original and we do iov_iter_revert() to discard\nthe excessive data.  At the moment there\u0027s nothing in the kernel that\ncould do that to ITER_PIPE iterators, so this reason for insane state\nis theoretical right now.\n\nSigned-off-by: Al Viro \u003cviro@zeniv.linux.org.uk\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "85bef84fd294025b4a53673915ee3d2e0b226af7",
      "old_mode": 33188,
      "old_path": "include/linux/uio.h",
      "new_id": "e7fc29b5ad1974c41911da4a92105ec4b840c764",
      "new_mode": 33188,
      "new_path": "include/linux/uio.h"
    },
    {
      "type": "modify",
      "old_id": "c2e08004a1eb47461b72be19bb1bc9406e77ef89",
      "old_mode": 33188,
      "old_path": "lib/iov_iter.c",
      "new_id": "8834f3f612206a63a4296262b6b23596308fdd82",
      "new_mode": 33188,
      "new_path": "lib/iov_iter.c"
    }
  ]
}
