--- /dev/null
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 2FCA36DE0350\r
+ for <notmuch@notmuchmail.org>; Fri, 15 Apr 2016 12:30:54 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.557\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.557 tagged_above=-999 required=5 tests=[AWL=0.163,\r
+ DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7,\r
+ RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id IYV73PdIWT_y for <notmuch@notmuchmail.org>;\r
+ Fri, 15 Apr 2016 12:30:46 -0700 (PDT)\r
+Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com\r
+ [74.125.82.68]) by arlo.cworth.org (Postfix) with ESMTPS id 52E9E6DE014D for\r
+ <notmuch@notmuchmail.org>; Fri, 15 Apr 2016 12:30:39 -0700 (PDT)\r
+Received: by mail-wm0-f68.google.com with SMTP id y144so8575913wmd.0\r
+ for <notmuch@notmuchmail.org>; Fri, 15 Apr 2016 12:30:39 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=nikula-org.20150623.gappssmtp.com; s=20150623;\r
+ h=from:to:cc:subject:date:message-id:in-reply-to:references\r
+ :in-reply-to:references;\r
+ bh=ZIIn8KghJ1jZoJ60VVVXUshVpwhEScEitCj5Vd6m4rU=;\r
+ b=Ynzq7qdV4e1D/CXpL/w9lAG/3sbRJXp8ZBjCE8IQ5bI8B8kJm2Z+FZHvX+5UREXbXo\r
+ 7wJysTiWiBwQfRi4sCYYDDTeGc5vV/pmwnY6RoUqofglCbsLqn2n/vUQl77fRPXxsOYM\r
+ V4C36NxtRYPtT89f88SvAFywzx1dabGhUga6SDqrADvB3pZFEVxYy/KGKu934/04nU+H\r
+ AvG62T9J7rSUbs3vgO2Xv9KsWkXGDTpA5ND+Bz7y6S2FzDicjndo2/sBldbZraLAyYhA\r
+ KzHaOIrL6sFcZIy/8mw5n5Fq7cs7EKiGnRNVGpaMj5nzdlUVYO14vMGtyEYA59gZfJ81\r
+ i7Ew==\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\r
+ :references:in-reply-to:references;\r
+ bh=ZIIn8KghJ1jZoJ60VVVXUshVpwhEScEitCj5Vd6m4rU=;\r
+ b=OrQGxP+BDs3+rcGN0fZJgJa4nW+H1OX328uJuY82/RLyQ1r0W9+c2r/q3zSro3mD97\r
+ q8XjaxjLWViMzLB75sZCHmPo4q3QvegysrZNLEvbCPawJBKowj9vVY2Yx7nCljj0KoYV\r
+ QBJOfMcjywPGLQCrh5ePZe+zlvY0t+OSVerYp95BKGGEK9lmYo2OI+NRlp1yAoRAtOGz\r
+ CP1FvHBO7pMvu2lKmaoP9vy+D9c1wWwy88TgLKWVk/y94xnH3UwM4LqXTaTnqH5JEQ/s\r
+ sO5z3vw5+PFKxALuksR/wmInRMeOMRjEMTfWillCvYDWYDu4/xDtpyLe+R3pB41IqL6L\r
+ SEhw==\r
+X-Gm-Message-State:\r
+ AOPr4FUGkUteKVo/hMDU3zuVIB9bioS1BJcNhq5HDotlmBewKSkLiXEt1IgvuIeK2lgx5Q==\r
+X-Received: by 10.194.43.34 with SMTP id t2mr23487197wjl.58.1460748638069;\r
+ Fri, 15 Apr 2016 12:30:38 -0700 (PDT)\r
+Received: from localhost (mobile-access-bcee7f-102.dhcp.inet.fi.\r
+ [188.238.127.102])\r
+ by smtp.gmail.com with ESMTPSA id j10sm50452278wjb.46.2016.04.15.12.30.37\r
+ (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Fri, 15 Apr 2016 12:30:37 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [RFC PATCH 2/5] cli: drop inode sort order on directories unknown to\r
+ the database\r
+Date: Fri, 15 Apr 2016 22:29:16 +0300\r
+Message-Id:\r
+ <af16ea8e7b415662343e7f812de219f07b642561.1460748142.git.jani@nikula.org>\r
+X-Mailer: git-send-email 2.1.4\r
+In-Reply-To: <cover.1460748142.git.jani@nikula.org>\r
+References: <cover.1460748142.git.jani@nikula.org>\r
+In-Reply-To: <cover.1460748142.git.jani@nikula.org>\r
+References: <cover.1460748142.git.jani@nikula.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 15 Apr 2016 19:30:54 -0000\r
+\r
+The claim is that inode sort order leads to faster filesystem\r
+operation:\r
+\r
+commit a45ff8c36112a2f17c1ad5c20a16c30a47759797\r
+Author: Stewart Smith <stewart@flamingspork.com>\r
+Date: Wed Nov 18 12:56:40 2009 +1100\r
+\r
+ Read mail directory in inode number order\r
+\r
+The numbers cited seem convincing, but since then we've limited the\r
+inode sorting to directories new to the database. Directories known to\r
+the database are scanned in asciibetical order.\r
+\r
+Making this change helps future work, and having it as a standalone\r
+step makes it easier to evaluate the potential performance impact.\r
+---\r
+ notmuch-new.c | 13 +++----------\r
+ 1 file changed, 3 insertions(+), 10 deletions(-)\r
+\r
+diff --git a/notmuch-new.c b/notmuch-new.c\r
+index 2d975eb5b640..930cbbc9b86f 100644\r
+--- a/notmuch-new.c\r
++++ b/notmuch-new.c\r
+@@ -151,12 +151,6 @@ generic_print_progress (const char *action, const char *object,\r
+ }\r
+ \r
+ static int\r
+-dirent_sort_inode (const struct dirent **a, const struct dirent **b)\r
+-{\r
+- return ((*a)->d_ino < (*b)->d_ino) ? -1 : 1;\r
+-}\r
+-\r
+-static int\r
+ dirent_sort_strcmp_name (const struct dirent **a, const struct dirent **b)\r
+ {\r
+ return strcmp ((*a)->d_name, (*b)->d_name);\r
+@@ -415,11 +409,10 @@ add_files (notmuch_database_t *notmuch,\r
+ }\r
+ \r
+ /* If the database knows about this directory, then we sort based\r
+- * on strcmp to match the database sorting. Otherwise, we can do\r
+- * inode-based sorting for faster filesystem operation. */\r
++ * on strcmp to match the database sorting. */\r
+ num_fs_entries = scandir (path, &fs_entries, 0,\r
+ directory ?\r
+- dirent_sort_strcmp_name : dirent_sort_inode);\r
++ dirent_sort_strcmp_name : NULL);\r
+ \r
+ if (num_fs_entries == -1) {\r
+ fprintf (stderr, "Error opening directory %s: %s\n",\r
+@@ -722,7 +715,7 @@ count_files (const char *path, int *count, add_files_state_t *state)\r
+ struct dirent *entry = NULL;\r
+ char *next;\r
+ struct dirent **fs_entries = NULL;\r
+- int num_fs_entries = scandir (path, &fs_entries, 0, dirent_sort_inode);\r
++ int num_fs_entries = scandir (path, &fs_entries, 0, NULL);\r
+ int entry_type, i;\r
+ \r
+ if (num_fs_entries == -1) {\r
+-- \r
+2.1.4\r
+\r