Re: [rfc][patch 3/3] fs: convert ext2,tmpfs to new truncate

From: Nick Piggin
Date: Tue Jul 07 2009 - 09:30:46 EST


On Tue, Jul 07, 2009 at 02:45:29PM +0300, Boaz Harrosh wrote:
> On 07/06/2009 07:56 PM, Nick Piggin wrote:
> > Convert filemap_xip.c, buffer.c, and some filesystems to the new truncate
> > convention. Converting generic helpers is using some ugly code (testing
> > for i_op->ftruncate) to distinguish new and old callers... better
> > alternative might be just define a new function for these guys.
> > @@ -770,13 +793,22 @@ ext2_nobh_write_begin(struct file *file,
> > loff_t pos, unsigned len, unsigned flags,
> > struct page **pagep, void **fsdata)
> > {
> > + int ret;
> > +
> > /*
> > * Dir-in-pagecache still uses ext2_write_begin. Would have to rework
> > * directory handling code to pass around offsets rather than struct
> > * pages in order to make this work easily.
> > */
> > - return nobh_write_begin(file, mapping, pos, len, flags, pagep, fsdata,
> > + ret = nobh_write_begin(file, mapping, pos, len, flags, pagep, fsdata,
> > ext2_get_block);
> > + if (ret < 0) {
> > + loff_t isize;
> > + isize = i_size_read(inode);
>
> Unlike the other places you use i_size_read() here, please explain what is the
> locking rules for this?
>
> Did your patchset change things in this regard?

i_mutex should protect i_size. I was doing a bit of cutting and pasting
so it probably isn't perfect. I'll double check.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/