get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 829950,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/829950/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20171024152415.22864-17-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-17-jack@suse.cz>",
    "list_archive_url": null,
    "date": "2017-10-24T15:24:13",
    "name": "[16/17] ext4: Support for synchronous DAX faults",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "b3fe0807e4775dbf08469d7f01838631a2f7e618",
    "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-17-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/829950/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/829950/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 3yLxvF1DLJz9t5C\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 25 Oct 2017 02:26:33 +1100 (AEDT)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S932497AbdJXP0c (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tTue, 24 Oct 2017 11:26:32 -0400",
            "from mx2.suse.de ([195.135.220.15]:36117 \"EHLO mx2.suse.de\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S932338AbdJXPZc (ORCPT <rfc822;linux-ext4@vger.kernel.org>);\n\tTue, 24 Oct 2017 11:25:32 -0400",
            "from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254])\n\tby mx2.suse.de (Postfix) with ESMTP id 31FB7AD49;\n\tTue, 24 Oct 2017 15:25:28 +0000 (UTC)",
            "by quack2.suse.cz (Postfix, from userid 1000)\n\tid 7511D1E35E1; 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 16/17] ext4: Support for synchronous DAX faults",
        "Date": "Tue, 24 Oct 2017 17:24:13 +0200",
        "Message-Id": "<20171024152415.22864-17-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": "We return IOMAP_F_DIRTY flag from ext4_iomap_begin() when asked to\nprepare blocks for writing and the inode has some uncommitted metadata\nchanges. In the fault handler ext4_dax_fault() we then detect this case\n(through VM_FAULT_NEEDDSYNC return value) and call helper\ndax_finish_sync_fault() to flush metadata changes and insert page table\nentry. Note that this will also dirty corresponding radix tree entry\nwhich is what we want - fsync(2) will still provide data integrity\nguarantees for applications not using userspace flushing. And\napplications using userspace flushing can avoid calling fsync(2) and\nthus avoid the performance overhead.\n\nReviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>\nSigned-off-by: Jan Kara <jack@suse.cz>\n---\n fs/ext4/file.c       | 15 ++++++++++++++-\n fs/ext4/inode.c      | 15 +++++++++++++++\n fs/jbd2/journal.c    | 17 +++++++++++++++++\n include/linux/jbd2.h |  1 +\n 4 files changed, 47 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/fs/ext4/file.c b/fs/ext4/file.c\nindex 208adfc3e673..08a1d1a33a90 100644\n--- a/fs/ext4/file.c\n+++ b/fs/ext4/file.c\n@@ -26,6 +26,7 @@\n #include <linux/quotaops.h>\n #include <linux/pagevec.h>\n #include <linux/uio.h>\n+#include <linux/mman.h>\n #include \"ext4.h\"\n #include \"ext4_jbd2.h\"\n #include \"xattr.h\"\n@@ -295,6 +296,7 @@ static int ext4_dax_huge_fault(struct vm_fault *vmf,\n \t */\n \tbool write = (vmf->flags & FAULT_FLAG_WRITE) &&\n \t\t(vmf->vma->vm_flags & VM_SHARED);\n+\tpfn_t pfn;\n \n \tif (write) {\n \t\tsb_start_pagefault(sb);\n@@ -310,9 +312,12 @@ static int ext4_dax_huge_fault(struct vm_fault *vmf,\n \t} else {\n \t\tdown_read(&EXT4_I(inode)->i_mmap_sem);\n \t}\n-\tresult = dax_iomap_fault(vmf, pe_size, NULL, &ext4_iomap_ops);\n+\tresult = dax_iomap_fault(vmf, pe_size, &pfn, &ext4_iomap_ops);\n \tif (write) {\n \t\text4_journal_stop(handle);\n+\t\t/* Handling synchronous page fault? */\n+\t\tif (result & VM_FAULT_NEEDDSYNC)\n+\t\t\tresult = dax_finish_sync_fault(vmf, pe_size, pfn);\n \t\tup_read(&EXT4_I(inode)->i_mmap_sem);\n \t\tsb_end_pagefault(sb);\n \t} else {\n@@ -350,6 +355,13 @@ static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma)\n \tif (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))\n \t\treturn -EIO;\n \n+\t/*\n+\t * We don't support synchronous mappings for non-DAX files. At least\n+\t * until someone comes with a sensible use case.\n+\t */\n+\tif (!IS_DAX(file_inode(file)) && (vma->vm_flags & VM_SYNC))\n+\t\treturn -EOPNOTSUPP;\n+\n \tfile_accessed(file);\n \tif (IS_DAX(file_inode(file))) {\n \t\tvma->vm_ops = &ext4_dax_vm_ops;\n@@ -719,6 +731,7 @@ const struct file_operations ext4_file_operations = {\n \t.compat_ioctl\t= ext4_compat_ioctl,\n #endif\n \t.mmap\t\t= ext4_file_mmap,\n+\t.mmap_supported_flags = MAP_SYNC,\n \t.open\t\t= ext4_file_open,\n \t.release\t= ext4_release_file,\n \t.fsync\t\t= ext4_sync_file,\ndiff --git a/fs/ext4/inode.c b/fs/ext4/inode.c\nindex 31db875bc7a1..13a198924a0f 100644\n--- a/fs/ext4/inode.c\n+++ b/fs/ext4/inode.c\n@@ -3394,6 +3394,19 @@ static int ext4_releasepage(struct page *page, gfp_t wait)\n }\n \n #ifdef CONFIG_FS_DAX\n+static bool ext4_inode_datasync_dirty(struct inode *inode)\n+{\n+\tjournal_t *journal = EXT4_SB(inode->i_sb)->s_journal;\n+\n+\tif (journal)\n+\t\treturn !jbd2_transaction_committed(journal,\n+\t\t\t\t\tEXT4_I(inode)->i_datasync_tid);\n+\t/* Any metadata buffers to write? */\n+\tif (!list_empty(&inode->i_mapping->private_list))\n+\t\treturn true;\n+\treturn inode->i_state & I_DIRTY_DATASYNC;\n+}\n+\n static int ext4_iomap_begin(struct inode *inode, loff_t offset, loff_t length,\n \t\t\t    unsigned flags, struct iomap *iomap)\n {\n@@ -3466,6 +3479,8 @@ static int ext4_iomap_begin(struct inode *inode, loff_t offset, loff_t length,\n \t}\n \n \tiomap->flags = 0;\n+\tif ((flags & IOMAP_WRITE) && ext4_inode_datasync_dirty(inode))\n+\t\tiomap->flags |= IOMAP_F_DIRTY;\n \tiomap->bdev = inode->i_sb->s_bdev;\n \tiomap->dax_dev = sbi->s_daxdev;\n \tiomap->offset = first_block << blkbits;\ndiff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c\nindex 7d5ef3bf3f3e..fa8cde498b4b 100644\n--- a/fs/jbd2/journal.c\n+++ b/fs/jbd2/journal.c\n@@ -738,6 +738,23 @@ int jbd2_log_wait_commit(journal_t *journal, tid_t tid)\n \treturn err;\n }\n \n+/* Return 1 when transaction with given tid has already committed. */\n+int jbd2_transaction_committed(journal_t *journal, tid_t tid)\n+{\n+\tint ret = 1;\n+\n+\tread_lock(&journal->j_state_lock);\n+\tif (journal->j_running_transaction &&\n+\t    journal->j_running_transaction->t_tid == tid)\n+\t\tret = 0;\n+\tif (journal->j_committing_transaction &&\n+\t    journal->j_committing_transaction->t_tid == tid)\n+\t\tret = 0;\n+\tread_unlock(&journal->j_state_lock);\n+\treturn ret;\n+}\n+EXPORT_SYMBOL(jbd2_transaction_committed);\n+\n /*\n  * When this function returns the transaction corresponding to tid\n  * will be completed.  If the transaction has currently running, start\ndiff --git a/include/linux/jbd2.h b/include/linux/jbd2.h\nindex 606b6bce3a5b..296d1e0ea87b 100644\n--- a/include/linux/jbd2.h\n+++ b/include/linux/jbd2.h\n@@ -1367,6 +1367,7 @@ int jbd2_log_start_commit(journal_t *journal, tid_t tid);\n int __jbd2_log_start_commit(journal_t *journal, tid_t tid);\n int jbd2_journal_start_commit(journal_t *journal, tid_t *tid);\n int jbd2_log_wait_commit(journal_t *journal, tid_t tid);\n+int jbd2_transaction_committed(journal_t *journal, tid_t tid);\n int jbd2_complete_transaction(journal_t *journal, tid_t tid);\n int jbd2_log_do_checkpoint(journal_t *journal);\n int jbd2_trans_will_send_data_barrier(journal_t *journal, tid_t tid);\n",
    "prefixes": [
        "16/17"
    ]
}