Page MenuHomeFreeBSD

D45244.id138723.diff
No OneTemporary

D45244.id138723.diff

diff --git a/sys/fs/ext2fs/ext2_vfsops.c b/sys/fs/ext2fs/ext2_vfsops.c
--- a/sys/fs/ext2fs/ext2_vfsops.c
+++ b/sys/fs/ext2fs/ext2_vfsops.c
@@ -1345,7 +1345,7 @@
return (ESTALE);
}
*vpp = nvp;
- vnode_create_vobject(*vpp, 0, curthread);
+ vnode_create_vobject(*vpp, ip->i_size, curthread);
return (0);
}
diff --git a/sys/fs/fuse/fuse_node.c b/sys/fs/fuse/fuse_node.c
--- a/sys/fs/fuse/fuse_node.c
+++ b/sys/fs/fuse/fuse_node.c
@@ -354,7 +354,7 @@
fuse_vnode_open(struct vnode *vp, int32_t fuse_open_flags, struct thread *td)
{
if (vnode_vtype(vp) == VREG)
- vnode_create_vobject(vp, 0, td);
+ vnode_create_vobject(vp, VNODE_NO_SIZE, td);
}
int
diff --git a/sys/fs/fuse/fuse_vfsops.c b/sys/fs/fuse/fuse_vfsops.c
--- a/sys/fs/fuse/fuse_vfsops.c
+++ b/sys/fs/fuse/fuse_vfsops.c
@@ -286,7 +286,7 @@
return (ESTALE);
}
*vpp = nvp;
- vnode_create_vobject(*vpp, 0, curthread);
+ vnode_create_vobject(*vpp, VNODE_NO_SIZE, curthread);
return (0);
}
diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h
--- a/sys/sys/vnode.h
+++ b/sys/sys/vnode.h
@@ -1081,6 +1081,12 @@
vref(vp); \
} while (0)
+/*
+ * The caller doesn't know the file size and vnode_create_vobject() should
+ * determine the size on its own.
+ */
+#define VNODE_NO_SIZE ((off_t)-1)
+
int vnode_create_vobject(struct vnode *vp, off_t size, struct thread *td);
void vnode_destroy_vobject(struct vnode *vp);
diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c
--- a/sys/vm/vnode_pager.c
+++ b/sys/vm/vnode_pager.c
@@ -160,10 +160,10 @@
if (object != NULL)
return (0);
- if (size == 0) {
+ if (isize == 0 || isize == VNODE_NO_SIZE) {
if (vn_isdisk(vp)) {
size = IDX_TO_OFF(INT_MAX);
- } else {
+ } else if (isize == VNODE_NO_SIZE) {
if (vn_getsize_locked(vp, &size, td->td_ucred) != 0)
return (0);
}

File Metadata

Mime Type
text/plain
Expires
Fri, Jan 23, 3:30 PM (9 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27887014
Default Alt Text
D45244.id138723.diff (1 KB)

Event Timeline