Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759473AbbEEQIn (ORCPT ); Tue, 5 May 2015 12:08:43 -0400 Received: from mail-ig0-f178.google.com ([209.85.213.178]:36565 "EHLO mail-ig0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2993290AbbEEPBx (ORCPT ); Tue, 5 May 2015 11:01:53 -0400 MIME-Version: 1.0 In-Reply-To: <1430803373-4948-4-git-send-email-viro@ZenIV.linux.org.uk> References: <20150505052205.GS889@ZenIV.linux.org.uk> <1430803373-4948-4-git-send-email-viro@ZenIV.linux.org.uk> Date: Tue, 5 May 2015 08:01:52 -0700 X-Google-Sender-Auth: NB5NulfSPgP7sgTWmoS_6foopb4 Message-ID: Subject: Re: [PATCH 04/79] ext4: split inode_operations for encrypted symlinks off the rest From: Linus Torvalds To: Al Viro Cc: Neil Brown , Christoph Hellwig , Linux Kernel Mailing List , linux-fsdevel Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1681 Lines: 36 On Mon, May 4, 2015 at 10:21 PM, Al Viro wrote: > } else if (S_ISLNK(inode->i_mode)) { > - if (ext4_inode_is_fast_symlink(inode) && > - !ext4_encrypted_inode(inode)) { > + if (ext4_encrypted_inode(inode)) { > +#ifdef CONFIG_EXT4_FS_ENCRYPTION > + inode->i_op = &ext4_encrypted_symlink_inode_operations; > + ext4_set_aops(inode); > +#else > + BUILD_BUG(); > +#endif > + } else if (ext4_inode_is_fast_symlink(inode)) { > inode->i_op = &ext4_fast_symlink_inode_operations; > nd_terminate_link(ei->i_data, inode->i_size, > sizeof(ei->i_data) - 1); Ugh. Could we aim to *not* add code like this. Instead, just declare (but don't define) the ext4_encrypted_symlink_inode_operations thing, so that *if* somebody uses it they get a link error, and make sure that "ext4_encrypted_inode()" ends up always returning zero when encryption isn't enabled, so that the compiler will actually optimize the whole thing out (which apparently is already the case, judging by the build-bug-on. I really prefer to not see #ifdef's inside the middle of anything but trivial helper functions. I know we have them, and I wish we didn't, but at least we can aim to not add more of them. Linus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/