[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090816201626.GA23048@infradead.org>
Date: Sun, 16 Aug 2009 16:16:26 -0400
From: Christoph Hellwig <hch@...radead.org>
To: npiggin@...e.de
Cc: Andrew Morton <akpm@...ux-foundation.org>,
linux-fsdevel@...r.kernel.org, linux-ext4@...r.kernel.org,
Christoph Hellwig <hch@....de>
Subject: Re: [patch 5/5] ext2: convert to use the new truncate convention.
On Sun, Aug 16, 2009 at 08:25:38PM +1000, npiggin@...e.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.
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists