From owner-svn-src-stable-9@FreeBSD.ORG Sat Oct 4 17:49:37 2014 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C63A4CB8; Sat, 4 Oct 2014 17:49:37 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 97CAFF39; Sat, 4 Oct 2014 17:49:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s94Hnbqs077790; Sat, 4 Oct 2014 17:49:37 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s94Hnbb2077789; Sat, 4 Oct 2014 17:49:37 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201410041749.s94Hnbb2077789@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 4 Oct 2014 17:49:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r272532 - stable/9/sys/fs/ext2fs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Oct 2014 17:49:37 -0000 Author: pfg Date: Sat Oct 4 17:49:36 2014 New Revision: 272532 URL: https://svnweb.freebsd.org/changeset/base/272532 Log: MFC r271467, r271468: ext2fs: add ext2_getpages(). Literally copy/pasted from ffs_getpages(). Tested with: fsx Modified: stable/9/sys/fs/ext2fs/ext2_vnops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/ext2fs/ext2_vnops.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_vnops.c Sat Oct 4 17:46:04 2014 (r272531) +++ stable/9/sys/fs/ext2fs/ext2_vnops.c Sat Oct 4 17:49:36 2014 (r272532) @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include @@ -65,9 +66,11 @@ #include #include -#include -#include +#include #include +#include +#include +#include #include #include "opt_directio.h" @@ -96,6 +99,7 @@ static int ext2_chown(struct vnode *, ui static vop_close_t ext2_close; static vop_create_t ext2_create; static vop_fsync_t ext2_fsync; +static vop_getpages_t ext2_getpages; static vop_getattr_t ext2_getattr; static vop_ioctl_t ext2_ioctl; static vop_link_t ext2_link; @@ -126,6 +130,7 @@ struct vop_vector ext2_vnodeops = { .vop_close = ext2_close, .vop_create = ext2_create, .vop_fsync = ext2_fsync, + .vop_getpages = ext2_getpages, .vop_getattr = ext2_getattr, .vop_inactive = ext2_inactive, .vop_ioctl = ext2_ioctl, @@ -2067,3 +2072,43 @@ ext2_write(struct vop_write_args *ap) } return (error); } + +/* + * get page routine + */ +static int +ext2_getpages(struct vop_getpages_args *ap) +{ + int i; + vm_page_t mreq; + int pcount; + + pcount = round_page(ap->a_count) / PAGE_SIZE; + mreq = ap->a_m[ap->a_reqpage]; + + /* + * if ANY DEV_BSIZE blocks are valid on a large filesystem block, + * then the entire page is valid. Since the page may be mapped, + * user programs might reference data beyond the actual end of file + * occuring within the page. We have to zero that data. + */ + VM_OBJECT_WLOCK(mreq->object); + if (mreq->valid) { + if (mreq->valid != VM_PAGE_BITS_ALL) + vm_page_zero_invalid(mreq, TRUE); + for (i = 0; i < pcount; i++) { + if (i != ap->a_reqpage) { + vm_page_lock(ap->a_m[i]); + vm_page_free(ap->a_m[i]); + vm_page_unlock(ap->a_m[i]); + } + } + VM_OBJECT_WUNLOCK(mreq->object); + return VM_PAGER_OK; + } + VM_OBJECT_WUNLOCK(mreq->object); + + return vnode_pager_generic_getpages(ap->a_vp, ap->a_m, + ap->a_count, + ap->a_reqpage); +}