From mboxrd@z Thu Jan 1 00:00:00 1970 From: Linus Torvalds Subject: Re: [PATCH 1/6 v7] vfs: add i_op->open() Date: Tue, 22 Mar 2011 11:37:06 -0700 Message-ID: References: <20110322152602.053930811@szeredi.hu> <20110322153014.560003169@szeredi.hu> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, apw@canonical.com, nbd@openwrt.org, neilb@suse.de To: Miklos Szeredi Return-path: Received: from smtp1.linux-foundation.org ([140.211.169.13]:51247 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754281Ab1CVSh1 convert rfc822-to-8bit (ORCPT ); Tue, 22 Mar 2011 14:37:27 -0400 In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Tue, Mar 22, 2011 at 11:12 AM, Miklos Szeredi wr= ote: >> >> Why don't you just pass in the filp to the ->open routine, and drop >> that "flags" argument. Maybe other filesystems want to use ->open, b= ut >> don't want to put_filp() on the filp we already allocated, only to >> allocate a new one? > > Maybe, although I don't see the reason to do that. =A0Why keep the > original one? =A0It doesn't contain any information besides the flags > and the dentry/vfsmount. Umm? Because that way you can avoid allocating a new one? So let's turn your questions on its head: why do you insist on free'ing the old one, WHEN YOU KNOW THAT THE ->open ROUTINE NEEDS TO ALLOCATE A NEW ONE? Sure, in _your_ case, you'll get a new filp because you're going to do a whole new open of a lower-level filesystem, but if the ->open routine is all about just your case, then I don't want it as a VFS layer operation. So for your filesystem, you will always discard the old one as useless. But that's purely an implementation detail for you. It has nothing to do with the VFS interfaces. So why do that idiotic free, only to force the callee to then re-allocate a new "struct file"? Linus -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html