From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bob Copeland Subject: Re: readdir on hash filesystems Date: Thu, 22 Sep 2005 14:09:10 -0400 Message-ID: References: <17201.49432.28348.486601@gargle.gargle.HOWL> Reply-To: Bob Copeland Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT Cc: linux-fsdevel@vger.kernel.org Return-path: Received: from xproxy.gmail.com ([66.249.82.199]:15210 "EHLO xproxy.gmail.com") by vger.kernel.org with ESMTP id S1750938AbVIVSJL convert rfc822-to-8bit (ORCPT ); Thu, 22 Sep 2005 14:09:11 -0400 Received: by xproxy.gmail.com with SMTP id s14so496856wxc for ; Thu, 22 Sep 2005 11:09:10 -0700 (PDT) To: Nikita Danilov In-Reply-To: <17201.49432.28348.486601@gargle.gargle.HOWL> Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org > > have any idea which node I want along the hash chain without counting > > up f_pos nodes in the tree. > > One possible solution is to use lower 24 bits of f_pos to store an index > within given hash chain, and next 8 bits to store index of hash chain: > > int hchain = file->f_pos >> 24 & 0xff; > int hindex = file->f_pos & 0xffffff; Good idea, this works much better. In practice the chains are five or six files long, so a few seeks on entry to readdir is not too bad, considering. Thanks, Bob