From owner-svn-src-head@FreeBSD.ORG Sun Jun 8 10:55:07 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 85A3D17E; Sun, 8 Jun 2014 10:55:07 +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 724B9295B; Sun, 8 Jun 2014 10:55:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s58At7x4002434; Sun, 8 Jun 2014 10:55:07 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s58At6gC002430; Sun, 8 Jun 2014 10:55:06 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201406081055.s58At6gC002430@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 8 Jun 2014 10:55:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r267226 - in head/sys: conf kern modules/ufs ufs/ffs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jun 2014 10:55:07 -0000 Author: kib Date: Sun Jun 8 10:55:06 2014 New Revision: 267226 URL: http://svnweb.freebsd.org/changeset/base/267226 Log: Initialize the pbuf counter for directio using SYSINIT, instead of using a direct hook called from kern_vfs_bio_buffer_alloc(). Mark ffs_rawread.c as requiring both ffs and directio options to be compiled into the kernel. Add ffs_rawread.c to the list of ufs.ko module' sources. In addition to stopping breaking the layering violation, it also allows to link kernel when FFS is configured as module and DIRECTIO is enabled. One consequence of the change is that ffs_rawread.o is always linked into the module regardless of the DIRECTIO option. This is similar to the option QUOTA and ufs_quota.c. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/conf/files head/sys/kern/vfs_bio.c head/sys/modules/ufs/Makefile head/sys/ufs/ffs/ffs_rawread.c Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Jun 8 10:22:03 2014 (r267225) +++ head/sys/conf/files Sun Jun 8 10:55:06 2014 (r267226) @@ -3883,7 +3883,7 @@ ufs/ffs/ffs_subr.c optional ffs ufs/ffs/ffs_tables.c optional ffs ufs/ffs/ffs_vfsops.c optional ffs ufs/ffs/ffs_vnops.c optional ffs -ufs/ffs/ffs_rawread.c optional directio +ufs/ffs/ffs_rawread.c optional ffs directio ufs/ffs/ffs_suspend.c optional ffs ufs/ufs/ufs_acl.c optional ffs ufs/ufs/ufs_bmap.c optional ffs Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Sun Jun 8 10:22:03 2014 (r267225) +++ head/sys/kern/vfs_bio.c Sun Jun 8 10:55:06 2014 (r267226) @@ -77,7 +77,6 @@ __FBSDID("$FreeBSD$"); #include #include #include "opt_compat.h" -#include "opt_directio.h" #include "opt_swap.h" static MALLOC_DEFINE(M_BIOBUF, "biobuf", "BIO buffer"); @@ -382,10 +381,6 @@ sysctl_bufspace(SYSCTL_HANDLER_ARGS) } #endif -#ifdef DIRECTIO -extern void ffs_rawread_setup(void); -#endif /* DIRECTIO */ - /* * bqlock: * @@ -770,9 +765,6 @@ kern_vfs_bio_buffer_alloc(caddr_t v, lon if (nswbuf < NSWBUF_MIN) nswbuf = NSWBUF_MIN; #endif -#ifdef DIRECTIO - ffs_rawread_setup(); -#endif /* * Reserve space for the buffer cache buffers Modified: head/sys/modules/ufs/Makefile ============================================================================== --- head/sys/modules/ufs/Makefile Sun Jun 8 10:22:03 2014 (r267225) +++ head/sys/modules/ufs/Makefile Sun Jun 8 10:55:06 2014 (r267226) @@ -6,9 +6,9 @@ KMOD= ufs SRCS= opt_ddb.h opt_directio.h opt_ffs.h opt_quota.h opt_suiddir.h opt_ufs.h \ vnode_if.h ufs_acl.c ufs_bmap.c ufs_dirhash.c ufs_extattr.c \ ufs_gjournal.c ufs_inode.c ufs_lookup.c ufs_quota.c ufs_vfsops.c \ - ufs_vnops.c ffs_alloc.c ffs_balloc.c ffs_inode.c ffs_snapshot.c \ - ffs_softdep.c ffs_subr.c ffs_suspend.c ffs_tables.c ffs_vfsops.c \ - ffs_vnops.c + ufs_vnops.c ffs_alloc.c ffs_balloc.c ffs_inode.c ffs_rawread.c \ + ffs_snapshot.c ffs_softdep.c ffs_subr.c ffs_suspend.c ffs_tables.c \ + ffs_vfsops.c ffs_vnops.c .if !defined(KERNBUILDDIR) CFLAGS+= -DSOFTUPDATES -DUFS_DIRHASH Modified: head/sys/ufs/ffs/ffs_rawread.c ============================================================================== --- head/sys/ufs/ffs/ffs_rawread.c Sun Jun 8 10:22:03 2014 (r267225) +++ head/sys/ufs/ffs/ffs_rawread.c Sun Jun 8 10:55:06 2014 (r267226) @@ -71,8 +71,6 @@ static int ffs_rawread_sync(struct vnode int ffs_rawread(struct vnode *vp, struct uio *uio, int *workdone); -void ffs_rawread_setup(void); - SYSCTL_DECL(_vfs_ffs); static int ffsrawbufcnt = 4; @@ -87,13 +85,13 @@ static int rawreadahead = 1; SYSCTL_INT(_vfs_ffs, OID_AUTO, rawreadahead, CTLFLAG_RW, &rawreadahead, 0, "Flag to enable readahead for long raw reads"); - -void -ffs_rawread_setup(void) +static void +ffs_rawread_setup(void *arg __unused) { + ffsrawbufcnt = (nswbuf > 100 ) ? (nswbuf - (nswbuf >> 4)) : nswbuf - 8; } - +SYSINIT(ffs_raw, SI_SUB_VM_CONF, SI_ORDER_ANY, ffs_rawread_setup, NULL); static int ffs_rawread_sync(struct vnode *vp)