Date: Sun, 26 Jun 2011 09:48:01 GMT From: Ilya Putsikau <ilya@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 195348 for review Message-ID: <201106260948.p5Q9m1xc010820@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@195348?ac=10 Change 195348 by ilya@ilya_triton2011 on 2011/06/26 09:47:02 Resync size in vnop_getattr(). Invalidate attr cache after resize in vnop_setattr(). Remove unused node->newfilesize. Merge http://macfuse.googlecode.com/svn/trunk@89 Merge http://macfuse.googlecode.com/svn/trunk@149 Partially merge http://macfuse.googlecode.com/svn/trunk@147 Affected files ... .. //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_node.h#8 edit .. //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_vnops.c#21 edit Differences ... ==== //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_node.h#8 (text+ko) ==== @@ -42,7 +42,6 @@ struct sx truncatelock; off_t filesize; - off_t newfilesize; struct fuse_filehandle fufh[3]; ==== //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_vnops.c#21 (text+ko) ==== @@ -474,6 +474,20 @@ memcpy(vap, VTOVA(vp), sizeof(*vap)); } + if (vnode_isreg(vp)) { + /* + * This is for those cases when the file size changed without us + * knowing, and we want to catch up. + */ + struct fuse_vnode_data *fvdat = VTOFUD(vp); + off_t new_filesize = ((struct fuse_attr_out *)fdi.answ)->attr.size; + + if (fvdat->filesize != new_filesize) { + fvdat->filesize = new_filesize; + vnode_pager_setsize(vp, new_filesize); + } + } + fuse_ticket_drop(fdi.tick); if (vnode_vtype(vp) != vap->va_type) { @@ -1681,13 +1695,15 @@ } } - cache_attrs(vp, (struct fuse_attr_out *)fdi.answ); + if (!err && !sizechanged) { + cache_attrs(vp, (struct fuse_attr_out *)fdi.answ); + } out: fuse_ticket_drop(fdi.tick); if (!err && sizechanged) { + fuse_invalidate_attr(vp); VTOFUD(vp)->filesize = newsize; - VTOFUD(vp)->newfilesize = newsize; vnode_pager_setsize(vp, newsize); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201106260948.p5Q9m1xc010820>