From: Nick Piggin <npiggin@suse.de>
To: Christoph Hellwig <hch@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,
Christoph Hellwig <hch@lst.de>
Subject: Re: [patch 5/5] ext2: convert to use the new truncate convention.
Date: Mon, 17 Aug 2009 08:42:16 +0200 [thread overview]
Message-ID: <20090817064216.GC9962@wotan.suse.de> (raw)
In-Reply-To: <20090816201626.GA23048@infradead.org>
On Sun, Aug 16, 2009 at 04:16:26PM -0400, Christoph Hellwig wrote:
> On Sun, Aug 16, 2009 at 08:25:38PM +1000, npiggin@suse.de wrote:
> > @@ -66,9 +68,10 @@ void ext2_delete_inode (struct inode * i
> > mark_inode_dirty(inode);
> > ext2_write_inode(inode, inode_needs_sync(inode));
> >
> > + /* XXX: where is truncate_inode_pages? */
> > inode->i_size = 0;
> > if (inode->i_blocks)
> > - ext2_truncate (inode);
> > + ext2_truncate_blocks(inode, 0);
> > ext2_free_inode (inode);
>
> At the beginning of the function, just before the diff window. Because
> this is ->delete_inode we truncate away all pages, down to offset 0.
OK, weird. I thought I couldn't see it when I wrote that :) maybe my
tree was corrupted or I'm stupid.
> > +static void ext2_truncate_blocks(struct inode *inode, loff_t offset)
> > +{
> > + /*
> > + * XXX: it seems like a bug here that we don't allow
> > + * IS_APPEND inode to have blocks-past-i_size trimmed off.
> > + * review and fix this.
> > + */
> > + if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
> > + S_ISLNK(inode->i_mode)))
> > + return -EINVAL;
> > + if (ext2_inode_is_fast_symlink(inode))
> > + return -EINVAL;
> > + if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
> > + return -EPERM;
> > + __ext2_truncate_blocks(inode, offset);
>
> Yes, I think the IS_APPEND(inode) || IS_IMMUTABLE(inode) checks should move
> into ext2_setsize. But let's leave that for a separate patch.
Yeah agreed.
> Btw, the above code gives me warnings like this:
>
> /home/hch/work/linux-2.6/fs/ext2/inode.c: In function
> 'ext2_truncate_blocks':
> /home/hch/work/linux-2.6/fs/ext2/inode.c:1158: warning: 'return' with a
> value, in function returning void
> /home/hch/work/linux-2.6/fs/ext2/inode.c:1160: warning: 'return' with a
> value, in function returning void
> /home/hch/work/linux-2.6/fs/ext2/inode.c:1162: warning: 'return' with a
> value, in function returning void
>
> because you try to return errors from a function delcared as void.
Hm, sorry. I thought it was in good shape... I'll recheck that I sent
out the correct versions and resend according to feedback from you
and Hugh.
Thanks,
Nick
next prev parent reply other threads:[~2009-08-17 6:42 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-16 10:25 [patch 0/5] new truncate sequence npiggin
2009-08-16 10:25 ` [patch 1/5] fs: new truncate helpers npiggin
2009-08-16 10:25 ` [patch 2/5] fs: use " npiggin
2009-08-16 10:25 ` npiggin-l3A5Bk7waGM
2009-08-16 10:25 ` [patch 3/5] fs: introduce new truncate sequence npiggin
2009-08-16 19:39 ` Christoph Hellwig
2009-08-17 6:38 ` Nick Piggin
2009-08-17 16:41 ` Nick Piggin
2009-08-17 18:06 ` Christoph Hellwig
2009-08-18 9:19 ` Nick Piggin
2009-08-16 10:25 ` [patch 4/5] tmpfs: convert to use the new truncate convention npiggin
2009-08-16 18:38 ` Hugh Dickins
2009-08-17 7:32 ` Nick Piggin
2009-08-16 10:25 ` [patch 5/5] ext2: " npiggin
2009-08-16 20:16 ` Christoph Hellwig
2009-08-17 6:42 ` Nick Piggin [this message]
2009-08-17 11:09 ` Boaz Harrosh
2009-08-17 16:44 ` Nick Piggin
-- strict thread matches above, loose matches on Subject: below --
2009-07-10 7:30 [patch 0/5] new truncate sequence patchset npiggin
2009-07-10 7:30 ` [patch 5/5] ext2: convert to use the new truncate convention npiggin
2009-09-01 18:29 ` Jan Kara
2009-09-02 9:14 ` Nick Piggin
2009-09-02 11:14 ` Jan Kara
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=20090817064216.GC9962@wotan.suse.de \
--to=npiggin@suse.de \
--cc=akpm@linux-foundation.org \
--cc=hch@infradead.org \
--cc=hch@lst.de \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.