FBSD, DFBSD (future) vnode_pager_setsize updates

Based on review of bundled filesystems on FBSD and DFBSD,
call vnode_pager_setsize in three unhandled cases (getattr,
setattr, and io growing a file;  truncation was handled
correctly already).  Following up on a suggestion by Ben
Kaduk.

Change-Id: I05b61c26402bb8ab49ad74b71af2d02b439f959f
Reviewed-on: http://gerrit.openafs.org/2621
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
Matt Benjamin 2010-08-28 20:43:41 -04:00 committed by Derrick Brashear
parent 2974037059
commit 8334b40376
3 changed files with 26 additions and 0 deletions

View File

@ -723,9 +723,11 @@ afs_vop_getattr(ap)
* } */ *ap;
{
int code;
AFS_GLOCK();
code = afs_getattr(VTOAFS(ap->a_vp), ap->a_vap, ap->a_cred);
AFS_GUNLOCK();
return code;
}

View File

@ -45,6 +45,9 @@ afs_CopyOutAttrs(struct vcache *avc, struct vattr *attrs)
{
struct volume *tvp;
struct cell *tcell;
#if defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV)
struct vnode *vp = AFSTOV(avc);
#endif
int fakedir = 0;
AFS_STATCNT(afs_CopyOutAttrs);
@ -115,6 +118,9 @@ afs_CopyOutAttrs(struct vcache *avc, struct vattr *attrs)
attrs->va_nodeid &= 0x7fffffff; /* Saber C hates negative inode #s! */
attrs->va_nlink = fakedir ? 100 : avc->f.m.LinkCount;
attrs->va_size = fakedir ? 4096 : avc->f.m.Length;
#if defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV)
vnode_pager_setsize(vp, (u_long) attrs->va_size);
#endif
attrs->va_atime.tv_sec = attrs->va_mtime.tv_sec = attrs->va_ctime.tv_sec =
fakedir ? 0 : (int)avc->f.m.Date;
/* set microseconds to be dataversion # so that we approximate NFS-style
@ -445,6 +451,9 @@ afs_setattr(OSI_VC_DECL(avc), struct vattr *attrs,
struct vrequest treq;
struct AFSStoreStatus astat;
afs_int32 code;
#if defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV)
struct vnode *vp = AFSTOV(avc);
#endif
struct afs_fakestat_state fakestate;
OSI_VC_CONVERT(avc);
@ -553,6 +562,9 @@ afs_setattr(OSI_VC_DECL(avc), struct vattr *attrs,
* pdflush */
if (code == 0)
i_size_write(AFSTOV(avc), tsize);
#endif
#if defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV)
vnode_pager_setsize(vp, (u_long) tsize);
#endif
/* if date not explicitly set by this call, set it ourselves, since we
* changed the data */

View File

@ -110,6 +110,9 @@ afs_MemWrite(struct vcache *avc, struct uio *auio, int aio,
volatile
#endif
afs_int32 error;
#if defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV)
struct vnode *vp = AFSTOV(avc);
#endif
#ifdef AFS_DARWIN80_ENV
uio_t tuiop = NULL;
#else
@ -268,6 +271,9 @@ afs_MemWrite(struct vcache *avc, struct uio *auio, int aio,
ICL_HANDLE_OFFSET(avc->f.m.Length), ICL_TYPE_OFFSET,
ICL_HANDLE_OFFSET(filePos));
avc->f.m.Length = filePos;
#if defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV)
vnode_pager_setsize(vp, filePos);
#endif
}
#endif
ReleaseWriteLock(&tdc->lock);
@ -321,6 +327,9 @@ afs_UFSWrite(struct vcache *avc, struct uio *auio, int aio,
volatile
#endif
afs_int32 error;
#if defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV)
struct vnode *vp = AFSTOV(avc);
#endif
#ifdef AFS_DARWIN80_ENV
uio_t tuiop = NULL;
#else
@ -570,6 +579,9 @@ afs_UFSWrite(struct vcache *avc, struct uio *auio, int aio,
ICL_HANDLE_OFFSET(avc->f.m.Length), ICL_TYPE_OFFSET,
ICL_HANDLE_OFFSET(filePos));
avc->f.m.Length = filePos;
#if defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV)
vnode_pager_setsize(vp, filePos);
#endif
}
#endif
osi_UFSClose(tfile);