LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Kari Argillander <kari.argillander@gmail.com>
Cc: viro@zeniv.linux.org.uk,
Konstantin Komarov <almaz.alexandrovich@paragon-software.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
dsterba@suse.cz, aaptel@suse.com, willy@infradead.org,
rdunlap@infradead.org, joe@perches.com, mark@harmstone.com,
nborisov@suse.com, linux-ntfs-dev@lists.sourceforge.net,
anton@tuxera.com, dan.carpenter@oracle.com, hch@lst.de,
ebiggers@kernel.org, andy.lavr@gmail.com,
oleksandr@natalenko.name
Subject: Re: [PATCH v27 04/10] fs/ntfs3: Add file operations and implementation
Date: Tue, 24 Aug 2021 13:33:04 +0200 [thread overview]
Message-ID: <20210824113304.eabzy7ulbuouzlac@pali> (raw)
In-Reply-To: <20210822143133.4meiisx2tbfgrz5l@kari-VirtualBox>
On Sunday 22 August 2021 17:31:33 Kari Argillander wrote:
> On Sun, Aug 22, 2021 at 02:20:03PM +0200, Pali Rohár wrote:
> > On Thursday 29 July 2021 16:49:37 Konstantin Komarov wrote:
> > > diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
> > > new file mode 100644
> > > index 000000000..b4369c61a
> > > --- /dev/null
> > > +++ b/fs/ntfs3/file.c
> > > @@ -0,0 +1,1130 @@
> > > +// SPDX-License-Identifier: GPL-2.0
> > > +/*
> > > + *
> > > + * Copyright (C) 2019-2021 Paragon Software GmbH, All rights reserved.
> > > + *
> > > + * regular file handling primitives for ntfs-based filesystems
> > > + */
> > > +#include <linux/backing-dev.h>
> > > +#include <linux/buffer_head.h>
> > > +#include <linux/compat.h>
> > > +#include <linux/falloc.h>
> > > +#include <linux/fiemap.h>
> > > +#include <linux/msdos_fs.h> /* FAT_IOCTL_XXX */
> > > +#include <linux/nls.h>
> > > +
> > > +#include "debug.h"
> > > +#include "ntfs.h"
> > > +#include "ntfs_fs.h"
> > > +
> > > +static int ntfs_ioctl_fitrim(struct ntfs_sb_info *sbi, unsigned long arg)
> > > +{
> > > + struct fstrim_range __user *user_range;
> > > + struct fstrim_range range;
> > > + struct request_queue *q = bdev_get_queue(sbi->sb->s_bdev);
> > > + int err;
> > > +
> > > + if (!capable(CAP_SYS_ADMIN))
> > > + return -EPERM;
> > > +
> > > + if (!blk_queue_discard(q))
> > > + return -EOPNOTSUPP;
> > > +
> > > + user_range = (struct fstrim_range __user *)arg;
> > > + if (copy_from_user(&range, user_range, sizeof(range)))
> > > + return -EFAULT;
> > > +
> > > + range.minlen = max_t(u32, range.minlen, q->limits.discard_granularity);
> > > +
> > > + err = ntfs_trim_fs(sbi, &range);
> > > + if (err < 0)
> > > + return err;
> > > +
> > > + if (copy_to_user(user_range, &range, sizeof(range)))
> > > + return -EFAULT;
> > > +
> > > + return 0;
> > > +}
> > > +
> > > +static long ntfs_ioctl(struct file *filp, u32 cmd, unsigned long arg)
> > > +{
> > > + struct inode *inode = file_inode(filp);
> > > + struct ntfs_sb_info *sbi = inode->i_sb->s_fs_info;
> > > + u32 __user *user_attr = (u32 __user *)arg;
> > > +
> > > + switch (cmd) {
> > > + case FAT_IOCTL_GET_ATTRIBUTES:
> > > + return put_user(le32_to_cpu(ntfs_i(inode)->std_fa), user_attr);
> > > +
> > > + case FAT_IOCTL_GET_VOLUME_ID:
> > > + return put_user(sbi->volume.ser_num, user_attr);
> > > +
> > > + case FITRIM:
> > > + return ntfs_ioctl_fitrim(sbi, arg);
> > > + }
> > > + return -ENOTTY; /* Inappropriate ioctl for device */
> > > +}
> >
> > Hello! What with these two FAT_* ioctls in NTFS code? Should NTFS driver
> > really implements FAT ioctls? Because they looks like some legacy API
> > which is even not implemented by current ntfs.ko driver.
>
> I was looking same thing when doing new ioctl for shutdown. These
> should be dropped completly before this gets upstream. Then we have
> more time to think what ioctl calls should used and which are
> necessarry.
Ok. I agree, these FAT* ioctls should not be included into upstream in
this way. Later we can decide how to handle them...
> > Specially, should FS driver implements ioctl for get volume id which in
> > this way? Because basically every fs have some kind of uuid / volume id
> > and they can be already retrieved by appropriate userspace tool.
>
> My first impression when looking this code was that this is just copy
> paste work from fat driver. FITRIM is exactly the same. Whoever
> copyed it must have not thinked this very closly. Good thing you
> bringing this up.
>
> I didn't want to just yet because there is quite lot messages and
> things which are in Komarov todo list. Hopefully radio silence will
> end soon. I'm afraid next message will be "Please pull" for Linus
> and then it cannot happend because of radio silence.
>
next prev parent reply other threads:[~2021-08-24 11:33 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-29 13:49 [PATCH v27 00/10] NTFS read-write driver GPL implementation by Paragon Software Konstantin Komarov
2021-07-29 13:49 ` [PATCH v27 01/10] fs/ntfs3: Add headers and misc files Konstantin Komarov
2021-07-29 13:49 ` [PATCH v27 02/10] fs/ntfs3: Add initialization of super block Konstantin Komarov
2021-07-29 15:59 ` Matthew Wilcox
2021-07-30 8:28 ` Christophe JAILLET
2021-08-10 9:02 ` Christoph Hellwig
2021-07-29 13:49 ` [PATCH v27 03/10] fs/ntfs3: Add bitmap Konstantin Komarov
2021-07-30 8:11 ` Christophe JAILLET
2021-07-29 13:49 ` [PATCH v27 04/10] fs/ntfs3: Add file operations and implementation Konstantin Komarov
2021-07-30 7:40 ` Christophe JAILLET
2021-08-22 12:20 ` Pali Rohár
2021-08-22 14:31 ` Kari Argillander
2021-08-24 11:33 ` Pali Rohár [this message]
2021-07-29 13:49 ` [PATCH v27 05/10] fs/ntfs3: Add attrib operations Konstantin Komarov
2021-07-30 7:30 ` Christophe JAILLET
2021-07-29 13:49 ` [PATCH v27 06/10] fs/ntfs3: Add compression Konstantin Komarov
2021-07-29 13:49 ` [PATCH v27 07/10] fs/ntfs3: Add NTFS journal Konstantin Komarov
2021-07-30 8:06 ` Christophe JAILLET
2021-07-29 13:49 ` [PATCH v27 08/10] fs/ntfs3: Add Kconfig, Makefile and doc Konstantin Komarov
2021-08-10 7:47 ` Kari Argillander
2021-08-10 8:19 ` Pali Rohár
2021-08-10 8:46 ` Kari Argillander
2021-07-29 13:49 ` [PATCH v27 09/10] fs/ntfs3: Add NTFS3 in fs/Kconfig and fs/Makefile Konstantin Komarov
2021-07-29 13:49 ` [PATCH v27 10/10] fs/ntfs3: Add MAINTAINERS Konstantin Komarov
2021-08-09 10:56 ` David Sterba
2021-08-09 16:16 ` Konstantin Komarov
2021-08-09 16:44 ` Kari Argillander
2021-08-09 16:54 ` Randy Dunlap
2021-08-09 18:56 ` Dan Williams
2021-08-09 19:45 ` Kari Argillander
2021-07-29 16:24 ` [PATCH v27 00/10] NTFS read-write driver GPL implementation by Paragon Software Darrick J. Wong
2021-08-02 3:23 ` Theodore Ts'o
2021-08-02 15:05 ` Theodore Ts'o
2021-08-12 17:03 ` Kari Argillander
2021-08-13 15:53 ` Kari Argillander
2021-08-21 12:38 ` Yan Pashkovsky
2021-08-03 11:57 ` [PATCH] Restyle comments to better align with kernel-doc Kari Argillander
2021-08-03 13:38 ` Dan Carpenter
2021-08-03 15:26 ` Kari Argillander
2021-08-03 15:41 ` Matthew Wilcox
2021-08-30 16:10 ` Konstantin Komarov
2021-08-30 17:13 ` Kari Argillander
2021-08-10 5:46 ` [PATCH v27 00/10] NTFS read-write driver GPL implementation by Paragon Software Kari Argillander
2021-08-10 6:47 ` Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210824113304.eabzy7ulbuouzlac@pali \
--to=pali@kernel.org \
--cc=aaptel@suse.com \
--cc=almaz.alexandrovich@paragon-software.com \
--cc=andy.lavr@gmail.com \
--cc=anton@tuxera.com \
--cc=dan.carpenter@oracle.com \
--cc=dsterba@suse.cz \
--cc=ebiggers@kernel.org \
--cc=hch@lst.de \
--cc=joe@perches.com \
--cc=kari.argillander@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-ntfs-dev@lists.sourceforge.net \
--cc=mark@harmstone.com \
--cc=nborisov@suse.com \
--cc=oleksandr@natalenko.name \
--cc=rdunlap@infradead.org \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.org \
--subject='Re: [PATCH v27 04/10] fs/ntfs3: Add file operations and implementation' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).