Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/rump/librump/rumpvfs adjust inode size too if VOP_SETATT...
details: https://anonhg.NetBSD.org/src/rev/970860b4da09
branches: trunk
changeset: 761610:970860b4da09
user: pooka <pooka%NetBSD.org@localhost>
date: Wed Feb 02 14:41:55 2011 +0000
description:
adjust inode size too if VOP_SETATTR changes size
diffstat:
sys/rump/librump/rumpvfs/rumpfs.c | 24 ++++++++++++++++++++----
1 files changed, 20 insertions(+), 4 deletions(-)
diffs (45 lines):
diff -r e133975adc07 -r 970860b4da09 sys/rump/librump/rumpvfs/rumpfs.c
--- a/sys/rump/librump/rumpvfs/rumpfs.c Wed Feb 02 12:26:42 2011 +0000
+++ b/sys/rump/librump/rumpvfs/rumpfs.c Wed Feb 02 14:41:55 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpfs.c,v 1.89 2011/01/14 11:07:42 pooka Exp $ */
+/* $NetBSD: rumpfs.c,v 1.90 2011/02/02 14:41:55 pooka Exp $ */
/*
* Copyright (c) 2009, 2010 Antti Kantee. All Rights Reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.89 2011/01/14 11:07:42 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.90 2011/02/02 14:41:55 pooka Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -855,8 +855,24 @@
SETIFVAL(va_flags, u_long);
#undef SETIFVAL
- if (vp->v_type == VREG && vap->va_size != VSIZENOTSET)
- uvm_vnp_setsize(vp, vap->va_size);
+ if (vp->v_type == VREG &&
+ vap->va_size != VSIZENOTSET &&
+ vap->va_size != rn->rn_dlen) {
+ void *newdata;
+ size_t copylen, newlen;
+
+ newlen = vap->va_size;
+ newdata = rump_hypermalloc(newlen, 0, true, "rumpfs");
+
+ copylen = MIN(rn->rn_dlen, newlen);
+ memset(newdata, 0, newlen);
+ memcpy(newdata, rn->rn_data, copylen);
+ rump_hyperfree(rn->rn_data, rn->rn_dlen);
+
+ rn->rn_data = newdata;
+ rn->rn_dlen = newlen;
+ uvm_vnp_setsize(vp, newlen);
+ }
return 0;
}
Home |
Main Index |
Thread Index |
Old Index