{"id":805196,"url":"http://patchwork.ozlabs.org/api/1.2/patches/805196/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-ext4/patch/20170823232135.s54yfvs3zia2dnva@thunk.org/","project":{"id":8,"url":"http://patchwork.ozlabs.org/api/1.2/projects/8/?format=json","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":"<20170823232135.s54yfvs3zia2dnva@thunk.org>","list_archive_url":null,"date":"2017-08-23T23:21:35","name":"e2fsck: improve performance of region_allocate()","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"5fd3f541c73eaa5a58a16a803ff8d86171562c32","submitter":{"id":350,"url":"http://patchwork.ozlabs.org/api/1.2/people/350/?format=json","name":"Theodore Tso","email":"tytso@mit.edu"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-ext4/patch/20170823232135.s54yfvs3zia2dnva@thunk.org/mbox/","series":[],"comments":"http://patchwork.ozlabs.org/api/patches/805196/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/805196/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>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=thunk.org header.i=@thunk.org\n\theader.b=\"bj8Cx6cm\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xd3N56ScKz9sxR\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 24 Aug 2017 09:21:41 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751190AbdHWXVl (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tWed, 23 Aug 2017 19:21:41 -0400","from imap.thunk.org ([74.207.234.97]:47498 \"EHLO imap.thunk.org\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1751038AbdHWXVk (ORCPT <rfc822;linux-ext4@vger.kernel.org>);\n\tWed, 23 Aug 2017 19:21:40 -0400","from root (helo=callcc.thunk.org)\n\tby imap.thunk.org with local-esmtp (Exim 4.84_2)\n\t(envelope-from <tytso@thunk.org>)\n\tid 1dkexr-0005GR-TA; Wed, 23 Aug 2017 23:21:35 +0000","by callcc.thunk.org (Postfix, from userid 15806)\n\tid 201FAC00CD3; Wed, 23 Aug 2017 19:21:35 -0400 (EDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=thunk.org;\n\ts=ef5046eb; \n\th=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date;\n\tbh=oijAKmdxf3khUbacfRmv9clVkAXlkkRJ3dPM/7IX7Sg=; \n\tb=bj8Cx6cm9qFWtmTQ5Qf9SbvKoeOBwiX1g79Gpp1IeEUxxe+dkj3WiQtiO4mCcoQtPc74snFoONOSKi2NtE6JQziYuAWqBRNiBz5qUWZpPNZIJdsp2KHZlXMkUZQIgtOK0qcUrhbDYu84+L+zSv8TzGDjMiiREY5iYj5Xh4nobyY=;","Date":"Wed, 23 Aug 2017 19:21:35 -0400","From":"Theodore Ts'o <tytso@mit.edu>","To":"Jaco Kroon <jaco@uls.co.za>","Cc":"Doug Porter <dsp@fb.com>, linux-ext4@vger.kernel.org,\n\tOmar Sandoval <osandov@fb.com>","Subject":"Re: [PATCH] e2fsck: improve performance of region_allocate()","Message-ID":"<20170823232135.s54yfvs3zia2dnva@thunk.org>","References":"<20170819011635.1815929-1-dsp@fb.com>\n\t<20170822022948.nyn6fessudjaj5xh@thunk.org>\n\t<a4b31ace-3a54-051d-75df-b47452c789cb@uls.co.za>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<a4b31ace-3a54-051d-75df-b47452c789cb@uls.co.za>","User-Agent":"NeoMutt/20170609 (1.8.3)","X-SA-Exim-Connect-IP":"<locally generated>","X-SA-Exim-Mail-From":"tytso@thunk.org","X-SA-Exim-Scanned":"No (on imap.thunk.org); SAEximRunCond expanded to false","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":"Jaco, here's the version of your patch I plan to use.  Please take a\nlook.\n\nThe only real changes are mostly whitespace and formatting.\n\nBy the way, it would be nice if you could send me permission to add a\n\nSigned-off-by: Jaco Kroon <jaco@uls.co.za>\n\nSee http://elinux.org/Developer_Certificate_Of_Origin for an\nexplanation of what this means.\n\n\t\t\t\t\t\t- Ted\n\ncommit 320d436c006dc2550ebd01084b6e823f0cea8bc2\nAuthor: Jaco Kroon <jaco@uls.co.za>\nDate:   Wed Aug 23 13:54:25 2017 -0400\n\n    e2fsck: optimize out the use region_t in scan_extent_node()\n    \n    Since extents have a guarantee of being monotonically increasing we\n    merely need to check that block n+1 starts after block n.  This is a\n    simple enough check and we can perform this by calculating the next\n    expected logical block instead of using the region usage tracking data\n    abstraction.\n    \n    Signed-off-by: Theodore Ts'o <tytso@mit.edu>","diff":"diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c\nindex 8044beed6..bc26beb99 100644\n--- a/e2fsck/pass1.c\n+++ b/e2fsck/pass1.c\n@@ -96,7 +96,7 @@ struct process_block_struct {\n \tstruct problem_context *pctx;\n \text2fs_block_bitmap fs_meta_blocks;\n \te2fsck_t\tctx;\n-\tregion_t\tregion;\n+\tblk64_t\t\tnext_lblock;\n \tstruct extent_tree_info\teti;\n };\n \n@@ -2628,9 +2628,18 @@ static void scan_extent_node(e2fsck_t ctx, struct problem_context *pctx,\n \t\t\t  (1U << (21 - ctx->fs->super->s_log_block_size))))\n \t\t\tproblem = PR_1_TOOBIG_DIR;\n \n-\t\tif (is_leaf && problem == 0 && extent.e_len > 0 &&\n-\t\t    region_allocate(pb->region, extent.e_lblk, extent.e_len))\n-\t\t\tproblem = PR_1_EXTENT_COLLISION;\n+\t\tif (is_leaf && problem == 0 && extent.e_len > 0) {\n+#if 0\n+\t\t\tprintf(\"extent_region(ino=%u, expect=%llu, \"\n+\t\t\t       \"lblk=%llu, len=%u)\\n\",\n+\t\t\t       pb->ino, pb->next_lblock,\n+\t\t\t       extent.e_lblk, extent.e_len);\n+#endif\n+\t\t\tif (extent.e_lblk < pb->next_lblock)\n+\t\t\t\tproblem = PR_1_EXTENT_COLLISION;\n+\t\t\telse if (extent.e_lblk + extent.e_len > pb->next_lblock)\n+\t\t\t\tpb->next_lblock = extent.e_lblk + extent.e_len;\n+\t\t}\n \n \t\t/*\n \t\t * Uninitialized blocks in a directory?  Clear the flag and\n@@ -2963,13 +2972,7 @@ static void check_blocks_extents(e2fsck_t ctx, struct problem_context *pctx,\n \tmemset(pb->eti.ext_info, 0, sizeof(pb->eti.ext_info));\n \tpb->eti.ino = pb->ino;\n \n-\tpb->region = region_create(0, info.max_lblk);\n-\tif (!pb->region) {\n-\t\text2fs_extent_free(ehandle);\n-\t\tfix_problem(ctx, PR_1_EXTENT_ALLOC_REGION_ABORT, pctx);\n-\t\tctx->flags |= E2F_FLAG_ABORT;\n-\t\treturn;\n-\t}\n+\tpb->next_lblock = 0;\n \n \teof_lblk = ((EXT2_I_SIZE(inode) + fs->blocksize - 1) >>\n \t\tEXT2_BLOCK_SIZE_BITS(fs->super)) - 1;\n@@ -2982,8 +2985,6 @@ static void check_blocks_extents(e2fsck_t ctx, struct problem_context *pctx,\n \t\t\t\t   \"check_blocks_extents\");\n \t\tpctx->errcode = 0;\n \t}\n-\tregion_free(pb->region);\n-\tpb->region = NULL;\n \text2fs_extent_free(ehandle);\n \n \t/* Rebuild unless it's a dir and we're rehashing it */\n","prefixes":[]}