get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/1.2/patches/829946/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 829946,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/829946/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20171024152415.22864-14-jack@suse.cz/",
    "project": {
        "id": 8,
        "url": "http://patchwork.ozlabs.org/api/1.2/projects/8/?format=api",
        "name": "Linux ext4 filesystem development",
        "link_name": "linux-ext4",
        "list_id": "linux-ext4.vger.kernel.org",
        "list_email": "linux-ext4@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20171024152415.22864-14-jack@suse.cz>",
    "list_archive_url": null,
    "date": "2017-10-24T15:24:10",
    "name": "[13/17] dax, iomap: Add support for synchronous faults",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "888aa16b694c1f3261f4419cfffa76db8271ce53",
    "submitter": {
        "id": 363,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/363/?format=api",
        "name": "Jan Kara",
        "email": "jack@suse.cz"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20171024152415.22864-14-jack@suse.cz/mbox/",
    "series": [
        {
            "id": 10008,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/10008/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/list/?series=10008",
            "date": "2017-10-24T15:23:57",
            "name": "dax, ext4, xfs: Synchronous page faults",
            "version": 5,
            "mbox": "http://patchwork.ozlabs.org/series/10008/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/829946/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/829946/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<linux-ext4-owner@vger.kernel.org>",
        "X-Original-To": "patchwork-incoming@ozlabs.org",
        "Delivered-To": "patchwork-incoming@ozlabs.org",
        "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-ext4-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)",
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3yLxts2F32z9t3m\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 25 Oct 2017 02:26:13 +1100 (AEDT)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S932482AbdJXPZy (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tTue, 24 Oct 2017 11:25:54 -0400",
            "from mx2.suse.de ([195.135.220.15]:36102 \"EHLO mx2.suse.de\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S932407AbdJXPZe (ORCPT <rfc822;linux-ext4@vger.kernel.org>);\n\tTue, 24 Oct 2017 11:25:34 -0400",
            "from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254])\n\tby mx2.suse.de (Postfix) with ESMTP id 3B8E5AD6A;\n\tTue, 24 Oct 2017 15:25:28 +0000 (UTC)",
            "by quack2.suse.cz (Postfix, from userid 1000)\n\tid 6D9681E35D9; Tue, 24 Oct 2017 17:25:27 +0200 (CEST)"
        ],
        "X-Virus-Scanned": "by amavisd-new at test-mx.suse.de",
        "From": "Jan Kara <jack@suse.cz>",
        "To": "Dan Williams <dan.j.williams@intel.com>",
        "Cc": "Ross Zwisler <ross.zwisler@linux.intel.com>,\n\tChristoph Hellwig <hch@infradead.org>,\n\t<linux-ext4@vger.kernel.org>, linux-nvdimm@lists.01.org,\n\t<linux-fsdevel@vger.kernel.org>, <linux-xfs@vger.kernel.org>,\n\tlinux-api@vger.kernel.org, <linux-mm@kvack.org>, Jan Kara <jack@suse.cz>",
        "Subject": "[PATCH 13/17] dax, iomap: Add support for synchronous faults",
        "Date": "Tue, 24 Oct 2017 17:24:10 +0200",
        "Message-Id": "<20171024152415.22864-14-jack@suse.cz>",
        "X-Mailer": "git-send-email 2.12.3",
        "In-Reply-To": "<20171024152415.22864-1-jack@suse.cz>",
        "References": "<20171024152415.22864-1-jack@suse.cz>",
        "Sender": "linux-ext4-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<linux-ext4.vger.kernel.org>",
        "X-Mailing-List": "linux-ext4@vger.kernel.org"
    },
    "content": "Add a flag to iomap interface informing the caller that inode needs\nfdstasync(2) for returned extent to become persistent and use it in DAX\nfault code so that we don't map such extents into page tables\nimmediately. Instead we propagate the information that fdatasync(2) is\nnecessary from dax_iomap_fault() with a new VM_FAULT_NEEDDSYNC flag.\nFilesystem fault handler is then responsible for calling fdatasync(2)\nand inserting pfn into page tables.\n\nReviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>\nReviewed-by: Christoph Hellwig <hch@lst.de>\nSigned-off-by: Jan Kara <jack@suse.cz>\n---\n fs/dax.c              | 39 +++++++++++++++++++++++++++++++++++++--\n include/linux/iomap.h |  1 +\n include/linux/mm.h    |  6 +++++-\n 3 files changed, 43 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/fs/dax.c b/fs/dax.c\nindex efc210ff6665..bb9ff907738c 100644\n--- a/fs/dax.c\n+++ b/fs/dax.c\n@@ -1091,6 +1091,7 @@ static int dax_iomap_pte_fault(struct vm_fault *vmf, pfn_t *pfnp,\n \tunsigned flags = IOMAP_FAULT;\n \tint error, major = 0;\n \tbool write = vmf->flags & FAULT_FLAG_WRITE;\n+\tbool sync;\n \tint vmf_ret = 0;\n \tvoid *entry;\n \tpfn_t pfn;\n@@ -1169,6 +1170,8 @@ static int dax_iomap_pte_fault(struct vm_fault *vmf, pfn_t *pfnp,\n \t\tgoto finish_iomap;\n \t}\n \n+\tsync = (vma->vm_flags & VM_SYNC) && (iomap.flags & IOMAP_F_DIRTY);\n+\n \tswitch (iomap.type) {\n \tcase IOMAP_MAPPED:\n \t\tif (iomap.flags & IOMAP_F_NEW) {\n@@ -1182,12 +1185,27 @@ static int dax_iomap_pte_fault(struct vm_fault *vmf, pfn_t *pfnp,\n \n \t\tentry = dax_insert_mapping_entry(mapping, vmf, entry,\n \t\t\t\t\t\t dax_iomap_sector(&iomap, pos),\n-\t\t\t\t\t\t 0, write);\n+\t\t\t\t\t\t 0, write && !sync);\n \t\tif (IS_ERR(entry)) {\n \t\t\terror = PTR_ERR(entry);\n \t\t\tgoto error_finish_iomap;\n \t\t}\n \n+\t\t/*\n+\t\t * If we are doing synchronous page fault and inode needs fsync,\n+\t\t * we can insert PTE into page tables only after that happens.\n+\t\t * Skip insertion for now and return the pfn so that caller can\n+\t\t * insert it after fsync is done.\n+\t\t */\n+\t\tif (sync) {\n+\t\t\tif (WARN_ON_ONCE(!pfnp)) {\n+\t\t\t\terror = -EIO;\n+\t\t\t\tgoto error_finish_iomap;\n+\t\t\t}\n+\t\t\t*pfnp = pfn;\n+\t\t\tvmf_ret = VM_FAULT_NEEDDSYNC | major;\n+\t\t\tgoto finish_iomap;\n+\t\t}\n \t\ttrace_dax_insert_mapping(inode, vmf, entry);\n \t\tif (write)\n \t\t\terror = vm_insert_mixed_mkwrite(vma, vaddr, pfn);\n@@ -1287,6 +1305,7 @@ static int dax_iomap_pmd_fault(struct vm_fault *vmf, pfn_t *pfnp,\n \tstruct address_space *mapping = vma->vm_file->f_mapping;\n \tunsigned long pmd_addr = vmf->address & PMD_MASK;\n \tbool write = vmf->flags & FAULT_FLAG_WRITE;\n+\tbool sync;\n \tunsigned int iomap_flags = (write ? IOMAP_WRITE : 0) | IOMAP_FAULT;\n \tstruct inode *inode = mapping->host;\n \tint result = VM_FAULT_FALLBACK;\n@@ -1371,6 +1390,8 @@ static int dax_iomap_pmd_fault(struct vm_fault *vmf, pfn_t *pfnp,\n \tif (iomap.offset + iomap.length < pos + PMD_SIZE)\n \t\tgoto finish_iomap;\n \n+\tsync = (vma->vm_flags & VM_SYNC) && (iomap.flags & IOMAP_F_DIRTY);\n+\n \tswitch (iomap.type) {\n \tcase IOMAP_MAPPED:\n \t\terror = dax_iomap_pfn(&iomap, pos, PMD_SIZE, &pfn);\n@@ -1379,10 +1400,24 @@ static int dax_iomap_pmd_fault(struct vm_fault *vmf, pfn_t *pfnp,\n \n \t\tentry = dax_insert_mapping_entry(mapping, vmf, entry,\n \t\t\t\t\t\tdax_iomap_sector(&iomap, pos),\n-\t\t\t\t\t\tRADIX_DAX_PMD, write);\n+\t\t\t\t\t\tRADIX_DAX_PMD, write && !sync);\n \t\tif (IS_ERR(entry))\n \t\t\tgoto finish_iomap;\n \n+\t\t/*\n+\t\t * If we are doing synchronous page fault and inode needs fsync,\n+\t\t * we can insert PMD into page tables only after that happens.\n+\t\t * Skip insertion for now and return the pfn so that caller can\n+\t\t * insert it after fsync is done.\n+\t\t */\n+\t\tif (sync) {\n+\t\t\tif (WARN_ON_ONCE(!pfnp))\n+\t\t\t\tgoto finish_iomap;\n+\t\t\t*pfnp = pfn;\n+\t\t\tresult = VM_FAULT_NEEDDSYNC;\n+\t\t\tgoto finish_iomap;\n+\t\t}\n+\n \t\ttrace_dax_pmd_insert_mapping(inode, vmf, PMD_SIZE, pfn, entry);\n \t\tresult = vmf_insert_pfn_pmd(vma, vmf->address, vmf->pmd, pfn,\n \t\t\t\t\t    write);\ndiff --git a/include/linux/iomap.h b/include/linux/iomap.h\nindex f64dc6ce5161..4bc0a6fe3b15 100644\n--- a/include/linux/iomap.h\n+++ b/include/linux/iomap.h\n@@ -22,6 +22,7 @@ struct vm_fault;\n  * Flags for all iomap mappings:\n  */\n #define IOMAP_F_NEW\t0x01\t/* blocks have been newly allocated */\n+#define IOMAP_F_DIRTY\t0x02\t/* block mapping is not yet on persistent storage */\n \n /*\n  * Flags that only need to be reported for IOMAP_REPORT requests:\ndiff --git a/include/linux/mm.h b/include/linux/mm.h\nindex 5411cb7442de..f57e55782d7d 100644\n--- a/include/linux/mm.h\n+++ b/include/linux/mm.h\n@@ -1182,6 +1182,9 @@ static inline void clear_page_pfmemalloc(struct page *page)\n #define VM_FAULT_RETRY\t0x0400\t/* ->fault blocked, must retry */\n #define VM_FAULT_FALLBACK 0x0800\t/* huge page fault failed, fall back to small */\n #define VM_FAULT_DONE_COW   0x1000\t/* ->fault has fully handled COW */\n+#define VM_FAULT_NEEDDSYNC  0x2000\t/* ->fault did not modify page tables\n+\t\t\t\t\t * and needs fsync() to complete (for\n+\t\t\t\t\t * synchronous page faults in DAX) */\n \n #define VM_FAULT_ERROR\t(VM_FAULT_OOM | VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV | \\\n \t\t\t VM_FAULT_HWPOISON | VM_FAULT_HWPOISON_LARGE | \\\n@@ -1199,7 +1202,8 @@ static inline void clear_page_pfmemalloc(struct page *page)\n \t{ VM_FAULT_LOCKED,\t\t\"LOCKED\" }, \\\n \t{ VM_FAULT_RETRY,\t\t\"RETRY\" }, \\\n \t{ VM_FAULT_FALLBACK,\t\t\"FALLBACK\" }, \\\n-\t{ VM_FAULT_DONE_COW,\t\t\"DONE_COW\" }\n+\t{ VM_FAULT_DONE_COW,\t\t\"DONE_COW\" }, \\\n+\t{ VM_FAULT_NEEDDSYNC,\t\t\"NEEDDSYNC\" }\n \n /* Encode hstate index for a hwpoisoned large page */\n #define VM_FAULT_SET_HINDEX(x) ((x) << 12)\n",
    "prefixes": [
        "13/17"
    ]
}