From: Christoph Hellwig <hch@infradead.org>
To: npiggin@suse.de
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: Sun, 16 Aug 2009 16:16:26 -0400 [thread overview]
Message-ID: <20090816201626.GA23048@infradead.org> (raw)
In-Reply-To: <20090816102856.846088617@suse.de>
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.
> +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.
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.
next prev parent reply other threads:[~2009-08-16 20:16 UTC|newest]
Thread overview: 21+ 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-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 [this message]
2009-08-17 6:42 ` Nick Piggin
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=20090816201626.GA23048@infradead.org \
--to=hch@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=hch@lst.de \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=npiggin@suse.de \
/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 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).