From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752835AbbF1U7h (ORCPT ); Sun, 28 Jun 2015 16:59:37 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:53734 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752567AbbF1U73 (ORCPT ); Sun, 28 Jun 2015 16:59:29 -0400 Date: Sun, 28 Jun 2015 21:59:25 +0100 From: Al Viro To: Linus Torvalds Cc: Mikulas Patocka , "Ted Ts'o" , Linux Kernel Mailing List , linux-fsdevel Subject: Re: [PATCH] hpfs: add fstrim support Message-ID: <20150628205925.GX17109@ZenIV.linux.org.uk> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jun 28, 2015 at 12:52:11PM -0700, Linus Torvalds wrote: > On Sun, Jun 28, 2015 at 6:16 AM, Mikulas Patocka wrote: > > This patch adds support for fstrim to the HPFS filesystem. > ... > > +#ifdef CONFIG_COMPAT > > + .compat_ioctl = hpfs_compat_ioctl, > > +#endif > ... > > +#ifdef CONFIG_COMPAT > > + .compat_ioctl = hpfs_compat_ioctl, > > +#endif > ... > > +#ifdef CONFIG_COMPAT > > +long hpfs_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg) > > +{ > > + return hpfs_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); > > +} > > +#endif > > Hmm. You've clearly copied this pattern from other filesystems, and so > I can't really blame you, but this thing annoys me a lot. > > Why isn't FITRIM just marked as a COMPATIBLE_IOCTL(), at which point > the generic ioctl layer will do exactly the above translation for us? > > Am I missing something? More to the point, why bother with ->ioctl() at all? Why not make ->fitrim() a super_block method and let do_vfs_ioctl() handle all marshalling? As in (int *)fitrim(struct super_block *, struct fstrim_range *); guaranteed to be called only on a filesystem kept active by caller...