[{"id":1756010,"web_url":"http://patchwork.ozlabs.org/comment/1756010/","msgid":"<e7bdd31c-79fc-cb03-84bc-b5a9df44df0a@uls.co.za>","list_archive_url":null,"date":"2017-08-24T08:18:11","subject":"Re: [PATCH] e2fsck: improve performance of region_allocate()","submitter":{"id":72203,"url":"http://patchwork.ozlabs.org/api/people/72203/","name":"Jaco Kroon","email":"jaco@uls.co.za"},"content":"Hi Ted,\n\nOn 24/08/2017 01:21, Theodore Ts'o wrote:\n> Jaco, here's the version of your patch I plan to use.  Please take a\n> look.\n>\n> The only real changes are mostly whitespace and formatting.\nVariable name change + formatting :).\n>\n> By the way, it would be nice if you could send me permission to add a\n>\n> Signed-off-by: Jaco Kroon <jaco@uls.co.za>\nApproved.\n\nKind Regards,\nJaco\n\n>\n> See http://elinux.org/Developer_Certificate_Of_Origin for an\n> explanation of what this means.\n>\n> \t\t\t\t\t\t- Ted\n>\n> commit 320d436c006dc2550ebd01084b6e823f0cea8bc2\n> Author: Jaco Kroon <jaco@uls.co.za>\n> Date:   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>\n>\n> diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c\n> index 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>","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 3xdHTT29Whz9rxj\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 24 Aug 2017 18:27:09 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751563AbdHXITA (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tThu, 24 Aug 2017 04:19:00 -0400","from othala.uls.co.za ([154.73.34.12]:32779 \"EHLO othala.uls.co.za\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1751283AbdHXISb (ORCPT <rfc822;linux-ext4@vger.kernel.org>);\n\tThu, 24 Aug 2017 04:18:31 -0400","from uls-154-73-35-201.wall.uls.co.za ([154.73.35.201]\n\thelo=tauri.local.uls.co.za) by othala.uls.co.za with esmtpsa\n\t(TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.88)\n\t(envelope-from <jaco@uls.co.za>)\n\tid 1dknLC-0005Wz-QD; Thu, 24 Aug 2017 10:18:14 +0200","from greyscale.dhcp.uls.co.za ([192.168.42.113])\n\tby tauri.local.uls.co.za with esmtpa (Exim 4.89)\n\t(envelope-from <jaco@uls.co.za>)\n\tid 1dknLA-0000gq-SK; Thu, 24 Aug 2017 10:18:13 +0200"],"Subject":"Re: [PATCH] e2fsck: improve performance of region_allocate()","To":"Theodore Ts'o <tytso@mit.edu>","Cc":"Doug Porter <dsp@fb.com>, linux-ext4@vger.kernel.org,\n\tOmar Sandoval <osandov@fb.com>","References":"<20170819011635.1815929-1-dsp@fb.com>\n\t<20170822022948.nyn6fessudjaj5xh@thunk.org>\n\t<a4b31ace-3a54-051d-75df-b47452c789cb@uls.co.za>\n\t<20170823232135.s54yfvs3zia2dnva@thunk.org>","From":"Jaco Kroon <jaco@uls.co.za>","Organization":"Ultimate Linux Solutions (Pty) Ltd","Message-ID":"<e7bdd31c-79fc-cb03-84bc-b5a9df44df0a@uls.co.za>","Date":"Thu, 24 Aug 2017 10:18:11 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.2.0","MIME-Version":"1.0","In-Reply-To":"<20170823232135.s54yfvs3zia2dnva@thunk.org>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Transfer-Encoding":"7bit","Content-Language":"en-US","X-Spam-report":"Relay access (othala.uls.co.za).","Sender":"linux-ext4-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<linux-ext4.vger.kernel.org>","X-Mailing-List":"linux-ext4@vger.kernel.org"}}]