Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753223AbdF2Mv5 (ORCPT ); Thu, 29 Jun 2017 08:51:57 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:41314 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752755AbdF2Mvo (ORCPT ); Thu, 29 Jun 2017 08:51:44 -0400 Date: Thu, 29 Jun 2017 14:51:41 +0200 From: Greg KH To: Shaohua Li Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, tj@kernel.org, hch@lst.de, axboe@fb.com, rostedt@goodmis.org, lizefan@huawei.com, Kernel-team@fb.com, Shaohua Li Subject: Re: [PATCH V4 02/12] kernfs: implement i_generation Message-ID: <20170629125141.GG26046@kroah.com> References: <327539f91326b971b9071d518a32435f41013550.1498666964.git.shli@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <327539f91326b971b9071d518a32435f41013550.1498666964.git.shli@fb.com> User-Agent: Mutt/1.8.3 (2017-05-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1063 Lines: 20 On Wed, Jun 28, 2017 at 09:29:52AM -0700, Shaohua Li wrote: > From: Shaohua Li > > Set i_generation for kernfs inode. This is required to implement > exportfs operations. The generation is 32-bit, so it's possible the > generation wraps up and we find stale files. To reduce the posssibility, > we don't reuse inode numer immediately. When the inode number allocation > wraps, we increase generation number. In this way generation/inode > number consist of a 64-bit number which is unlikely duplicated. This > does make the idr tree more sparse and waste some memory. Since idr > manages 32-bit keys, idr uses a 6-level radix tree, each level covers 6 > bits of the key. In a 100k inode kernfs, the worst case will have around > 300k radix tree node. Each node is 576bytes, so the tree will use about > ~150M memory. Sounds not too bad, if this really is a problem, we should > find better data structure. > > Acked-by: Tejun Heo > Signed-off-by: Shaohua Li Acked-by: Greg Kroah-Hartman