On Fri, 18 Jul 2014, Rohan Puri wrote: > Date: Fri, 18 Jul 2014 16:16:26 +0530 > From: Rohan Puri <rohan.puri15@xxxxxxxxx> > To: Lukáš Czerner <lczerner@xxxxxxxxxx> > Cc: hch@xxxxxxxxxxxxx, viro@xxxxxxxxxxxxxxxxxx, > Linux FS Devel <linux-fsdevel@xxxxxxxxxxxxxxx> > Subject: Re: [PATCH 2/2] Remove redundant inode mode checks for ceph & ext4 > > On Fri, Jul 18, 2014 at 4:02 PM, Lukáš Czerner <lczerner@xxxxxxxxxx> wrote: > > On Fri, 18 Jul 2014, Rohan Puri wrote: > > > >> Date: Fri, 18 Jul 2014 15:28:38 +0530 > >> From: Rohan Puri <rohan.puri15@xxxxxxxxx> > >> To: hch@xxxxxxxxxxxxx, viro@xxxxxxxxxxxxxxxxxx > >> Cc: linux-fsdevel@xxxxxxxxxxxxxxx > >> Subject: [PATCH 2/2] Remove redundant inode mode checks for ceph & ext4 > >> > >> These checks are not needed here, since they are already performed > >> by do_fallocate() > > > > NAK, they are actually needed because we do not support fallocate on > > directories here. > > > But we never get to file systems for fallocate in directory case, we > either return from open() itself > or do_fallocate() before calling f_ops->fallocate() Yes, but this is future proof for the time that someone adds fallocate support for directories. Let's leave it here, it really does not hurt. Thanks! -Lukas > > -Lukas > > > >> > >> Signed-off-by: Rohan Puri <rohan.puri15@xxxxxxxxx> > >> --- > >> fs/ceph/file.c | 3 --- > >> fs/ext4/inode.c | 3 --- > >> 2 files changed, 6 deletions(-) > >> > >> diff --git a/fs/ceph/file.c b/fs/ceph/file.c > >> index 88a6df4..687a72e 100644 > >> --- a/fs/ceph/file.c > >> +++ b/fs/ceph/file.c > >> @@ -1218,9 +1218,6 @@ static long ceph_fallocate(struct file *file, int mode, > >> loff_t endoff = 0; > >> loff_t size; > >> > >> - if (!S_ISREG(inode->i_mode)) > >> - return -EOPNOTSUPP; > >> - > >> mutex_lock(&inode->i_mutex); > >> > >> if (ceph_snap(inode) != CEPH_NOSNAP) { > >> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c > >> index 7fcd68e..22c9868 100644 > >> --- a/fs/ext4/inode.c > >> +++ b/fs/ext4/inode.c > >> @@ -3532,9 +3532,6 @@ int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length) > >> unsigned int credits; > >> int ret = 0; > >> > >> - if (!S_ISREG(inode->i_mode)) > >> - return -EOPNOTSUPP; > >> - > >> trace_ext4_punch_hole(inode, offset, length, 0); > >> > >> /* > >> >