get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 829947,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/829947/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20171024152415.22864-15-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-15-jack@suse.cz>",
    "list_archive_url": null,
    "date": "2017-10-24T15:24:11",
    "name": "[14/17] dax: Implement dax_finish_sync_fault()",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "14d6bed0d6441aa15cfdc3eef9e21450899a7b49",
    "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-15-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/829947/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/829947/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 3yLxtx1csBz9t2c\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 25 Oct 2017 02:26:17 +1100 (AEDT)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S932426AbdJXPZu (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tTue, 24 Oct 2017 11:25:50 -0400",
            "from mx2.suse.de ([195.135.220.15]:36151 \"EHLO mx2.suse.de\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S932441AbdJXPZf (ORCPT <rfc822;linux-ext4@vger.kernel.org>);\n\tTue, 24 Oct 2017 11:25:35 -0400",
            "from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254])\n\tby mx2.suse.de (Postfix) with ESMTP id 2DE26AE36;\n\tTue, 24 Oct 2017 15:25:29 +0000 (UTC)",
            "by quack2.suse.cz (Postfix, from userid 1000)\n\tid 70BA41E35DB; 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 14/17] dax: Implement dax_finish_sync_fault()",
        "Date": "Tue, 24 Oct 2017 17:24:11 +0200",
        "Message-Id": "<20171024152415.22864-15-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": "Implement a function that filesystems can call to finish handling of\nsynchronous page faults. It takes care of syncing appropriare file range\nand insertion of page table entry.\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                      | 83 +++++++++++++++++++++++++++++++++++++++++++\n include/linux/dax.h           |  2 ++\n include/trace/events/fs_dax.h |  2 ++\n 3 files changed, 87 insertions(+)",
    "diff": "diff --git a/fs/dax.c b/fs/dax.c\nindex bb9ff907738c..78233c716757 100644\n--- a/fs/dax.c\n+++ b/fs/dax.c\n@@ -1492,3 +1492,86 @@ int dax_iomap_fault(struct vm_fault *vmf, enum page_entry_size pe_size,\n \t}\n }\n EXPORT_SYMBOL_GPL(dax_iomap_fault);\n+\n+/**\n+ * dax_insert_pfn_mkwrite - insert PTE or PMD entry into page tables\n+ * @vmf: The description of the fault\n+ * @pe_size: Size of entry to be inserted\n+ * @pfn: PFN to insert\n+ *\n+ * This function inserts writeable PTE or PMD entry into page tables for mmaped\n+ * DAX file.  It takes care of marking corresponding radix tree entry as dirty\n+ * as well.\n+ */\n+static int dax_insert_pfn_mkwrite(struct vm_fault *vmf,\n+\t\t\t\t  enum page_entry_size pe_size,\n+\t\t\t\t  pfn_t pfn)\n+{\n+\tstruct address_space *mapping = vmf->vma->vm_file->f_mapping;\n+\tvoid *entry, **slot;\n+\tpgoff_t index = vmf->pgoff;\n+\tint vmf_ret, error;\n+\n+\tspin_lock_irq(&mapping->tree_lock);\n+\tentry = get_unlocked_mapping_entry(mapping, index, &slot);\n+\t/* Did we race with someone splitting entry or so? */\n+\tif (!entry ||\n+\t    (pe_size == PE_SIZE_PTE && !dax_is_pte_entry(entry)) ||\n+\t    (pe_size == PE_SIZE_PMD && !dax_is_pmd_entry(entry))) {\n+\t\tput_unlocked_mapping_entry(mapping, index, entry);\n+\t\tspin_unlock_irq(&mapping->tree_lock);\n+\t\ttrace_dax_insert_pfn_mkwrite_no_entry(mapping->host, vmf,\n+\t\t\t\t\t\t      VM_FAULT_NOPAGE);\n+\t\treturn VM_FAULT_NOPAGE;\n+\t}\n+\tradix_tree_tag_set(&mapping->page_tree, index, PAGECACHE_TAG_DIRTY);\n+\tentry = lock_slot(mapping, slot);\n+\tspin_unlock_irq(&mapping->tree_lock);\n+\tswitch (pe_size) {\n+\tcase PE_SIZE_PTE:\n+\t\terror = vm_insert_mixed_mkwrite(vmf->vma, vmf->address, pfn);\n+\t\tvmf_ret = dax_fault_return(error);\n+\t\tbreak;\n+#ifdef CONFIG_FS_DAX_PMD\n+\tcase PE_SIZE_PMD:\n+\t\tvmf_ret = vmf_insert_pfn_pmd(vmf->vma, vmf->address, vmf->pmd,\n+\t\t\tpfn, true);\n+\t\tbreak;\n+#endif\n+\tdefault:\n+\t\tvmf_ret = VM_FAULT_FALLBACK;\n+\t}\n+\tput_locked_mapping_entry(mapping, index);\n+\ttrace_dax_insert_pfn_mkwrite(mapping->host, vmf, vmf_ret);\n+\treturn vmf_ret;\n+}\n+\n+/**\n+ * dax_finish_sync_fault - finish synchronous page fault\n+ * @vmf: The description of the fault\n+ * @pe_size: Size of entry to be inserted\n+ * @pfn: PFN to insert\n+ *\n+ * This function ensures that the file range touched by the page fault is\n+ * stored persistently on the media and handles inserting of appropriate page\n+ * table entry.\n+ */\n+int dax_finish_sync_fault(struct vm_fault *vmf, enum page_entry_size pe_size,\n+\t\t\t  pfn_t pfn)\n+{\n+\tint err;\n+\tloff_t start = ((loff_t)vmf->pgoff) << PAGE_SHIFT;\n+\tsize_t len = 0;\n+\n+\tif (pe_size == PE_SIZE_PTE)\n+\t\tlen = PAGE_SIZE;\n+\telse if (pe_size == PE_SIZE_PMD)\n+\t\tlen = PMD_SIZE;\n+\telse\n+\t\tWARN_ON_ONCE(1);\n+\terr = vfs_fsync_range(vmf->vma->vm_file, start, start + len - 1, 1);\n+\tif (err)\n+\t\treturn VM_FAULT_SIGBUS;\n+\treturn dax_insert_pfn_mkwrite(vmf, pe_size, pfn);\n+}\n+EXPORT_SYMBOL_GPL(dax_finish_sync_fault);\ndiff --git a/include/linux/dax.h b/include/linux/dax.h\nindex e7fa4b8f45bc..d403f78b706c 100644\n--- a/include/linux/dax.h\n+++ b/include/linux/dax.h\n@@ -96,6 +96,8 @@ ssize_t dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,\n \t\tconst struct iomap_ops *ops);\n int dax_iomap_fault(struct vm_fault *vmf, enum page_entry_size pe_size,\n \t\t    pfn_t *pfnp, const struct iomap_ops *ops);\n+int dax_finish_sync_fault(struct vm_fault *vmf, enum page_entry_size pe_size,\n+\t\t\t  pfn_t pfn);\n int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index);\n int dax_invalidate_mapping_entry_sync(struct address_space *mapping,\n \t\t\t\t      pgoff_t index);\ndiff --git a/include/trace/events/fs_dax.h b/include/trace/events/fs_dax.h\nindex 88a9d19b8ff8..7725459fafef 100644\n--- a/include/trace/events/fs_dax.h\n+++ b/include/trace/events/fs_dax.h\n@@ -190,6 +190,8 @@ DEFINE_EVENT(dax_pte_fault_class, name, \\\n DEFINE_PTE_FAULT_EVENT(dax_pte_fault);\n DEFINE_PTE_FAULT_EVENT(dax_pte_fault_done);\n DEFINE_PTE_FAULT_EVENT(dax_load_hole);\n+DEFINE_PTE_FAULT_EVENT(dax_insert_pfn_mkwrite_no_entry);\n+DEFINE_PTE_FAULT_EVENT(dax_insert_pfn_mkwrite);\n \n TRACE_EVENT(dax_insert_mapping,\n \tTP_PROTO(struct inode *inode, struct vm_fault *vmf, void *radix_entry),\n",
    "prefixes": [
        "14/17"
    ]
}