)]}'
{
  "commit": "3f6c220360a10ca2c030398714a0edde59750398",
  "tree": "4fa2245554936bbad63007614e4be0f70f86239d",
  "parents": [
    "14d868de5db6936af7a1983daa828bfeb796062c"
  ],
  "author": {
    "name": "David Howells",
    "email": "dhowells@redhat.com",
    "time": "Tue Mar 29 15:25:55 2022 +0100"
  },
  "committer": {
    "name": "David Howells",
    "email": "dhowells@redhat.com",
    "time": "Wed Jun 28 11:40:08 2023 +0100"
  },
  "message": "mm, netfs, fscache: Stop read optimisation when folio removed from pagecache\n\nFscache has an optimisation by which reads from the cache are skipped until\nwe know that (a) there\u0027s data there to be read and (b) that data isn\u0027t\nentirely covered by pages resident in the netfs pagecache.  This is done\nwith two flags manipulated by fscache_note_page_release():\n\n\tif (...\n\t    test_bit(FSCACHE_COOKIE_HAVE_DATA, \u0026cookie-\u003eflags) \u0026\u0026\n\t    test_bit(FSCACHE_COOKIE_NO_DATA_TO_READ, \u0026cookie-\u003eflags))\n\t\tclear_bit(FSCACHE_COOKIE_NO_DATA_TO_READ, \u0026cookie-\u003eflags);\n\nwhere the NO_DATA_TO_READ flag causes cachefiles_prepare_read() to indicate\nthat netfslib should download from the server or clear the page instead.\n\nThe fscache_note_page_release() function is intended to be called from\n-\u003ereleasepage() - but that only gets called if PG_private or PG_private_2\nis set - and currently the former is at the discretion of the network\nfilesystem and the latter is only set whilst a page is being written to the\ncache, so sometimes we miss clearing the optimisation.\n\nFix this by following Willy\u0027s suggestion[1] and adding an address_space\nflag, AS_RELEASE_ALWAYS, that causes filemap_release_folio() to always call\n-\u003erelease_folio() if it\u0027s set, even if PG_private or PG_private_2 aren\u0027t\nset.\n\nNote that this would require folio_test_private() and page_has_private() to\nbecome more complicated.  To avoid that, in the places[*] where these are\nused to conditionalise calls to filemap_release_folio() and\ntry_to_release_page(), the tests are removed the those functions just\njumped to unconditionally and the test is performed there.\n\n[*] There are some exceptions in vmscan.c where the check guards more than\njust a call to the releaser.  I\u0027ve added a function, folio_needs_release()\nto wrap all the checks for that.\n\nAS_RELEASE_ALWAYS should be set if a non-NULL cookie is obtained from\nfscache and cleared in -\u003eevict_inode() before truncate_inode_pages_final()\nis called.\n\nAdditionally, the FSCACHE_COOKIE_NO_DATA_TO_READ flag needs to be cleared\nand the optimisation cancelled if a cachefiles object already contains data\nwhen we open it.\n\nFixes: 1f67e6d0b188 (\"fscache: Provide a function to note the release of a page\")\nFixes: 047487c947e8 (\"cachefiles: Implement the I/O routines\")\nReported-by: Rohith Surabattula \u003crohiths.msft@gmail.com\u003e\nSuggested-by: Matthew Wilcox \u003cwilly@infradead.org\u003e\nSigned-off-by: David Howells \u003cdhowells@redhat.com\u003e\ncc: Matthew Wilcox \u003cwilly@infradead.org\u003e\ncc: Linus Torvalds \u003ctorvalds@linux-foundation.org\u003e\ncc: Steve French \u003csfrench@samba.org\u003e\ncc: Shyam Prasad N \u003cnspmangalore@gmail.com\u003e\ncc: Rohith Surabattula \u003crohiths.msft@gmail.com\u003e\ncc: Dave Wysochanski \u003cdwysocha@redhat.com\u003e\ncc: Dominique Martinet \u003casmadeus@codewreck.org\u003e\ncc: Ilya Dryomov \u003cidryomov@gmail.com\u003e\ncc: linux-cachefs@redhat.com\ncc: linux-cifs@vger.kernel.org\ncc: linux-afs@lists.infradead.org\ncc: v9fs-developer@lists.sourceforge.net\ncc: ceph-devel@vger.kernel.org\ncc: linux-nfs@vger.kernel.org\ncc: linux-fsdevel@vger.kernel.org\ncc: linux-mm@kvack.org\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "cebba4eaa0b575af6305faa19363d18593133ea4",
      "old_mode": 33188,
      "old_path": "fs/9p/cache.c",
      "new_id": "12c0ae29f1857cb9cceaac3473cb47cef645d4b8",
      "new_mode": 33188,
      "new_path": "fs/9p/cache.c"
    },
    {
      "type": "modify",
      "old_id": "9d3d64921106de0d68bcc80b2e04b9074a2b593a",
      "old_mode": 33188,
      "old_path": "fs/afs/internal.h",
      "new_id": "da73b97e19a9af4026c91eecdb20ac0f4fe7b228",
      "new_mode": 33188,
      "new_path": "fs/afs/internal.h"
    },
    {
      "type": "modify",
      "old_id": "d9d22d0ec38ad2343d0772af744304c409cb3aa3",
      "old_mode": 33188,
      "old_path": "fs/cachefiles/namei.c",
      "new_id": "7bf7a5fcc045f86a98881657e6da2acc06be98dc",
      "new_mode": 33188,
      "new_path": "fs/cachefiles/namei.c"
    },
    {
      "type": "modify",
      "old_id": "177d8e8d73fe424a412be19635e1f99b37b2e1b3",
      "old_mode": 33188,
      "old_path": "fs/ceph/cache.c",
      "new_id": "de1dee46d3df72e0a5069a1318a1ad212419ff67",
      "new_mode": 33188,
      "new_path": "fs/ceph/cache.c"
    },
    {
      "type": "modify",
      "old_id": "8c35d88a84b194d700ac0c0610bd67a4ebc9a4da",
      "old_mode": 33188,
      "old_path": "fs/nfs/fscache.c",
      "new_id": "b05717fe0d4e4f5b505f98e52e25273fe216b325",
      "new_mode": 33188,
      "new_path": "fs/nfs/fscache.c"
    },
    {
      "type": "modify",
      "old_id": "8f6909d633da8a913eb6a872af6860fcf3f7754b",
      "old_mode": 33188,
      "old_path": "fs/smb/client/fscache.c",
      "new_id": "3677525ee99311b4005224931ce4a07eef4fa2a1",
      "new_mode": 33188,
      "new_path": "fs/smb/client/fscache.c"
    },
    {
      "type": "modify",
      "old_id": "a56308a9d1a45049c6edcf8fef5a700c1d91abcd",
      "old_mode": 33188,
      "old_path": "include/linux/pagemap.h",
      "new_id": "a1176ceb4a0c37bb4032b1c96a6ada76450cb2fc",
      "new_mode": 33188,
      "new_path": "include/linux/pagemap.h"
    },
    {
      "type": "modify",
      "old_id": "a76314764d8c48ae33a0705738ce4b6224ed2b67",
      "old_mode": 33188,
      "old_path": "mm/internal.h",
      "new_id": "86aef26df905e1a0785cc82a08348ce969cfd94f",
      "new_mode": 33188,
      "new_path": "mm/internal.h"
    }
  ]
}
