get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 51941,
    "url": "http://patches.dpdk.org/api/patches/51941/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/728c19fa1ed26cdd319fe65e23c4058363dbf2dd.1553882085.git.anatoly.burakov@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<728c19fa1ed26cdd319fe65e23c4058363dbf2dd.1553882085.git.anatoly.burakov@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/728c19fa1ed26cdd319fe65e23c4058363dbf2dd.1553882085.git.anatoly.burakov@intel.com",
    "date": "2019-03-29T17:55:28",
    "name": "[v2,1/2] memalloc: refactor segment resizing code",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "51290bde1d38dd26583ee65676dfd573775a561b",
    "submitter": {
        "id": 4,
        "url": "http://patches.dpdk.org/api/people/4/?format=api",
        "name": "Anatoly Burakov",
        "email": "anatoly.burakov@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/728c19fa1ed26cdd319fe65e23c4058363dbf2dd.1553882085.git.anatoly.burakov@intel.com/mbox/",
    "series": [
        {
            "id": 4006,
            "url": "http://patches.dpdk.org/api/series/4006/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4006",
            "date": "2019-03-29T17:55:28",
            "name": "[v2,1/2] memalloc: refactor segment resizing code",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/4006/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/51941/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/51941/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id AA3E84C96;\n\tFri, 29 Mar 2019 18:55:34 +0100 (CET)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id 0A6212C28\n\tfor <dev@dpdk.org>; Fri, 29 Mar 2019 18:55:32 +0100 (CET)",
            "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t29 Mar 2019 10:55:32 -0700",
            "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby orsmga003.jf.intel.com with ESMTP; 29 Mar 2019 10:55:30 -0700",
            "from sivswdev05.ir.intel.com (sivswdev05.ir.intel.com\n\t[10.243.17.64])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\tx2THtU7l022590; Fri, 29 Mar 2019 17:55:30 GMT",
            "from sivswdev05.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev05.ir.intel.com with ESMTP id x2THtT4g019433;\n\tFri, 29 Mar 2019 17:55:29 GMT",
            "(from aburakov@localhost)\n\tby sivswdev05.ir.intel.com with LOCAL id x2THtTac019429;\n\tFri, 29 Mar 2019 17:55:29 GMT"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.60,285,1549958400\"; d=\"scan'208\";a=\"138397991\"",
        "From": "Anatoly Burakov <anatoly.burakov@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "david.marchand@redhat.com, thomas@monjalon.net,\n\tmaxime.coquelin@redhat.com",
        "Date": "Fri, 29 Mar 2019 17:55:28 +0000",
        "Message-Id": "<728c19fa1ed26cdd319fe65e23c4058363dbf2dd.1553882085.git.anatoly.burakov@intel.com>",
        "X-Mailer": "git-send-email 1.7.0.7",
        "In-Reply-To": "<07f664c33ddedaa5dcfe82ecb97d931e68b7e33a.1550855529.git.anatoly.burakov@intel.com>",
        "References": "<07f664c33ddedaa5dcfe82ecb97d931e68b7e33a.1550855529.git.anatoly.burakov@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v2 1/2] memalloc: refactor segment resizing code",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Currently, segment resizing code sits in one giant function which\nhandles both in-memory and regular modes. Split them up into\nindividual functions.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n lib/librte_eal/linux/eal/eal_memalloc.c | 72 +++++++++++++++----------\n 1 file changed, 45 insertions(+), 27 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/linux/eal/eal_memalloc.c b/lib/librte_eal/linux/eal/eal_memalloc.c\nindex b6fb183db..e90fe6c95 100644\n--- a/lib/librte_eal/linux/eal/eal_memalloc.c\n+++ b/lib/librte_eal/linux/eal/eal_memalloc.c\n@@ -425,37 +425,37 @@ get_seg_fd(char *path, int buflen, struct hugepage_info *hi,\n }\n \n static int\n-resize_hugefile(int fd, char *path, int list_idx, int seg_idx,\n+resize_hugefile_in_memory(int fd, int list_idx, uint64_t fa_offset,\n+\t\tuint64_t page_sz, bool grow)\n+{\n+\tint flags = grow ? 0 : FALLOC_FL_PUNCH_HOLE |\n+\t\t\tFALLOC_FL_KEEP_SIZE;\n+\tint ret;\n+\n+\t/* grow or shrink the file */\n+\tret = fallocate(fd, flags, fa_offset, page_sz);\n+\n+\tif (ret < 0) {\n+\t\tRTE_LOG(DEBUG, EAL, \"%s(): fallocate() failed: %s\\n\",\n+\t\t\t\t__func__,\n+\t\t\t\tstrerror(errno));\n+\t\treturn -1;\n+\t}\n+\t/* increase/decrease total segment count */\n+\tfd_list[list_idx].count += (grow ? 1 : -1);\n+\tif (!grow && fd_list[list_idx].count == 0) {\n+\t\tclose(fd_list[list_idx].memseg_list_fd);\n+\t\tfd_list[list_idx].memseg_list_fd = -1;\n+\t}\n+\treturn 0;\n+}\n+\n+static int\n+resize_hugefile_in_filesystem(int fd, char *path, int list_idx, int seg_idx,\n \t\tuint64_t fa_offset, uint64_t page_sz, bool grow)\n {\n \tbool again = false;\n \n-\t/* in-memory mode is a special case, because we don't need to perform\n-\t * any locking, and we can be sure that fallocate() is supported.\n-\t */\n-\tif (internal_config.in_memory) {\n-\t\tint flags = grow ? 0 : FALLOC_FL_PUNCH_HOLE |\n-\t\t\t\tFALLOC_FL_KEEP_SIZE;\n-\t\tint ret;\n-\n-\t\t/* grow or shrink the file */\n-\t\tret = fallocate(fd, flags, fa_offset, page_sz);\n-\n-\t\tif (ret < 0) {\n-\t\t\tRTE_LOG(DEBUG, EAL, \"%s(): fallocate() failed: %s\\n\",\n-\t\t\t\t\t__func__,\n-\t\t\t\t\tstrerror(errno));\n-\t\t\treturn -1;\n-\t\t}\n-\t\t/* increase/decrease total segment count */\n-\t\tfd_list[list_idx].count += (grow ? 1 : -1);\n-\t\tif (!grow && fd_list[list_idx].count == 0) {\n-\t\t\tclose(fd_list[list_idx].memseg_list_fd);\n-\t\t\tfd_list[list_idx].memseg_list_fd = -1;\n-\t\t}\n-\t\treturn 0;\n-\t}\n-\n \tdo {\n \t\tif (fallocate_supported == 0) {\n \t\t\t/* we cannot deallocate memory if fallocate() is not\n@@ -583,9 +583,27 @@ resize_hugefile(int fd, char *path, int list_idx, int seg_idx,\n \t\t\t}\n \t\t}\n \t} while (again);\n+\n \treturn 0;\n }\n \n+\n+static int\n+resize_hugefile(int fd, char *path, int list_idx, int seg_idx,\n+\t\tuint64_t fa_offset, uint64_t page_sz, bool grow)\n+{\n+\n+\t/* in-memory mode is a special case, because we don't need to perform\n+\t * any locking, and we can be sure that fallocate() is supported.\n+\t */\n+\tif (internal_config.in_memory)\n+\t\treturn resize_hugefile_in_memory(fd, list_idx, fa_offset,\n+\t\t\t\tpage_sz, grow);\n+\n+\treturn resize_hugefile_in_filesystem(fd, path, list_idx, seg_idx,\n+\t\t\tfa_offset, page_sz, grow);\n+}\n+\n static int\n alloc_seg(struct rte_memseg *ms, void *addr, int socket_id,\n \t\tstruct hugepage_info *hi, unsigned int list_idx,\n",
    "prefixes": [
        "v2",
        "1/2"
    ]
}