Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/40993/?format=api
http://patchwork.dpdk.org/api/patches/40993/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/fd2864a5e67ae180919851b4690b41732f237c3a.1528749451.git.anatoly.burakov@intel.com/", "project": { "id": 1, "url": "http://patchwork.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": "<fd2864a5e67ae180919851b4690b41732f237c3a.1528749451.git.anatoly.burakov@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/fd2864a5e67ae180919851b4690b41732f237c3a.1528749451.git.anatoly.burakov@intel.com", "date": "2018-06-11T20:55:37", "name": "[4/9] fbarray: reduce duplication in find_next code", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "45eb94b27af968f9ec10fdfecb2f9d4c04ca7c17", "submitter": { "id": 4, "url": "http://patchwork.dpdk.org/api/people/4/?format=api", "name": "Burakov, Anatoly", "email": "anatoly.burakov@intel.com" }, "delegate": { "id": 1, "url": "http://patchwork.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/fd2864a5e67ae180919851b4690b41732f237c3a.1528749451.git.anatoly.burakov@intel.com/mbox/", "series": [ { "id": 85, "url": "http://patchwork.dpdk.org/api/series/85/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=85", "date": "2018-06-11T20:55:33", "name": "mem: reduce memory fragmentation", "version": 1, "mbox": "http://patchwork.dpdk.org/series/85/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/40993/comments/", "check": "success", "checks": "http://patchwork.dpdk.org/api/patches/40993/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 7450B1DEAA;\n\tMon, 11 Jun 2018 22:56:03 +0200 (CEST)", "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n\tby dpdk.org (Postfix) with ESMTP id 6A8B11DE4C\n\tfor <dev@dpdk.org>; Mon, 11 Jun 2018 22:55:48 +0200 (CEST)", "from orsmga005.jf.intel.com ([10.7.209.41])\n\tby fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t11 Jun 2018 13:55:48 -0700", "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby orsmga005.jf.intel.com with ESMTP; 11 Jun 2018 13:55:45 -0700", "from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com\n\t[10.237.217.45])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\tw5BKthg1026377 for <dev@dpdk.org>; Mon, 11 Jun 2018 21:55:43 +0100", "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id w5BKthq5021592\n\tfor <dev@dpdk.org>; Mon, 11 Jun 2018 21:55:43 +0100", "(from aburakov@localhost)\n\tby sivswdev01.ir.intel.com with LOCAL id w5BKthHO021588\n\tfor dev@dpdk.org; Mon, 11 Jun 2018 21:55:43 +0100" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.51,211,1526367600\"; d=\"scan'208\";a=\"231737137\"", "From": "Anatoly Burakov <anatoly.burakov@intel.com>", "To": "dev@dpdk.org", "Date": "Mon, 11 Jun 2018 21:55:37 +0100", "Message-Id": "<fd2864a5e67ae180919851b4690b41732f237c3a.1528749451.git.anatoly.burakov@intel.com>", "X-Mailer": "git-send-email 1.7.0.7", "In-Reply-To": [ "<cover.1528749451.git.anatoly.burakov@intel.com>", "<cover.1528749451.git.anatoly.burakov@intel.com>" ], "References": [ "<cover.1528749451.git.anatoly.burakov@intel.com>", "<cover.1528749451.git.anatoly.burakov@intel.com>" ], "Subject": "[dpdk-dev] [PATCH 4/9] fbarray: reduce duplication in find_next 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://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Just code move to put all checks and calls in one place.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n lib/librte_eal/common/eal_common_fbarray.c | 54 ++++++++++++----------\n 1 file changed, 29 insertions(+), 25 deletions(-)", "diff": "diff --git a/lib/librte_eal/common/eal_common_fbarray.c b/lib/librte_eal/common/eal_common_fbarray.c\nindex c5ee017dd..22370398f 100644\n--- a/lib/librte_eal/common/eal_common_fbarray.c\n+++ b/lib/librte_eal/common/eal_common_fbarray.c\n@@ -675,8 +675,8 @@ rte_fbarray_is_used(struct rte_fbarray *arr, unsigned int idx)\n \treturn ret;\n }\n \n-int __rte_experimental\n-rte_fbarray_find_next_free(struct rte_fbarray *arr, unsigned int start)\n+static int\n+fbarray_find(struct rte_fbarray *arr, unsigned int start, bool used)\n {\n \tint ret = -1;\n \n@@ -688,39 +688,43 @@ rte_fbarray_find_next_free(struct rte_fbarray *arr, unsigned int start)\n \t/* prevent array from changing under us */\n \trte_rwlock_read_lock(&arr->rwlock);\n \n-\tif (arr->len == arr->count) {\n-\t\trte_errno = ENOSPC;\n-\t\tgoto out;\n+\t/* cheap checks to prevent doing useless work */\n+\tif (!used) {\n+\t\tif (arr->len == arr->count) {\n+\t\t\trte_errno = ENOSPC;\n+\t\t\tgoto out;\n+\t\t}\n+\t\tif (arr->count == 0) {\n+\t\t\tret = start;\n+\t\t\tgoto out;\n+\t\t}\n+\t} else {\n+\t\tif (arr->count == 0) {\n+\t\t\trte_errno = ENOENT;\n+\t\t\tgoto out;\n+\t\t}\n+\t\tif (arr->len == arr->count) {\n+\t\t\tret = start;\n+\t\t\tgoto out;\n+\t\t}\n \t}\n \n-\tret = find_next(arr, start, false);\n+\tret = find_next(arr, start, used);\n out:\n \trte_rwlock_read_unlock(&arr->rwlock);\n \treturn ret;\n }\n \n int __rte_experimental\n-rte_fbarray_find_next_used(struct rte_fbarray *arr, unsigned int start)\n+rte_fbarray_find_next_free(struct rte_fbarray *arr, unsigned int start)\n {\n-\tint ret = -1;\n-\n-\tif (arr == NULL || start >= arr->len) {\n-\t\trte_errno = EINVAL;\n-\t\treturn -1;\n-\t}\n-\n-\t/* prevent array from changing under us */\n-\trte_rwlock_read_lock(&arr->rwlock);\n-\n-\tif (arr->count == 0) {\n-\t\trte_errno = ENOENT;\n-\t\tgoto out;\n-\t}\n+\treturn fbarray_find(arr, start, false);\n+}\n \n-\tret = find_next(arr, start, true);\n-out:\n-\trte_rwlock_read_unlock(&arr->rwlock);\n-\treturn ret;\n+int __rte_experimental\n+rte_fbarray_find_next_used(struct rte_fbarray *arr, unsigned int start)\n+{\n+\treturn fbarray_find(arr, start, true);\n }\n \n static int\n", "prefixes": [ "4/9" ] }{ "id": 40993, "url": "