From owner-freebsd-fs@FreeBSD.ORG Fri Jan 17 02:07:27 2014 Return-Path: Delivered-To: fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D3F41F2B; Fri, 17 Jan 2014 02:07:27 +0000 (UTC) Received: from chez.mckusick.com (chez.mckusick.com [IPv6:2001:5a8:4:7e72:4a5b:39ff:fe12:452]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B45E21F87; Fri, 17 Jan 2014 02:07:27 +0000 (UTC) Received: from chez.mckusick.com (localhost [127.0.0.1]) by chez.mckusick.com (8.14.3/8.14.3) with ESMTP id s0H27NeY032950; Thu, 16 Jan 2014 18:07:23 -0800 (PST) (envelope-from mckusick@chez.mckusick.com) Message-Id: <201401170207.s0H27NeY032950@chez.mckusick.com> To: Pedro Giffuni Subject: Re: issues Ext4 inode flags In-reply-to: <52D80961.2040102@FreeBSD.org> Date: Thu, 16 Jan 2014 18:07:23 -0800 From: Kirk McKusick Cc: fs@freebsd.org X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jan 2014 02:07:27 -0000 > Date: Thu, 16 Jan 2014 11:31:29 -0500 > From: Pedro Giffuni > To: fs@freebsd.org > Subject: issues Ext4 inode flags > > Hello; > > I have been working around some issues in our ext2/3/4 support and > there is this problem: > > Before r260545 we were passing the Ext2/3/4 flags with some > conversion into the inode i_flags. Since our system flags don't > match the linux flags this actually introduced a lot of garbage. > > r260545 cut the garbage completely but it also does not pass > the EXT4 flags of which we need two for our ext4 ro implementation: > EXT4_EXTENTS and EXT4_INDEX. We also use EXT4_HUGE_FILE > but we can read that directly from the dinode. > > The flags are pretty specific to Ext4 so it doesn't make sense to add > them to to our stat.h and include them in the inode conversion routines. > > I have two options: > > 1- Pass only the flags that we need and clear the rest. > Obviously a hack, this seems this is somewhat safer and has > worked so far as it only applies to the read-only ext4. There is > still some space for collision: > EXT4_INDEX --> UF_READONLY > EXT4_EXTENTS --> UF_HIDDEN > > The patch is here: > http://people.freebsd.org/~pfg/patches/ext2fs/ext2fs-passinode.patch > > 2- Create a field in the inode specifically to carry the Ext4_* inode flags. > This. of course, costs memory for a feature that is rarely used but > is cleaner and may be useful if we ever add write support. > > The proof-of-concept patch is here: > http://people.freebsd.org/~pfg/patches/ext2fs/ext2fs-inode.patch > > I am inclining towards option (1): it's rather hackish but it > just works and I don't forsee us doing much efforts to support > ext4 much better in the future. > > Both patches re-enable dirindex for testing purposes. > Comments and testing are welcome. > > Pedro. Given your belief that write support for ext4 is unlikely, I agree with your option 1 preference. However, if write support is to be added for ext4, then I think that option 2 would be better. In theory, it is possible to migrate to option 2 later if/when write support is added assuming you have a version number that you can bump. Kirk McKusick