Deleted Added
full compact
fuse_vnops.c (292386) fuse_vnops.c (298806)
1/*
2 * Copyright (c) 2007-2009 Google Inc. and Amit Singh
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met:
8 *

--- 40 unchanged lines hidden (view full) ---

49 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
50 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
51 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
52 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
53 * SUCH DAMAGE.
54 */
55
56#include <sys/cdefs.h>
1/*
2 * Copyright (c) 2007-2009 Google Inc. and Amit Singh
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met:
8 *

--- 40 unchanged lines hidden (view full) ---

49 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
50 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
51 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
52 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
53 * SUCH DAMAGE.
54 */
55
56#include <sys/cdefs.h>
57__FBSDID("$FreeBSD: head/sys/fs/fuse/fuse_vnops.c 292386 2015-12-16 23:48:50Z glebius $");
57__FBSDID("$FreeBSD: head/sys/fs/fuse/fuse_vnops.c 298806 2016-04-29 20:51:24Z pfg $");
58
59#include <sys/types.h>
60#include <sys/module.h>
61#include <sys/systm.h>
62#include <sys/errno.h>
63#include <sys/param.h>
64#include <sys/kernel.h>
65#include <sys/conf.h>

--- 956 unchanged lines hidden (view full) ---

1022 * do the access check just after fetching
1023 * the inode and its attributes from the
1024 * daemon? Why bother with producing the
1025 * corresponding vnode at all if something
1026 * is not OK? We know what's the deal as
1027 * soon as we get those attrs... There is
1028 * one bit of info though not given us by
1029 * the daemon: whether his response is
58
59#include <sys/types.h>
60#include <sys/module.h>
61#include <sys/systm.h>
62#include <sys/errno.h>
63#include <sys/param.h>
64#include <sys/kernel.h>
65#include <sys/conf.h>

--- 956 unchanged lines hidden (view full) ---

1022 * do the access check just after fetching
1023 * the inode and its attributes from the
1024 * daemon? Why bother with producing the
1025 * corresponding vnode at all if something
1026 * is not OK? We know what's the deal as
1027 * soon as we get those attrs... There is
1028 * one bit of info though not given us by
1029 * the daemon: whether his response is
1030 * authorative or not... His response should
1030 * authoritative or not... His response should
1031 * be ignored if something is mounted over
1032 * the dir in question. But that can be
1033 * known only by having the vnode...
1034 */
1035 int tmpvtype = vnode_vtype(*vpp);
1036
1037 bzero(&facp, sizeof(facp));
1038 /*the early perm check hack */

--- 730 unchanged lines hidden (view full) ---

1769 */
1770 VM_OBJECT_WLOCK(vp->v_object);
1771 if (pages[npages - 1]->valid != 0 && --npages == 0)
1772 goto out;
1773 VM_OBJECT_WUNLOCK(vp->v_object);
1774
1775 /*
1776 * We use only the kva address for the buffer, but this is extremely
1031 * be ignored if something is mounted over
1032 * the dir in question. But that can be
1033 * known only by having the vnode...
1034 */
1035 int tmpvtype = vnode_vtype(*vpp);
1036
1037 bzero(&facp, sizeof(facp));
1038 /*the early perm check hack */

--- 730 unchanged lines hidden (view full) ---

1769 */
1770 VM_OBJECT_WLOCK(vp->v_object);
1771 if (pages[npages - 1]->valid != 0 && --npages == 0)
1772 goto out;
1773 VM_OBJECT_WUNLOCK(vp->v_object);
1774
1775 /*
1776 * We use only the kva address for the buffer, but this is extremely
1777 * convienient and fast.
1777 * convenient and fast.
1778 */
1779 bp = getpbuf(&fuse_pbuf_freecnt);
1780
1781 kva = (vm_offset_t)bp->b_data;
1782 pmap_qenter(kva, pages, npages);
1783 PCPU_INC(cnt.v_vnodein);
1784 PCPU_ADD(cnt.v_vnodepgsin, npages);
1785

--- 44 unchanged lines hidden (view full) ---

1830 * Read operation filled a partial page.
1831 */
1832 m->valid = 0;
1833 vm_page_set_valid_range(m, 0, size - toff);
1834 KASSERT(m->dirty == 0,
1835 ("fuse_getpages: page %p is dirty", m));
1836 } else {
1837 /*
1778 */
1779 bp = getpbuf(&fuse_pbuf_freecnt);
1780
1781 kva = (vm_offset_t)bp->b_data;
1782 pmap_qenter(kva, pages, npages);
1783 PCPU_INC(cnt.v_vnodein);
1784 PCPU_ADD(cnt.v_vnodepgsin, npages);
1785

--- 44 unchanged lines hidden (view full) ---

1830 * Read operation filled a partial page.
1831 */
1832 m->valid = 0;
1833 vm_page_set_valid_range(m, 0, size - toff);
1834 KASSERT(m->dirty == 0,
1835 ("fuse_getpages: page %p is dirty", m));
1836 } else {
1837 /*
1838 * Read operation was short. If no error occured
1838 * Read operation was short. If no error occurred
1839 * we may have hit a zero-fill section. We simply
1840 * leave valid set to 0.
1841 */
1842 ;
1843 }
1844 }
1845 fuse_vm_page_unlock_queues();
1846out:

--- 56 unchanged lines hidden (view full) ---

1903
1904 if (offset + count > fsize) {
1905 count = fsize - offset;
1906 if (count < 0)
1907 count = 0;
1908 }
1909 /*
1910 * We use only the kva address for the buffer, but this is extremely
1839 * we may have hit a zero-fill section. We simply
1840 * leave valid set to 0.
1841 */
1842 ;
1843 }
1844 }
1845 fuse_vm_page_unlock_queues();
1846out:

--- 56 unchanged lines hidden (view full) ---

1903
1904 if (offset + count > fsize) {
1905 count = fsize - offset;
1906 if (count < 0)
1907 count = 0;
1908 }
1909 /*
1910 * We use only the kva address for the buffer, but this is extremely
1911 * convienient and fast.
1911 * convenient and fast.
1912 */
1913 bp = getpbuf(&fuse_pbuf_freecnt);
1914
1915 kva = (vm_offset_t)bp->b_data;
1916 pmap_qenter(kva, pages, npages);
1917 PCPU_INC(cnt.v_vnodeout);
1918 PCPU_ADD(cnt.v_vnodepgsout, count);
1919

--- 45 unchanged lines hidden ---
1912 */
1913 bp = getpbuf(&fuse_pbuf_freecnt);
1914
1915 kva = (vm_offset_t)bp->b_data;
1916 pmap_qenter(kva, pages, npages);
1917 PCPU_INC(cnt.v_vnodeout);
1918 PCPU_ADD(cnt.v_vnodepgsout, count);
1919

--- 45 unchanged lines hidden ---