From owner-svn-src-stable-9@FreeBSD.ORG Sun Jan 12 20:10:14 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3926878D; Sun, 12 Jan 2014 20:10:14 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 243A01DD6; Sun, 12 Jan 2014 20:10:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0CKAEHi089245; Sun, 12 Jan 2014 20:10:14 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0CKADJZ089240; Sun, 12 Jan 2014 20:10:13 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201401122010.s0CKADJZ089240@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Sun, 12 Jan 2014 20:10:13 +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: r260569 - in stable/9: contrib/gcc contrib/gcc/doc 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.17 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: Sun, 12 Jan 2014 20:10:14 -0000 Author: pfg Date: Sun Jan 12 20:10:12 2014 New Revision: 260569 URL: http://svnweb.freebsd.org/changeset/base/260569 Log: MFC r259920: gcc: Implement -Wmost for compatibility with clang. This is equivalent to -Wall -Wno-parentheses. Obtained from: Apple GCC 4.2 - 5531 Modified: stable/9/contrib/gcc/c-opts.c stable/9/contrib/gcc/c.opt stable/9/contrib/gcc/doc/invoke.texi stable/9/sys/fs/ext2fs/ext2_inode_cnv.c Directory Properties: stable/9/ (props changed) stable/9/contrib/gcc/ (props changed) Modified: stable/9/contrib/gcc/c-opts.c ============================================================================== --- stable/9/contrib/gcc/c-opts.c Sun Jan 12 20:09:17 2014 (r260568) +++ stable/9/contrib/gcc/c-opts.c Sun Jan 12 20:10:12 2014 (r260569) @@ -385,12 +385,17 @@ c_common_handle_option (size_t scode, co break; case OPT_Wall: + /* APPLE LOCAL -Wmost */ + case OPT_Wmost: set_Wunused (value); set_Wformat (value); set_Wimplicit (value); warn_char_subscripts = value; warn_missing_braces = value; - warn_parentheses = value; + /* APPLE LOCAL begin -Wmost --dpatel */ + if (code != OPT_Wmost) + warn_parentheses = value; + /* APPLE LOCAL end -Wmost --dpatel */ warn_return_type = value; warn_sequence_point = value; /* Was C only. */ if (c_dialect_cxx ()) Modified: stable/9/contrib/gcc/c.opt ============================================================================== --- stable/9/contrib/gcc/c.opt Sun Jan 12 20:09:17 2014 (r260568) +++ stable/9/contrib/gcc/c.opt Sun Jan 12 20:10:12 2014 (r260569) @@ -284,6 +284,12 @@ Wmissing-prototypes C ObjC Var(warn_missing_prototypes) Warn about global functions without prototypes +; APPLE LOCAL begin -Wmost +Wmost +C ObjC C++ ObjC++ +Like -Wall but without -Wparentheses +; APPLE LOCAL end -Wmost + Wmultichar C ObjC C++ ObjC++ Warn about use of multi-character character constants Modified: stable/9/contrib/gcc/doc/invoke.texi ============================================================================== --- stable/9/contrib/gcc/doc/invoke.texi Sun Jan 12 20:09:17 2014 (r260568) +++ stable/9/contrib/gcc/doc/invoke.texi Sun Jan 12 20:10:12 2014 (r260569) @@ -222,6 +222,8 @@ in the following sections. -Wmain -Wmissing-braces -Wmissing-field-initializers @gol -Wmissing-format-attribute -Wmissing-include-dirs @gol -Wmissing-noreturn @gol +@c APPLE LOCAL -Wmost +-Wmost (APPLE ONLY) @gol -Wno-multichar -Wnonnull -Wno-overflow @gol -Woverlength-strings -Wpacked -Wpadded @gol -Wparentheses -Wpointer-arith -Wno-pointer-to-int-cast @gol @@ -2652,7 +2654,12 @@ warnings about constructions that some u that are easy to avoid (or modify to prevent the warning), even in conjunction with macros. This also enables some language-specific warnings described in @ref{C++ Dialect Options}. +@c APPLE LOCAL begin -Wmost +@item -Wmost +@opindex Wmost +This is equivalent to -Wall -Wno-parentheses. (Apple compatible) @end table +@c APPLE LOCAL end -Wmost The following @option{-W@dots{}} options are not implied by @option{-Wall}. Some of them warn about constructions that users generally do not Modified: stable/9/sys/fs/ext2fs/ext2_inode_cnv.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_inode_cnv.c Sun Jan 12 20:09:17 2014 (r260568) +++ stable/9/sys/fs/ext2fs/ext2_inode_cnv.c Sun Jan 12 20:10:12 2014 (r260569) @@ -104,7 +104,7 @@ ext2_ei2i(struct ext2fs_dinode *ei, stru ip->i_birthtime = ei->e2di_crtime; ip->i_birthnsec = XTIME_TO_NSEC(ei->e2di_crtime_extra); } - ip->i_flags = ei->e2di_flags; + ip->i_flags = 0; ip->i_flags |= (ei->e2di_flags & EXT2_APPEND) ? SF_APPEND : 0; ip->i_flags |= (ei->e2di_flags & EXT2_IMMUTABLE) ? SF_IMMUTABLE : 0; ip->i_flags |= (ei->e2di_flags & EXT2_NODUMP) ? UF_NODUMP : 0; @@ -152,7 +152,7 @@ ext2_i2ei(struct inode *ip, struct ext2f ei->e2di_crtime = ip->i_birthtime; ei->e2di_crtime_extra = NSEC_TO_XTIME(ip->i_birthnsec); } - ei->e2di_flags = ip->i_flags; + ei->e2di_flags = 0; ei->e2di_flags |= (ip->i_flags & SF_APPEND) ? EXT2_APPEND: 0; ei->e2di_flags |= (ip->i_flags & SF_IMMUTABLE) ? EXT2_IMMUTABLE: 0; ei->e2di_flags |= (ip->i_flags & UF_NODUMP) ? EXT2_NODUMP: 0; From owner-svn-src-stable-9@FreeBSD.ORG Sun Jan 12 20:18:13 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 167E9BB4; Sun, 12 Jan 2014 20:18:13 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 02BF31E10; Sun, 12 Jan 2014 20:18:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0CKICqX092884; Sun, 12 Jan 2014 20:18:12 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0CKICQ2092883; Sun, 12 Jan 2014 20:18:12 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201401122018.s0CKICQ2092883@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Sun, 12 Jan 2014 20:18:12 +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: r260570 - 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.17 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: Sun, 12 Jan 2014 20:18:13 -0000 Author: pfg Date: Sun Jan 12 20:18:12 2014 New Revision: 260570 URL: http://svnweb.freebsd.org/changeset/base/260570 Log: Revert unrelated fix that went into r260569. The fix is good but the minimum MFC period for this change has not elapsed yet. Modified: stable/9/sys/fs/ext2fs/ext2_inode_cnv.c Modified: stable/9/sys/fs/ext2fs/ext2_inode_cnv.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_inode_cnv.c Sun Jan 12 20:10:12 2014 (r260569) +++ stable/9/sys/fs/ext2fs/ext2_inode_cnv.c Sun Jan 12 20:18:12 2014 (r260570) @@ -104,7 +104,7 @@ ext2_ei2i(struct ext2fs_dinode *ei, stru ip->i_birthtime = ei->e2di_crtime; ip->i_birthnsec = XTIME_TO_NSEC(ei->e2di_crtime_extra); } - ip->i_flags = 0; + ip->i_flags = ei->e2di_flags; ip->i_flags |= (ei->e2di_flags & EXT2_APPEND) ? SF_APPEND : 0; ip->i_flags |= (ei->e2di_flags & EXT2_IMMUTABLE) ? SF_IMMUTABLE : 0; ip->i_flags |= (ei->e2di_flags & EXT2_NODUMP) ? UF_NODUMP : 0; @@ -152,7 +152,7 @@ ext2_i2ei(struct inode *ip, struct ext2f ei->e2di_crtime = ip->i_birthtime; ei->e2di_crtime_extra = NSEC_TO_XTIME(ip->i_birthnsec); } - ei->e2di_flags = 0; + ei->e2di_flags = ip->i_flags; ei->e2di_flags |= (ip->i_flags & SF_APPEND) ? EXT2_APPEND: 0; ei->e2di_flags |= (ip->i_flags & SF_IMMUTABLE) ? EXT2_IMMUTABLE: 0; ei->e2di_flags |= (ip->i_flags & UF_NODUMP) ? EXT2_NODUMP: 0; From owner-svn-src-stable-9@FreeBSD.ORG Sun Jan 12 21:19:51 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 25AC8F74; Sun, 12 Jan 2014 21:19:51 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1083C11DD; Sun, 12 Jan 2014 21:19:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0CLJo3T016740; Sun, 12 Jan 2014 21:19:50 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0CLJnM2016727; Sun, 12 Jan 2014 21:19:49 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201401122119.s0CLJnM2016727@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Sun, 12 Jan 2014 21:19:49 +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: r260574 - in stable/9/contrib: gcc/config gcclibs/libcpp 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.17 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: Sun, 12 Jan 2014 21:19:51 -0000 Author: pfg Date: Sun Jan 12 21:19:49 2014 New Revision: 260574 URL: http://svnweb.freebsd.org/changeset/base/260574 Log: MFC r260310: libcpp: misc fixes from Apple's GCC. Fixes some bugs detected by Apple: #error with unmatched quotes pragma mark Obtained from: Apple GCC 4.2 - 5553 Modified: stable/9/contrib/gcc/config/darwin.h stable/9/contrib/gcclibs/libcpp/ChangeLog.apple stable/9/contrib/gcclibs/libcpp/charset.c stable/9/contrib/gcclibs/libcpp/directives.c stable/9/contrib/gcclibs/libcpp/internal.h stable/9/contrib/gcclibs/libcpp/lex.c Directory Properties: stable/9/ (props changed) stable/9/contrib/gcc/ (props changed) stable/9/contrib/gcclibs/ (props changed) Modified: stable/9/contrib/gcc/config/darwin.h ============================================================================== --- stable/9/contrib/gcc/config/darwin.h Sun Jan 12 21:16:26 2014 (r260573) +++ stable/9/contrib/gcc/config/darwin.h Sun Jan 12 21:19:49 2014 (r260574) @@ -873,7 +873,9 @@ enum machopic_addr_class { #define DARWIN_REGISTER_TARGET_PRAGMAS() \ do { \ - c_register_pragma (0, "mark", darwin_pragma_ignore); \ + /* APPLE LOCAL begin pragma mark 5614511 */ \ + /* Removed mark. */ \ + /* APPLE LOCAL end pragma mark 5614511 */ \ c_register_pragma (0, "options", darwin_pragma_options); \ c_register_pragma (0, "segment", darwin_pragma_ignore); \ c_register_pragma (0, "unused", darwin_pragma_unused); \ Modified: stable/9/contrib/gcclibs/libcpp/ChangeLog.apple ============================================================================== --- stable/9/contrib/gcclibs/libcpp/ChangeLog.apple Sun Jan 12 21:16:26 2014 (r260573) +++ stable/9/contrib/gcclibs/libcpp/ChangeLog.apple Sun Jan 12 21:19:49 2014 (r260574) @@ -3,6 +3,11 @@ Radar 6121572 * charset.c (_cpp_convert_input): Don't read to.text[-1]. +2008-05-01 Mike Stump + + Radar 5774975 + * charset.c (_cpp_convert_input): Eat UTF-8 BOM. + 2005-02-17 Devang Patel Radar 3958387 Modified: stable/9/contrib/gcclibs/libcpp/charset.c ============================================================================== --- stable/9/contrib/gcclibs/libcpp/charset.c Sun Jan 12 21:16:26 2014 (r260573) +++ stable/9/contrib/gcclibs/libcpp/charset.c Sun Jan 12 21:19:49 2014 (r260574) @@ -1597,6 +1597,17 @@ _cpp_convert_input (cpp_reader *pfile, c input_cset = init_iconv_desc (pfile, SOURCE_CHARSET, input_charset); if (input_cset.func == convert_no_conversion) { + /* APPLE LOCAL begin UTF-8 BOM 5774975 */ + /* Eat the UTF-8 BOM. */ + if (len >= 3 + && input[0] == 0xef + && input[1] == 0xbb + && input[2] == 0xbf) + { + memmove (&input[0], &input[3], size-3); + len -= 3; + } + /* APPLE LOCAL end UTF-8 BOM 5774975 */ to.text = input; to.asize = size; to.len = len; Modified: stable/9/contrib/gcclibs/libcpp/directives.c ============================================================================== --- stable/9/contrib/gcclibs/libcpp/directives.c Sun Jan 12 21:16:26 2014 (r260573) +++ stable/9/contrib/gcclibs/libcpp/directives.c Sun Jan 12 21:19:49 2014 (r260574) @@ -991,7 +991,11 @@ do_diagnostic (cpp_reader *pfile, int co if (print_dir) fprintf (stderr, "#%s ", pfile->directive->name); pfile->state.prevent_expansion++; + /* APPLE LOCAL #error with unmatched quotes 5607574 */ + pfile->state.in_diagnostic++; cpp_output_line (pfile, stderr); + /* APPLE LOCAL #error with unmatched quotes 5607574 */ + pfile->state.in_diagnostic--; pfile->state.prevent_expansion--; } } @@ -1173,12 +1177,25 @@ cpp_register_deferred_pragma (cpp_reader } } +/* APPLE LOCAL begin pragma mark 5614511 */ +/* Handle #pragma mark. */ +static void +do_pragma_mark (cpp_reader *pfile) +{ + ++pfile->state.skipping; + skip_rest_of_line (pfile); + --pfile->state.skipping; +} +/* APPLE LOCAL end pragma mark 5614511 */ + /* Register the pragmas the preprocessor itself handles. */ void _cpp_init_internal_pragmas (cpp_reader *pfile) { /* Pragmas in the global namespace. */ register_pragma_internal (pfile, 0, "once", do_pragma_once); + /* APPLE LOCAL pragma mark 5614511 */ + register_pragma_internal (pfile, 0, "mark", do_pragma_mark); /* New GCC-specific pragmas should be put in the GCC namespace. */ register_pragma_internal (pfile, "GCC", "poison", do_pragma_poison); Modified: stable/9/contrib/gcclibs/libcpp/internal.h ============================================================================== --- stable/9/contrib/gcclibs/libcpp/internal.h Sun Jan 12 21:16:26 2014 (r260573) +++ stable/9/contrib/gcclibs/libcpp/internal.h Sun Jan 12 21:19:49 2014 (r260574) @@ -220,6 +220,11 @@ struct lexer_state /* Nonzero if the deferred pragma being handled allows macro expansion. */ unsigned char pragma_allow_expansion; + + /* APPLE LOCAL begin #error with unmatched quotes 5607574 */ + /* Nonzero when handling #error and #warning to allow unmatched quotes. */ + unsigned char in_diagnostic; + /* APPLE LOCAL end #error with unmatched quotes 5607574 */ }; /* Special nodes - identifiers with predefined significance. */ Modified: stable/9/contrib/gcclibs/libcpp/lex.c ============================================================================== --- stable/9/contrib/gcclibs/libcpp/lex.c Sun Jan 12 21:16:26 2014 (r260573) +++ stable/9/contrib/gcclibs/libcpp/lex.c Sun Jan 12 21:19:49 2014 (r260574) @@ -658,7 +658,12 @@ lex_string (cpp_reader *pfile, cpp_token cpp_error (pfile, CPP_DL_WARNING, "null character(s) preserved in literal"); - if (type == CPP_OTHER && CPP_OPTION (pfile, lang) != CLK_ASM) + /* APPLE LOCAL begin #error with unmatched quotes 5607574 */ + if (type == CPP_OTHER + && CPP_OPTION (pfile, lang) != CLK_ASM + && !pfile->state.in_diagnostic + && !pfile->state.skipping) + /* APPLE LOCAL end #error with unmatched quotes 5607574 */ cpp_error (pfile, CPP_DL_PEDWARN, "missing terminating %c character", (int) terminator); From owner-svn-src-stable-9@FreeBSD.ORG Sun Jan 12 21:21:20 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8AC7F187; Sun, 12 Jan 2014 21:21:20 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6BD37123D; Sun, 12 Jan 2014 21:21:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0CLLK3K017926; Sun, 12 Jan 2014 21:21:20 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0CLLJWc017922; Sun, 12 Jan 2014 21:21:19 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201401122121.s0CLLJWc017922@svn.freebsd.org> From: Hans Petter Selasky Date: Sun, 12 Jan 2014 21:21:19 +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: r260575 - in stable/9/sys/dev/usb: . storage wlan 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.17 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: Sun, 12 Jan 2014 21:21:20 -0000 Author: hselasky Date: Sun Jan 12 21:21:19 2014 New Revision: 260575 URL: http://svnweb.freebsd.org/changeset/base/260575 Log: MFC r244607 and r244650: Fix regression issues after r244503. PR: usb/185628 Modified: stable/9/sys/dev/usb/storage/ustorage_fs.c stable/9/sys/dev/usb/usb_msctest.c stable/9/sys/dev/usb/wlan/if_urtw.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/storage/ustorage_fs.c ============================================================================== --- stable/9/sys/dev/usb/storage/ustorage_fs.c Sun Jan 12 21:19:49 2014 (r260574) +++ stable/9/sys/dev/usb/storage/ustorage_fs.c Sun Jan 12 21:21:19 2014 (r260575) @@ -603,6 +603,8 @@ tr_setup: usbd_xfer_set_stall(xfer); DPRINTF("stall pipe\n"); } + usbd_xfer_set_frame_len(xfer, 0, + sizeof(ustorage_fs_bbb_cbw_t)); usbd_transfer_submit(xfer); break; @@ -827,6 +829,8 @@ tr_setup: sc->sc_transfer.data_error = 0; usbd_xfer_set_stall(xfer); } + usbd_xfer_set_frame_len(xfer, 0, + sizeof(ustorage_fs_bbb_csw_t)); usbd_transfer_submit(xfer); break; Modified: stable/9/sys/dev/usb/usb_msctest.c ============================================================================== --- stable/9/sys/dev/usb/usb_msctest.c Sun Jan 12 21:19:49 2014 (r260574) +++ stable/9/sys/dev/usb/usb_msctest.c Sun Jan 12 21:21:19 2014 (r260575) @@ -83,7 +83,7 @@ enum { DIR_NONE, }; -#define SCSI_MAX_LEN 0x100 +#define SCSI_MAX_LEN MAX(0x100, BULK_SIZE) #define SCSI_INQ_LEN 0x24 #define SCSI_SENSE_LEN 0xFF @@ -150,6 +150,7 @@ struct bbb_transfer { usb_size_t data_rem; /* bytes */ usb_timeout_t data_timeout; /* ms */ usb_frlength_t actlen; /* bytes */ + usb_frlength_t buffer_size; /* bytes */ uint8_t cmd_len; /* bytes */ uint8_t dir; @@ -192,7 +193,7 @@ static const struct usb_config bbb_confi .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .bufsize = MAX(SCSI_MAX_LEN, BULK_SIZE), + .bufsize = SCSI_MAX_LEN, .flags = {.proxy_buffer = 1,.short_xfer_ok = 1,}, .callback = &bbb_data_read_callback, .timeout = 4 * USB_MS_HZ, /* 4 seconds */ @@ -211,7 +212,7 @@ static const struct usb_config bbb_confi .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, - .bufsize = BULK_SIZE, + .bufsize = SCSI_MAX_LEN, .flags = {.ext_buffer = 1,.proxy_buffer = 1,}, .callback = &bbb_data_write_callback, .timeout = 4 * USB_MS_HZ, /* 4 seconds */ @@ -299,6 +300,8 @@ bbb_command_callback(struct usb_xfer *xf sc->cbw->bCDBLength = sizeof(sc->cbw->CBWCDB); DPRINTFN(0, "Truncating long command\n"); } + usbd_xfer_set_frame_len(xfer, 0, + sizeof(struct bbb_cbw)); usbd_transfer_submit(xfer); break; @@ -385,7 +388,7 @@ bbb_data_write_callback(struct usb_xfer if (sc->data_rem == 0) { bbb_transfer_start(sc, ST_STATUS); - return; + break; } if (max_bulk > sc->data_rem) { max_bulk = sc->data_rem; @@ -393,7 +396,7 @@ bbb_data_write_callback(struct usb_xfer usbd_xfer_set_timeout(xfer, sc->data_timeout); usbd_xfer_set_frame_data(xfer, 0, sc->data_ptr, max_bulk); usbd_transfer_submit(xfer); - return; + break; default: /* Error */ if (error == USB_ERR_CANCELLED) { @@ -401,8 +404,7 @@ bbb_data_write_callback(struct usb_xfer } else { bbb_transfer_start(sc, ST_DATA_WR_CS); } - return; - + break; } } @@ -437,6 +439,8 @@ bbb_status_callback(struct usb_xfer *xfe break; case USB_ST_SETUP: + usbd_xfer_set_frame_len(xfer, 0, + sizeof(struct bbb_csw)); usbd_transfer_submit(xfer); break; @@ -548,6 +552,8 @@ bbb_attach(struct usb_device *udev, uint /* store pointer to DMA buffers */ sc->buffer = usbd_xfer_get_frame_buffer( sc->xfer[ST_DATA_RD], 0); + sc->buffer_size = + usbd_xfer_max_len(sc->xfer[ST_DATA_RD]); sc->cbw = usbd_xfer_get_frame_buffer( sc->xfer[ST_COMMAND], 0); sc->csw = usbd_xfer_get_frame_buffer( @@ -828,8 +834,8 @@ usb_msc_eject(struct usb_device *udev, u * TCTMobile needs DIR_IN flag. To get it, we * supply a dummy data with the command. */ - err = bbb_command_start(sc, DIR_IN, 0, &sc->buffer, - sizeof(sc->buffer), &scsi_tct_eject, + err = bbb_command_start(sc, DIR_IN, 0, sc->buffer, + sc->buffer_size, &scsi_tct_eject, sizeof(scsi_tct_eject), USB_MS_HZ); break; default: Modified: stable/9/sys/dev/usb/wlan/if_urtw.c ============================================================================== --- stable/9/sys/dev/usb/wlan/if_urtw.c Sun Jan 12 21:19:49 2014 (r260574) +++ stable/9/sys/dev/usb/wlan/if_urtw.c Sun Jan 12 21:21:19 2014 (r260575) @@ -4179,6 +4179,7 @@ urtw_bulk_tx_status_callback(struct usb_ case USB_ST_SETUP: setup: memcpy(dma_buf, &sc->sc_txstatus, sizeof(uint64_t)); + usbd_xfer_set_frame_len(xfer, 0, sizeof(uint64_t)); usbd_transfer_submit(xfer); break; default: From owner-svn-src-stable-9@FreeBSD.ORG Mon Jan 13 14:23:48 2014 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1033) id 03F73DF6; Mon, 13 Jan 2014 14:23:48 +0000 (UTC) Date: Mon, 13 Jan 2014 14:23:48 +0000 From: Alexey Dokuchaev To: Alexander Motin Subject: Re: svn commit: r260474 - stable/9/sys/x86/cpufreq Message-ID: <20140113142347.GA96299@FreeBSD.org> References: <201401091045.s09AjcFi083701@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201401091045.s09AjcFi083701@svn.freebsd.org> User-Agent: Mutt/1.5.22 (2013-10-16) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.17 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: Mon, 13 Jan 2014 14:23:48 -0000 On Thu, Jan 09, 2014 at 10:45:38AM +0000, Alexander Motin wrote: > New Revision: 260474 > URL: http://svnweb.freebsd.org/changeset/base/260474 > > Log: > MFC r259197: > Do not DELAY() for P-state transition unless we want to see the result. > > Intel manual says: "If a transition is already in progress, transition to > a new value will subsequently take effect. Reads of IA32_PERF_CTL determine > the last targeted operating point." So seems it should be fine to just > trigger wanted transition and go. Linux does the same. > > Modified: > stable/9/sys/x86/cpufreq/est.c It looks like stable/8 can also benefit from this commit. Mind making one? ./danfe From owner-svn-src-stable-9@FreeBSD.ORG Mon Jan 13 18:57:31 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7B36F8A4; Mon, 13 Jan 2014 18:57:31 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 673DA1C96; Mon, 13 Jan 2014 18:57:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0DIvV2T016787; Mon, 13 Jan 2014 18:57:31 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0DIvVhH016786; Mon, 13 Jan 2014 18:57:31 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201401131857.s0DIvVhH016786@svn.freebsd.org> From: John Baldwin Date: Mon, 13 Jan 2014 18:57:31 +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: r260598 - stable/9/sys/kern 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.17 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: Mon, 13 Jan 2014 18:57:31 -0000 Author: jhb Date: Mon Jan 13 18:57:30 2014 New Revision: 260598 URL: http://svnweb.freebsd.org/changeset/base/260598 Log: MFC 243152,255478: Two SOCK_SEQPACKET fixes: - Update comment. - Provide pr_ctloutput method for AF_LOCAL/SOCK_SEQPACKET sockets. Modified: stable/9/sys/kern/uipc_usrreq.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/uipc_usrreq.c ============================================================================== --- stable/9/sys/kern/uipc_usrreq.c Mon Jan 13 17:14:10 2014 (r260597) +++ stable/9/sys/kern/uipc_usrreq.c Mon Jan 13 18:57:30 2014 (r260598) @@ -320,6 +320,7 @@ static struct protosw localsw[] = { */ .pr_flags = PR_ADDR|PR_ATOMIC|PR_CONNREQUIRED|PR_WANTRCVD| PR_RIGHTS, + .pr_ctloutput = &uipc_ctloutput, .pr_usrreqs = &uipc_usrreqs_seqpacket, }, }; @@ -936,7 +937,8 @@ uipc_send(struct socket *so, int flags, SOCKBUF_LOCK(&so2->so_rcv); if (unp2->unp_flags & UNP_WANTCRED) { /* - * Credentials are passed only once on SOCK_STREAM. + * Credentials are passed only once on SOCK_STREAM + * and SOCK_SEQPACKET. */ unp2->unp_flags &= ~UNP_WANTCRED; control = unp_addsockcred(td, control); From owner-svn-src-stable-9@FreeBSD.ORG Mon Jan 13 19:15:13 2014 Return-Path: Delivered-To: svn-src-stable-9@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 A0F6F20D; Mon, 13 Jan 2014 19:15:13 +0000 (UTC) Received: from mail-ee0-x235.google.com (mail-ee0-x235.google.com [IPv6:2a00:1450:4013:c00::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 758A51E02; Mon, 13 Jan 2014 19:15:12 +0000 (UTC) Received: by mail-ee0-f53.google.com with SMTP id t10so390863eei.40 for ; Mon, 13 Jan 2014 11:15:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=WgybGeXpgpqekQhann3vZAXTJy61DmCU6KpMzCw+Gnk=; b=XF5OHJvQF5puffvdRvqB+9QHTjPM7DaTxoETlgxIZxByXTtHRFhweoPuqavL6cO7hg NDKnBqZ/uuBZ+8oixAphPFyPHeOkwja8I4P0MbDe48HpBnRc1Rz6gnYjteD0f7czxg2b 4847PrH+SAQyh0+4wof0VMUU4QvMW+ojrIsENHXp2M9YtjWyz9bpzkXHzt27xt8RATJw ckcMJyI3jCwsMShJsyGY6jgm3l+cCOGfbZ2bfUg5STBtoWSaASkQCB6idFLkcRp4yb4W gsEclUiloUokkUF6YxHcWyKU49m7Csbs9Jlemka4pyQsF6D9rrp4AqKl2rTuA8VWaQm1 z4Uw== X-Received: by 10.14.172.69 with SMTP id s45mr29775421eel.9.1389640510854; Mon, 13 Jan 2014 11:15:10 -0800 (PST) Received: from mavbook.mavhome.dp.ua ([134.249.139.101]) by mx.google.com with ESMTPSA id m47sm5496990eey.7.2014.01.13.11.15.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 13 Jan 2014 11:15:09 -0800 (PST) Sender: Alexander Motin Message-ID: <52D43B3A.9090808@FreeBSD.org> Date: Mon, 13 Jan 2014 21:15:06 +0200 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: Alexey Dokuchaev Subject: Re: svn commit: r260474 - stable/9/sys/x86/cpufreq References: <201401091045.s09AjcFi083701@svn.freebsd.org> <20140113142347.GA96299@FreeBSD.org> In-Reply-To: <20140113142347.GA96299@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.17 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: Mon, 13 Jan 2014 19:15:13 -0000 On 13.01.2014 16:23, Alexey Dokuchaev wrote: > On Thu, Jan 09, 2014 at 10:45:38AM +0000, Alexander Motin wrote: >> New Revision: 260474 >> URL: http://svnweb.freebsd.org/changeset/base/260474 >> >> Log: >> MFC r259197: >> Do not DELAY() for P-state transition unless we want to see the result. >> >> Intel manual says: "If a transition is already in progress, transition to >> a new value will subsequently take effect. Reads of IA32_PERF_CTL determine >> the last targeted operating point." So seems it should be fine to just >> trigger wanted transition and go. Linux does the same. >> >> Modified: >> stable/9/sys/x86/cpufreq/est.c > > It looks like stable/8 can also benefit from this commit. Mind making one? Done. -- Alexander Motin From owner-svn-src-stable-9@FreeBSD.ORG Mon Jan 13 19:42:38 2014 Return-Path: Delivered-To: svn-src-stable-9@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 528B6BAE; Mon, 13 Jan 2014 19:42:38 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3E1D81081; Mon, 13 Jan 2014 19:42:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0DJgcBf037045; Mon, 13 Jan 2014 19:42:38 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0DJgcXq037044; Mon, 13 Jan 2014 19:42:38 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201401131942.s0DJgcXq037044@svn.freebsd.org> From: Xin LI Date: Mon, 13 Jan 2014 19:42:38 +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: r260604 - stable/9/sys/dev/oce 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.17 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: Mon, 13 Jan 2014 19:42:38 -0000 Author: delphij Date: Mon Jan 13 19:42:37 2014 New Revision: 260604 URL: http://svnweb.freebsd.org/changeset/base/260604 Log: MFC r260110: Eliminate unused drbr_stats_update implementation in oce(4) driver. Noticed by: dim Modified: stable/9/sys/dev/oce/oce_if.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/oce/oce_if.c ============================================================================== --- stable/9/sys/dev/oce/oce_if.c Mon Jan 13 19:34:23 2014 (r260603) +++ stable/9/sys/dev/oce/oce_if.c Mon Jan 13 19:42:37 2014 (r260604) @@ -1228,18 +1228,6 @@ oce_wq_handler(void *arg) } -#if __FreeBSD_version >= 1000000 -static __inline void -drbr_stats_update(struct ifnet *ifp, int len, int mflags) -{ -#ifndef NO_SLOW_STATS - ifp->if_obytes += len; - if (mflags & M_MCAST) - ifp->if_omcasts++; -#endif -} -#endif - static int oce_multiq_transmit(struct ifnet *ifp, struct mbuf *m, struct oce_wq *wq) { From owner-svn-src-stable-9@FreeBSD.ORG Tue Jan 14 00:38:35 2014 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1033) id 856315E9; Tue, 14 Jan 2014 00:38:35 +0000 (UTC) Date: Tue, 14 Jan 2014 00:38:35 +0000 From: Alexey Dokuchaev To: Alexander Motin Subject: Re: svn commit: r260474 - stable/9/sys/x86/cpufreq Message-ID: <20140114003835.GB46988@FreeBSD.org> References: <201401091045.s09AjcFi083701@svn.freebsd.org> <20140113142347.GA96299@FreeBSD.org> <52D43B3A.9090808@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <52D43B3A.9090808@FreeBSD.org> User-Agent: Mutt/1.5.22 (2013-10-16) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.17 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: Tue, 14 Jan 2014 00:38:35 -0000 On Mon, Jan 13, 2014 at 09:15:06PM +0200, Alexander Motin wrote: > On 13.01.2014 16:23, Alexey Dokuchaev wrote: > >On Thu, Jan 09, 2014 at 10:45:38AM +0000, Alexander Motin wrote: > >>New Revision: 260474 > >>URL: http://svnweb.freebsd.org/changeset/base/260474 > >>[...] > >>Modified: > >> stable/9/sys/x86/cpufreq/est.c > > > >It looks like stable/8 can also benefit from this commit. Mind making one? > > Done. Thank you. ./danfe From owner-svn-src-stable-9@FreeBSD.ORG Tue Jan 14 09:58:34 2014 Return-Path: Delivered-To: svn-src-stable-9@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 29240FB8; Tue, 14 Jan 2014 09:58:34 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id EF421136B; Tue, 14 Jan 2014 09:58:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0E9wXtL090540; Tue, 14 Jan 2014 09:58:33 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0E9wXjU090538; Tue, 14 Jan 2014 09:58:33 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201401140958.s0E9wXjU090538@svn.freebsd.org> From: Sergey Kandaurov Date: Tue, 14 Jan 2014 09:58:33 +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: r260624 - stable/9/lib/libc/sys 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.17 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: Tue, 14 Jan 2014 09:58:34 -0000 Author: pluknet Date: Tue Jan 14 09:58:33 2014 New Revision: 260624 URL: http://svnweb.freebsd.org/changeset/base/260624 Log: MFC r259921,259950: Provide the manual page for aio_fsync(2). Added: stable/9/lib/libc/sys/aio_fsync.2 - copied, changed from r259921, head/lib/libc/sys/aio_fsync.2 Modified: stable/9/lib/libc/sys/Makefile.inc Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libc/sys/ (props changed) Modified: stable/9/lib/libc/sys/Makefile.inc ============================================================================== --- stable/9/lib/libc/sys/Makefile.inc Tue Jan 14 09:49:42 2014 (r260623) +++ stable/9/lib/libc/sys/Makefile.inc Tue Jan 14 09:58:33 2014 (r260624) @@ -79,7 +79,7 @@ ${SPSEUDO}: printf ${NOTE_GNU_STACK} >>${.TARGET} MAN+= abort2.2 accept.2 access.2 acct.2 adjtime.2 \ - aio_cancel.2 aio_error.2 aio_read.2 aio_return.2 \ + aio_cancel.2 aio_error.2 aio_fsync.2 aio_read.2 aio_return.2 \ aio_suspend.2 aio_waitcomplete.2 aio_write.2 \ bind.2 brk.2 cap_enter.2 cap_new.2 chdir.2 chflags.2 \ chmod.2 chown.2 chroot.2 clock_gettime.2 close.2 closefrom.2 \ Copied and modified: stable/9/lib/libc/sys/aio_fsync.2 (from r259921, head/lib/libc/sys/aio_fsync.2) ============================================================================== --- head/lib/libc/sys/aio_fsync.2 Thu Dec 26 19:16:30 2013 (r259921, copy source) +++ stable/9/lib/libc/sys/aio_fsync.2 Tue Jan 14 09:58:33 2014 (r260624) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 4, 2013 +.Dd December 27, 2013 .Dt AIO_FSYNC 2 .Os .Sh NAME @@ -49,7 +49,7 @@ completed at the time the call returns. .Pp The .Fa op -argument could be set only to +argument can only be set to .Dv O_SYNC to cause all currently queued I/O operations to be completed as if by a call to @@ -109,7 +109,8 @@ returned in .It Bq Er EBADF The .Fa iocb->aio_fildes -is invalid for writing. +argument +is not a valid descriptor. .It Bq Er EINVAL This implementation does not support synchronized I/O for this file. .El From owner-svn-src-stable-9@FreeBSD.ORG Tue Jan 14 14:05:29 2014 Return-Path: Delivered-To: svn-src-stable-9@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 BE1F5698; Tue, 14 Jan 2014 14:05:29 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8FB2F189F; Tue, 14 Jan 2014 14:05:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0EE5TZJ087091; Tue, 14 Jan 2014 14:05:29 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0EE5TnJ087089; Tue, 14 Jan 2014 14:05:29 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201401141405.s0EE5TnJ087089@svn.freebsd.org> From: Sergey Kandaurov Date: Tue, 14 Jan 2014 14:05:29 +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: r260628 - stable/9/tools/tools/syscall_timing 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.17 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: Tue, 14 Jan 2014 14:05:29 -0000 Author: pluknet Date: Tue Jan 14 14:05:29 2014 New Revision: 260628 URL: http://svnweb.freebsd.org/changeset/base/260628 Log: MFC r257705: Clean up -Wtautological-compare -Wformat warnings. Modified: stable/9/tools/tools/syscall_timing/syscall_timing.c Directory Properties: stable/9/tools/tools/syscall_timing/ (props changed) Modified: stable/9/tools/tools/syscall_timing/syscall_timing.c ============================================================================== --- stable/9/tools/tools/syscall_timing/syscall_timing.c Tue Jan 14 14:03:28 2014 (r260627) +++ stable/9/tools/tools/syscall_timing/syscall_timing.c Tue Jan 14 14:05:29 2014 (r260628) @@ -192,7 +192,8 @@ test_pipe(uintmax_t num, uintmax_t int_a uintmax_t test_socket_stream(uintmax_t num, uintmax_t int_arg, const char *path) { - uintmax_t i, so; + uintmax_t i; + int so; so = socket(int_arg, SOCK_STREAM, 0); if (so < 0) @@ -214,7 +215,8 @@ test_socket_stream(uintmax_t num, uintma uintmax_t test_socket_dgram(uintmax_t num, uintmax_t int_arg, const char *path) { - uintmax_t i, so; + uintmax_t i; + int so; so = socket(int_arg, SOCK_DGRAM, 0); if (so < 0) @@ -408,7 +410,8 @@ test_dup(uintmax_t num, uintmax_t int_ar uintmax_t test_shmfd(uintmax_t num, uintmax_t int_arg, const char *path) { - uintmax_t i, shmfd; + uintmax_t i; + int shmfd; shmfd = shm_open(SHM_ANON, O_CREAT | O_RDWR, 0600); if (shmfd < 0) @@ -431,7 +434,8 @@ uintmax_t test_fstat_shmfd(uintmax_t num, uintmax_t int_arg, const char *path) { struct stat sb; - uintmax_t i, shmfd; + uintmax_t i; + int shmfd; shmfd = shm_open(SHM_ANON, O_CREAT | O_RDWR, 0600); if (shmfd < 0) @@ -785,7 +789,7 @@ main(int argc, char *argv[]) path); timespecsub(&ts_end, &ts_start); printf("%s\t%d\t", the_test->t_name, k); - printf("%ju.%09ju\t%d\t", (uintmax_t)ts_end.tv_sec, + printf("%ju.%09ju\t%ju\t", (uintmax_t)ts_end.tv_sec, (uintmax_t)ts_end.tv_nsec, calls); /* From owner-svn-src-stable-9@FreeBSD.ORG Tue Jan 14 15:21:19 2014 Return-Path: Delivered-To: svn-src-stable-9@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 E8D9E3C3; Tue, 14 Jan 2014 15:21:19 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BB2551035; Tue, 14 Jan 2014 15:21:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0EFLJ7o018276; Tue, 14 Jan 2014 15:21:19 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0EFLJt8018275; Tue, 14 Jan 2014 15:21:19 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201401141521.s0EFLJt8018275@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Tue, 14 Jan 2014 15:21:19 +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: r260630 - 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.17 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: Tue, 14 Jan 2014 15:21:20 -0000 Author: pfg Date: Tue Jan 14 15:21:19 2014 New Revision: 260630 URL: http://svnweb.freebsd.org/changeset/base/260630 Log: MFC r260545: ext2fs: fix inode flag conversion. After r252890 we are naively attempting to pass through the inode flags. This is technically incorrect as the ext2 inode flags don't match the UFS/system values used in FreeBSD and a clean conversion is needed. Some filtering was left in place so the change didn't cause significant changes in FreeBSD but some of the garbage passed is likely to be the cause for warning messages in linux. Fix the issue by resetting the flags before conversion as was done previously. This also means we will not pass the EXT4_* inode flags into FreeBSD's inode. Modified: stable/9/sys/fs/ext2fs/ext2_inode_cnv.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/ext2fs/ext2_inode_cnv.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_inode_cnv.c Tue Jan 14 15:20:33 2014 (r260629) +++ stable/9/sys/fs/ext2fs/ext2_inode_cnv.c Tue Jan 14 15:21:19 2014 (r260630) @@ -104,7 +104,7 @@ ext2_ei2i(struct ext2fs_dinode *ei, stru ip->i_birthtime = ei->e2di_crtime; ip->i_birthnsec = XTIME_TO_NSEC(ei->e2di_crtime_extra); } - ip->i_flags = ei->e2di_flags; + ip->i_flags = 0; ip->i_flags |= (ei->e2di_flags & EXT2_APPEND) ? SF_APPEND : 0; ip->i_flags |= (ei->e2di_flags & EXT2_IMMUTABLE) ? SF_IMMUTABLE : 0; ip->i_flags |= (ei->e2di_flags & EXT2_NODUMP) ? UF_NODUMP : 0; @@ -152,7 +152,7 @@ ext2_i2ei(struct inode *ip, struct ext2f ei->e2di_crtime = ip->i_birthtime; ei->e2di_crtime_extra = NSEC_TO_XTIME(ip->i_birthnsec); } - ei->e2di_flags = ip->i_flags; + ei->e2di_flags = 0; ei->e2di_flags |= (ip->i_flags & SF_APPEND) ? EXT2_APPEND: 0; ei->e2di_flags |= (ip->i_flags & SF_IMMUTABLE) ? EXT2_IMMUTABLE: 0; ei->e2di_flags |= (ip->i_flags & UF_NODUMP) ? EXT2_NODUMP: 0; From owner-svn-src-stable-9@FreeBSD.ORG Tue Jan 14 19:17:21 2014 Return-Path: Delivered-To: svn-src-stable-9@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 78E40674; Tue, 14 Jan 2014 19:17:21 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6443C1616; Tue, 14 Jan 2014 19:17:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0EJHLeG008670; Tue, 14 Jan 2014 19:17:21 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0EJHLrV008669; Tue, 14 Jan 2014 19:17:21 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201401141917.s0EJHLrV008669@svn.freebsd.org> From: Xin LI Date: Tue, 14 Jan 2014 19:17:21 +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: r260642 - in stable: 8/contrib/bsnmp/lib 9/contrib/bsnmp/lib 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.17 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: Tue, 14 Jan 2014 19:17:21 -0000 Author: delphij Date: Tue Jan 14 19:17:20 2014 New Revision: 260642 URL: http://svnweb.freebsd.org/changeset/base/260642 Log: MFC r260636: Fix bsnmpd remote denial of service vulnerability. Reported by: dinoex Submitted by: harti Security: FreeBSD-SA-14:01.bsnmpd Security: CVE-2014-1452 Modified: stable/9/contrib/bsnmp/lib/snmpagent.c Directory Properties: stable/9/contrib/bsnmp/ (props changed) Changes in other areas also in this revision: Modified: stable/8/contrib/bsnmp/lib/snmpagent.c Directory Properties: stable/8/contrib/bsnmp/ (props changed) Modified: stable/9/contrib/bsnmp/lib/snmpagent.c ============================================================================== --- stable/9/contrib/bsnmp/lib/snmpagent.c Tue Jan 14 19:12:40 2014 (r260641) +++ stable/9/contrib/bsnmp/lib/snmpagent.c Tue Jan 14 19:17:20 2014 (r260642) @@ -499,6 +499,11 @@ snmp_getbulk(struct snmp_pdu *pdu, struc for (cnt = 0; cnt < pdu->error_index; cnt++) { eomib = 1; for (i = non_rep; i < pdu->nbindings; i++) { + + if (resp->nbindings == SNMP_MAX_BINDINGS) + /* PDU is full */ + goto done; + if (cnt == 0) result = do_getnext(&context, &pdu->bindings[i], &resp->bindings[resp->nbindings], pdu); From owner-svn-src-stable-9@FreeBSD.ORG Tue Jan 14 19:20:42 2014 Return-Path: Delivered-To: svn-src-stable-9@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 540B8993; Tue, 14 Jan 2014 19:20:42 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3F6051693; Tue, 14 Jan 2014 19:20:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0EJKg7G009549; Tue, 14 Jan 2014 19:20:42 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0EJKgtN009548; Tue, 14 Jan 2014 19:20:42 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201401141920.s0EJKgtN009548@svn.freebsd.org> From: Xin LI Date: Tue, 14 Jan 2014 19:20:42 +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: r260643 - in stable: 8/contrib/ntp/ntpd 9/contrib/ntp/ntpd 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.17 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: Tue, 14 Jan 2014 19:20:42 -0000 Author: delphij Date: Tue Jan 14 19:20:41 2014 New Revision: 260643 URL: http://svnweb.freebsd.org/changeset/base/260643 Log: MFC r260637: Disable 'monitor' feature in ntpd by default. Security: FreeBSD-SA-14:02.ntpd Approved by: so Modified: stable/9/contrib/ntp/ntpd/ntp_config.c Directory Properties: stable/9/contrib/ntp/ (props changed) Changes in other areas also in this revision: Modified: stable/8/contrib/ntp/ntpd/ntp_config.c Directory Properties: stable/8/contrib/ntp/ (props changed) Modified: stable/9/contrib/ntp/ntpd/ntp_config.c ============================================================================== --- stable/9/contrib/ntp/ntpd/ntp_config.c Tue Jan 14 19:17:20 2014 (r260642) +++ stable/9/contrib/ntp/ntpd/ntp_config.c Tue Jan 14 19:20:41 2014 (r260643) @@ -597,6 +597,8 @@ getconfig( #endif /* not SYS_WINNT */ } + proto_config(PROTO_MONITOR, 0, 0., NULL); + for (;;) { if (tok == CONFIG_END) break; From owner-svn-src-stable-9@FreeBSD.ORG Tue Jan 14 19:27:42 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B00BEE48; Tue, 14 Jan 2014 19:27:42 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9AF4B16F0; Tue, 14 Jan 2014 19:27:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0EJRgSq012586; Tue, 14 Jan 2014 19:27:42 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0EJRgbD012585; Tue, 14 Jan 2014 19:27:42 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201401141927.s0EJRgbD012585@svn.freebsd.org> From: Xin LI Date: Tue, 14 Jan 2014 19:27:42 +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: r260644 - in stable: 8/sys/dev/random 9/sys/dev/random 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.17 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: Tue, 14 Jan 2014 19:27:42 -0000 Author: delphij Date: Tue Jan 14 19:27:42 2014 New Revision: 260644 URL: http://svnweb.freebsd.org/changeset/base/260644 Log: On stable/8 and stable/9, disable hardware random number generators by default. This is a direct commit to stable/ branches because HEAD and stable/10 have superior implementation of random device. Approved by: so Modified: stable/9/sys/dev/random/probe.c Changes in other areas also in this revision: Modified: stable/8/sys/dev/random/probe.c Modified: stable/9/sys/dev/random/probe.c ============================================================================== --- stable/9/sys/dev/random/probe.c Tue Jan 14 19:20:41 2014 (r260643) +++ stable/9/sys/dev/random/probe.c Tue Jan 14 19:27:42 2014 (r260644) @@ -73,7 +73,7 @@ random_ident_hardware(struct random_syst if (via_feature_rng & VIA_HAS_RNG) { int enable; - enable = 1; + enable = 0; TUNABLE_INT_FETCH("hw.nehemiah_rng_enable", &enable); if (enable) *systat = random_nehemiah; @@ -83,7 +83,7 @@ random_ident_hardware(struct random_syst if (cpu_feature2 & CPUID2_RDRAND) { int enable; - enable = 1; + enable = 0; TUNABLE_INT_FETCH("hw.ivy_rng_enable", &enable); if (enable) *systat = random_ivy; From owner-svn-src-stable-9@FreeBSD.ORG Tue Jan 14 19:38: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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CE2443B5; Tue, 14 Jan 2014 19:38: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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 92C8F17AD; Tue, 14 Jan 2014 19:38:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0EJcbHF016527; Tue, 14 Jan 2014 19:38:37 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0EJcbOB016526; Tue, 14 Jan 2014 19:38:37 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201401141938.s0EJcbOB016526@svn.freebsd.org> From: Xin LI Date: Tue, 14 Jan 2014 19:38: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: r260646 - in stable: 8/contrib/bind9/bin/named 9/contrib/bind9/bin/named 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.17 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: Tue, 14 Jan 2014 19:38:37 -0000 Author: delphij Date: Tue Jan 14 19:38:37 2014 New Revision: 260646 URL: http://svnweb.freebsd.org/changeset/base/260646 Log: Fix BIND remote denial of service vulnerability. Security: FreeBSD-SA-14:04.bind Security: CVE-2014-0591 Modified: stable/9/contrib/bind9/bin/named/query.c Changes in other areas also in this revision: Modified: stable/8/contrib/bind9/bin/named/query.c Modified: stable/9/contrib/bind9/bin/named/query.c ============================================================================== --- stable/9/contrib/bind9/bin/named/query.c Tue Jan 14 19:33:28 2014 (r260645) +++ stable/9/contrib/bind9/bin/named/query.c Tue Jan 14 19:38:37 2014 (r260646) @@ -5260,8 +5260,7 @@ query_findclosestnsec3(dns_name_t *qname dns_fixedname_t fixed; dns_hash_t hash; dns_name_t name; - int order; - unsigned int count; + unsigned int skip = 0, labels; dns_rdata_nsec3_t nsec3; dns_rdata_t rdata = DNS_RDATA_INIT; isc_boolean_t optout; @@ -5276,6 +5275,7 @@ query_findclosestnsec3(dns_name_t *qname dns_name_init(&name, NULL); dns_name_clone(qname, &name); + labels = dns_name_countlabels(&name); dns_clientinfomethods_init(&cm, ns_client_sourceip); dns_clientinfo_init(&ci, client); @@ -5309,13 +5309,14 @@ query_findclosestnsec3(dns_name_t *qname dns_rdata_reset(&rdata); optout = ISC_TF((nsec3.flags & DNS_NSEC3FLAG_OPTOUT) != 0); if (found != NULL && optout && - dns_name_fullcompare(&name, dns_db_origin(db), &order, - &count) == dns_namereln_subdomain) { + dns_name_issubdomain(&name, dns_db_origin(db))) + { dns_rdataset_disassociate(rdataset); if (dns_rdataset_isassociated(sigrdataset)) dns_rdataset_disassociate(sigrdataset); - count = dns_name_countlabels(&name) - 1; - dns_name_getlabelsequence(&name, 1, count, &name); + skip++; + dns_name_getlabelsequence(qname, skip, labels - skip, + &name); ns_client_log(client, DNS_LOGCATEGORY_DNSSEC, NS_LOGMODULE_QUERY, ISC_LOG_DEBUG(3), "looking for closest provable encloser"); @@ -5333,7 +5334,11 @@ query_findclosestnsec3(dns_name_t *qname ns_client_log(client, DNS_LOGCATEGORY_DNSSEC, NS_LOGMODULE_QUERY, ISC_LOG_WARNING, "expected covering NSEC3, got an exact match"); - if (found != NULL) + if (found == qname) { + if (skip != 0U) + dns_name_getlabelsequence(qname, skip, labels - skip, + found); + } else if (found != NULL) dns_name_copy(&name, found, NULL); return; } From owner-svn-src-stable-9@FreeBSD.ORG Tue Jan 14 21:20:53 2014 Return-Path: Delivered-To: svn-src-stable-9@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 BBB0C31C; Tue, 14 Jan 2014 21:20:53 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A488B1A73; Tue, 14 Jan 2014 21:20:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0ELKr1T071114; Tue, 14 Jan 2014 21:20:53 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0ELKpsU071104; Tue, 14 Jan 2014 21:20:51 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201401142120.s0ELKpsU071104@svn.freebsd.org> From: John Baldwin Date: Tue, 14 Jan 2014 21:20:51 +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: r260650 - in stable/9: tools/regression/usr.sbin/etcupdate usr.sbin usr.sbin/etcupdate 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.17 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: Tue, 14 Jan 2014 21:20:53 -0000 Author: jhb Date: Tue Jan 14 21:20:51 2014 New Revision: 260650 URL: http://svnweb.freebsd.org/changeset/base/260650 Log: MFC 238423,238426,238428,258063,258063,258066,258097,258185,259134: The etcupdate utility is a tool for managing updates to files that are not updated as part of `make installworld' such as files in /etc. It manages updates by doing a three-way merge of changes made to these files against the local versions. It is also designed to minimize the amount of user intervention with the goal of simplifying upgrades for clusters of machines. Added: - copied from r238423, head/tools/regression/usr.sbin/etcupdate/ stable/9/tools/regression/usr.sbin/etcupdate/preworld.sh - copied, changed from r258066, head/tools/regression/usr.sbin/etcupdate/preworld.sh stable/9/tools/regression/usr.sbin/etcupdate/tzsetup.sh - copied unchanged from r259134, head/tools/regression/usr.sbin/etcupdate/tzsetup.sh - copied from r238423, head/usr.sbin/etcupdate/ Directory Properties: stable/9/tools/regression/usr.sbin/etcupdate/ (props changed) stable/9/usr.sbin/etcupdate/ (props changed) Modified: stable/9/tools/regression/usr.sbin/etcupdate/always.sh stable/9/tools/regression/usr.sbin/etcupdate/conflicts.sh stable/9/tools/regression/usr.sbin/etcupdate/fbsdid.sh stable/9/tools/regression/usr.sbin/etcupdate/ignore.sh stable/9/tools/regression/usr.sbin/etcupdate/tests.sh stable/9/usr.sbin/Makefile (contents, props changed) stable/9/usr.sbin/etcupdate/etcupdate.8 stable/9/usr.sbin/etcupdate/etcupdate.sh Directory Properties: stable/9/tools/regression/usr.sbin/ (props changed) stable/9/usr.sbin/ (props changed) Modified: stable/9/tools/regression/usr.sbin/etcupdate/always.sh ============================================================================== --- head/tools/regression/usr.sbin/etcupdate/always.sh Fri Jul 13 13:23:48 2012 (r238423) +++ stable/9/tools/regression/usr.sbin/etcupdate/always.sh Tue Jan 14 21:20:51 2014 (r260650) @@ -33,13 +33,17 @@ WORKDIR=work usage() { - echo "Usage: always.sh [-w workdir]" + echo "Usage: always.sh [-s script] [-w workdir]" exit 1 } -# Allow the user to specify an alternate work directory. -while getopts "w:" option; do +# Allow the user to specify an alternate work directory or script. +COMMAND=etcupdate +while getopts "s:w:" option; do case $option in + s) + COMMAND="sh $OPTARG" + ;; w) WORKDIR=$OPTARG ;; @@ -372,7 +376,7 @@ fi build_trees -etcupdate -r -d $WORKDIR -D $TEST > $WORKDIR/test.out +$COMMAND -r -d $WORKDIR -D $TEST > $WORKDIR/test.out cat > $WORKDIR/correct.out < \ +$COMMAND -r -A '/first*' -A '/second* /*di*' -d $WORKDIR -D $TEST > \ $WORKDIR/test1.out cat > $WORKDIR/correct1.out </dev/null + $COMMAND -r -d $WORKDIR -D $TEST >/dev/null } # This is used to verify special handling for /etc/mail/aliases and @@ -122,7 +126,7 @@ MAILER-DAEMON: postmaster postmaster: foo EOF - etcupdate -r -d $WORKDIR -D $TEST >/dev/null + $COMMAND -r -d $WORKDIR -D $TEST >/dev/null } # $1 - relative path to file that should be missing from TEST @@ -201,7 +205,7 @@ build_login_conflict # Verify that 'p' doesn't do anything. echo "Checking 'p':" -echo 'p' | etcupdate resolve -d $WORKDIR -D $TEST >/dev/null +echo 'p' | $COMMAND resolve -d $WORKDIR -D $TEST >/dev/null file /etc/login.conf "" 95de92ea3f1bb1bf4f612a8b5908cddd missing /etc/login.conf.db @@ -209,7 +213,7 @@ conflict /etc/login.conf # Verify that 'mf' removes the conflict, but does nothing else. echo "Checking 'mf':" -echo 'mf' | etcupdate resolve -d $WORKDIR -D $TEST >/dev/null +echo 'mf' | $COMMAND resolve -d $WORKDIR -D $TEST >/dev/null file /etc/login.conf "" 95de92ea3f1bb1bf4f612a8b5908cddd missing /etc/login.conf.db @@ -219,7 +223,7 @@ build_login_conflict # Verify that 'tf' installs the new version of the file. echo "Checking 'tf':" -echo 'tf' | etcupdate resolve -d $WORKDIR -D $TEST >/dev/null +echo 'tf' | $COMMAND resolve -d $WORKDIR -D $TEST >/dev/null file /etc/login.conf "" 7774a0f9a3a372c7c109c32fd31c4b6b file /etc/login.conf.db @@ -238,7 +242,7 @@ default:\\ :welcome=/etc/motd: EOF -echo 'r' | etcupdate resolve -d $WORKDIR -D $TEST >/dev/null +echo 'r' | $COMMAND resolve -d $WORKDIR -D $TEST >/dev/null file /etc/login.conf "" 966e25984b9b63da8eaac8479dcb0d4d file /etc/login.conf.db @@ -248,12 +252,12 @@ build_aliases_conflict # Verify that 'p' and 'mf' do not generate the newaliases warning. echo "Checking newalias warning for 'p'": -echo 'p' | etcupdate resolve -d $WORKDIR -D $TEST | grep -q newalias +echo 'p' | $COMMAND resolve -d $WORKDIR -D $TEST | grep -q newalias if [ $? -eq 0 ]; then echo "+ Extra warning" fi echo "Checking newalias warning for 'mf'": -echo 'mf' | etcupdate resolve -d $WORKDIR -D $TEST | grep -q newalias +echo 'mf' | $COMMAND resolve -d $WORKDIR -D $TEST | grep -q newalias if [ $? -eq 0 ]; then echo "+ Extra warning" fi @@ -261,14 +265,14 @@ fi # Verify that 'tf' and 'r' do generate the newaliases warning. build_aliases_conflict echo "Checking newalias warning for 'tf'": -echo 'tf' | etcupdate resolve -d $WORKDIR -D $TEST | grep -q newalias +echo 'tf' | $COMMAND resolve -d $WORKDIR -D $TEST | grep -q newalias if [ $? -ne 0 ]; then echo "- Missing warning" fi build_aliases_conflict cp $TEST/etc/mail/aliases $CONFLICTS/etc/mail/aliases -echo 'r' | etcupdate resolve -d $WORKDIR -D $TEST | grep -q newalias +echo 'r' | $COMMAND resolve -d $WORKDIR -D $TEST | grep -q newalias if [ $? -ne 0 ]; then echo "- Missing warning" fi Modified: stable/9/tools/regression/usr.sbin/etcupdate/fbsdid.sh ============================================================================== --- head/tools/regression/usr.sbin/etcupdate/fbsdid.sh Fri Jul 13 13:23:48 2012 (r238423) +++ stable/9/tools/regression/usr.sbin/etcupdate/fbsdid.sh Tue Jan 14 21:20:51 2014 (r260650) @@ -33,13 +33,17 @@ WORKDIR=work usage() { - echo "Usage: fbsdid.sh [-w workdir]" + echo "Usage: fbsdid.sh [-s script] [-w workdir]" exit 1 } -# Allow the user to specify an alternate work directory. -while getopts "w:" option; do +# Allow the user to specify an alternate work directory or script. +COMMAND=etcupdate +while getopts "s:w:" option; do case $option in + s) + COMMAND="sh $OPTARG" + ;; w) WORKDIR=$OPTARG ;; @@ -191,6 +195,17 @@ EOF these are some local mods to the file EOF + + # local-remove: A file removed locally changed it's FreeBSD ID + # but nothing else + store_id $OLD/local-remove ": head/local-remove 12000 jhb " + store_id $NEW/local-remove ": head/local-remove 12345 jhb " + for i in $OLD $NEW; do + cat >> $i/local-remove < $WORKDIR/test.out +$COMMAND -r -d $WORKDIR -D $TEST > $WORKDIR/test.out cat > $WORKDIR/correct.out < $WORKDIR/correct.out < $WORKDIR/testF.out +$COMMAND -rF -d $WORKDIR -D $TEST > $WORKDIR/testF.out cat > $WORKDIR/correctF.out < $WORKDIR/testAF.out + +cat > $WORKDIR/correctAF.out < $WORKDIR/test.out +$COMMAND -r -d $WORKDIR -D $TEST > $WORKDIR/test.out cat > $WORKDIR/correct.out < $WORKDIR/test1.out +$COMMAND -r -I '/tree/*' -d $WORKDIR -D $TEST > $WORKDIR/test1.out cat > $WORKDIR/correct1.out < \ +$COMMAND -r -I '/tree/*' -I '/rmdir*' -d $WORKDIR -D $TEST > \ $WORKDIR/test2.out cat > $WORKDIR/correct2.out < \ +$COMMAND -r -I '/tree/* /rmdir/*' -d $WORKDIR -D $TEST > \ $WORKDIR/test3.out cat > $WORKDIR/correct3.out < $OLD/etc/services < $NEW/etc/services < $WORKDIR/testn.out +$COMMAND -nr -d $WORKDIR -D $TEST > $WORKDIR/testn.out cat > $WORKDIR/correct.out < $WORKDIR/correct.out < $WORKDIR/test.out +$COMMAND -r -d $WORKDIR -D $TEST > $WORKDIR/test.out echo "Differences for real:" diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/test.out Copied: stable/9/tools/regression/usr.sbin/etcupdate/tzsetup.sh (from r259134, head/tools/regression/usr.sbin/etcupdate/tzsetup.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/tools/regression/usr.sbin/etcupdate/tzsetup.sh Tue Jan 14 21:20:51 2014 (r260650, copy of r259134, head/tools/regression/usr.sbin/etcupdate/tzsetup.sh) @@ -0,0 +1,221 @@ +#!/bin/sh +# +# Copyright (c) 2013 Advanced Computing Technologies LLC +# Written by: John H. Baldwin +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ + +# Various regression tests for the tzsetup handling in the 'update' command. + +WORKDIR=work + +usage() +{ + echo "Usage: tzsetup.sh [-s script] [-w workdir]" + exit 1 +} + +# Allow the user to specify an alternate work directory or script. +COMMAND=etcupdate +while getopts "s:w:" option; do + case $option in + s) + COMMAND="sh $OPTARG" + ;; + w) + WORKDIR=$OPTARG + ;; + *) + echo + usage + ;; + esac +done +shift $((OPTIND - 1)) +if [ $# -ne 0 ]; then + usage +fi + +CONFLICTS=$WORKDIR/conflicts +OLD=$WORKDIR/old +NEW=$WORKDIR/current +TEST=$WORKDIR/test + +build_trees() +{ + + # Build the base tree, but not /etc/localtime itself + local i j k + + rm -rf $OLD $NEW $TEST $CONFLICTS + mkdir -p $OLD $NEW $TEST + mkdir -p $TEST/etc + mkdir -p $TEST/var/db + mkdir -p $TEST/usr/share/zoneinfo + + # Create a dummy timezone file + echo "foo" > $TEST/usr/share/zoneinfo/foo + +} + +# $1 - relative path to file that should be missing from TEST +missing() +{ + if [ -e $TEST/$1 -o -L $TEST/$1 ]; then + echo "File $1 should be missing" + fi +} + +# $1 - relative path to file that should be a symlink in TEST +# $2 - optional value of the link +link() +{ + local val + + if ! [ -L $TEST/$1 ]; then + echo "File $1 should be a link" + elif [ $# -gt 1 ]; then + val=`readlink $TEST/$1` + if [ "$val" != "$2" ]; then + echo "Link $1 should link to \"$2\"" + fi + fi +} + +# $1 - relative path to regular file that should be present in TEST +# $2 - optional string that should match file contents +# $3 - optional MD5 of the flie contents, overrides $2 if present +file() +{ + local contents sum + + if ! [ -f $TEST/$1 ]; then + echo "File $1 should be a regular file" + elif [ $# -eq 2 ]; then + contents=`cat $TEST/$1` + if [ "$contents" != "$2" ]; then + echo "File $1 has wrong contents" + fi + elif [ $# -eq 3 ]; then + sum=`md5 -q $TEST/$1` + if [ "$sum" != "$3" ]; then + echo "File $1 has wrong contents" + fi + fi +} + +if [ `id -u` -ne 0 ]; then + echo "must be root" +fi + +if [ -r /etc/etcupdate.conf ]; then + echo "WARNING: /etc/etcupdate.conf settings may break some tests." +fi + +# First, test for /etc/localtime not existing + +build_trees + +$COMMAND -nr -d $WORKDIR -D $TEST > $WORKDIR/testn.out + +cat > $WORKDIR/correct.out < $WORKDIR/test.out + +echo "Differences for no /etc/localtime:" +diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/test.out + +missing /etc/localtime +missing /var/db/zoneinfo + +# Second, test for /etc/localtime being a symlink + +build_trees +ln -s /dev/null $TEST/etc/localtime + +$COMMAND -nr -d $WORKDIR -D $TEST > $WORKDIR/testn.out + +cat > $WORKDIR/correct.out < $WORKDIR/test.out + +echo "Differences for symlinked /etc/localtime:" +diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/test.out + +link /etc/localtime "/dev/null" +missing /var/db/zoneinfo + +# Third, test for /etc/localtime as a file and a missing /var/db/zoneinfo + +build_trees +echo "bar" > $TEST/etc/localtime + +$COMMAND -nr -d $WORKDIR -D $TEST > $WORKDIR/testn.out + +cat > $WORKDIR/correct.out < $WORKDIR/test.out + +echo "Differences for missing /var/db/zoneinfo:" +diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/test.out + +file /etc/localtime "bar" +missing /var/db/zoneinfo + +# Finally, test the case where it should update /etc/localtime + +build_trees +echo "bar" > $TEST/etc/localtime +echo "foo" > $TEST/var/db/zoneinfo + +$COMMAND -nr -d $WORKDIR -D $TEST > $WORKDIR/testn.out + +cat > $WORKDIR/correct.out < $WORKDIR/test.out + +echo "Differences for real update:" +diff -u -L "correct" $WORKDIR/correct.out -L "test" $WORKDIR/test.out + +file /etc/localtime "foo" +file /var/db/zoneinfo "foo" Modified: stable/9/usr.sbin/Makefile ============================================================================== --- stable/9/usr.sbin/Makefile Tue Jan 14 21:06:44 2014 (r260649) +++ stable/9/usr.sbin/Makefile Tue Jan 14 21:20:51 2014 (r260650) @@ -24,6 +24,7 @@ SUBDIR= adduser \ digictl \ diskinfo \ dumpcis \ + etcupdate \ extattr \ extattrctl \ fifolog \ Modified: stable/9/usr.sbin/etcupdate/etcupdate.8 ============================================================================== --- head/usr.sbin/etcupdate/etcupdate.8 Fri Jul 13 13:23:48 2012 (r238423) +++ stable/9/usr.sbin/etcupdate/etcupdate.8 Tue Jan 14 21:20:51 2014 (r260650) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2010-2012 Advanced Computing Technologies LLC +.\" Copyright (c) 2010-2013 Advanced Computing Technologies LLC .\" Written by: John H. Baldwin .\" All rights reserved. .\" @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 16, 2012 +.Dd December 9, 2013 .Dt ETCUPDATE 8 .Os .Sh NAME @@ -33,7 +33,7 @@ .Nd "manage updates to system files not updated by installworld" .Sh SYNOPSIS .Nm -.Op Fl nBF +.Op Fl npBF .Op Fl d Ar workdir .Op Fl r | Fl s Ar source | Fl t Ar tarball .Op Fl A Ar patterns @@ -64,6 +64,7 @@ .Op Fl M Ar options .Nm .Cm resolve +.Op Fl p .Op Fl d Ar workdir .Op Fl D Ar destdir .Op Fl L Ar logfile @@ -112,7 +113,6 @@ The utility will not perform a new merge until all conflicts from an earlier merge are resolved. .Sh MODES -.Pp The .Nm utility supports several modes of operation. @@ -150,7 +150,7 @@ tree. An older .Dq previous tree is removed if it exists. -By default the new +By default the new .Dq current tree is built from a source tree. However, @@ -343,25 +343,7 @@ then nothing will be output. .Sh OPTIONS The following options are available. Note that most options do not apply to all modes. -.Bl -tag -width ".Fl d Ar workdir" -.It Fl B -Do not build generated files in a private object tree. -Instead, -reuse the generated files from a previously built object tree that matches -the source tree. -This can be useful to avoid gratuitous conflicts in sendmail configuration -files when bootstrapping. -It can also be useful for building a tarball that matches a specific -world build. -.It Fl d Ar workdir -Specify an alternate directory to use as the work directory. -The work directory is used to store the -.Dq current -and -.Dq previous -trees as well as unresolved conflicts. -The default work directory is -.Pa /var/db/etcupdate . +.Bl -tag -width ".Fl A Ar patterns" .It Fl A Ar patterns Always install the new version of any files that match any of the patterns listed in @@ -377,9 +359,20 @@ Note that ignored files specified via th variable or the .Fl I option will not be installed. +.It Fl B +Do not build generated files in a private object tree. +Instead, +reuse the generated files from a previously built object tree that matches +the source tree. +This can be useful to avoid gratuitous conflicts in +.Xr sendmail 8 +configuration +files when bootstrapping. +It can also be useful for building a tarball that matches a specific +world build. .It Fl D Ar destdir Specify an alternate destination directory as the target of a merge. -This is analagous to the +This is analogous to the .Dv DESTDIR variable used with .Sq make installworld . @@ -387,6 +380,15 @@ The default destination directory is an merges updating .Pa /etc on the local machine. +.It Fl d Ar workdir +Specify an alternate directory to use as the work directory. +The work directory is used to store the +.Dq current +and +.Dq previous +trees as well as unresolved conflicts. +The default work directory is +.Pa /var/db/etcupdate . .It Fl F Ignore changes in the FreeBSD ID string when comparing files in the destination directory to files in either of the @@ -480,6 +482,33 @@ option is not specified, then a temporary .Dq current tree will be extracted to perform the comparison. +.It Fl p +Enable +.Dq pre-world +mode. +Only merge changes to files that are necessary to successfully run +.Sq make installworld +or +.Sq make installkernel . +When this flag is enabled, +the existing +.Dq current +and +.Dq previous +trees are left alone. +Instead, +a temporary tree is populated with the necessary files. +This temporary tree is compared against the +.Dq current +tree. +This allows a normal update to be run after +.Sq make installworld +has completed. +Any conflicts generated during a +.Dq pre-world +update should be resolved by a +.Dq pre-world +.Cm resolve . .It Fl r Do not update the .Dq current @@ -666,6 +695,25 @@ has been removed from the tree, but it has been locally modified. The modified version of the file remains in the destination directory. +.It "Needs update: /etc/localtime (required manual update via tzsetup(1))" +The +.Fa /var/db/zoneinfo +file does not exist, +so +.Nm +was not able to refresh +.Fa /etc/localtime +from its source file in +.Fa /usr/share/zoneinfo . +Running +.Xr tzsetup 1 +will both refresh +.Fa /etc/localtime +and generate +.Fa /var/db/zoneinfo +permitting future updates to refresh +.Fa /etc/localtime +automatically. .It "Needs update: /etc/mail/aliases.db (required manual update via newaliases(1))" The file .Pa /etc/mail/aliases @@ -739,12 +787,16 @@ but it has been removed in the destinati .El .Sh SEE ALSO .Xr cap_mkdb 1 , -.Xr diff 1 , +.Xr diff 1 , .Xr make 1 , .Xr newaliases 1 , .Xr sh 1 , .Xr pwd_mkdb 8 -.\".Sh HISTORY +.Sh HISTORY +The +.Nm +utility first appeared in +.Fx 10.0 . .Sh AUTHORS The .Nm Modified: stable/9/usr.sbin/etcupdate/etcupdate.sh ============================================================================== --- head/usr.sbin/etcupdate/etcupdate.sh Fri Jul 13 13:23:48 2012 (r238423) +++ stable/9/usr.sbin/etcupdate/etcupdate.sh Tue Jan 14 21:20:51 2014 (r260650) @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2010 Advanced Computing Technologies LLC +# Copyright (c) 2010-2013 Advanced Computing Technologies LLC # Written by: John H. Baldwin # All rights reserved. # @@ -61,14 +61,15 @@ usage() { cat < etcupdate diff [-d workdir] [-D destdir] [-I patterns] [-L logfile] etcupdate extract [-B] [-d workdir] [-s source | -t tarball] [-L logfile] [-M options] - etcupdate resolve [-d workdir] [-D destdir] [-L logfile] + etcupdate resolve [-p] [-d workdir] [-D destdir] [-L logfile] etcupdate status [-d workdir] [-D destdir] EOF exit 1 @@ -181,22 +182,31 @@ always_install() # $1 - directory to store new tree in build_tree() { - local make + local destdir dir file make make="make $MAKE_OPTIONS" log "Building tree at $1 with $make" mkdir -p $1/usr/obj >&3 2>&1 - (cd $SRCDIR; $make DESTDIR=$1 distrib-dirs) >&3 2>&1 || return 1 + destdir=`realpath $1` - if ! [ -n "$nobuild" ]; then - (cd $SRCDIR; \ - MAKEOBJDIRPREFIX=$1/usr/obj $make _obj SUBDIR_OVERRIDE=etc && - MAKEOBJDIRPREFIX=$1/usr/obj $make everything SUBDIR_OVERRIDE=etc && - MAKEOBJDIRPREFIX=$1/usr/obj $make DESTDIR=$1 distribution) \ + if [ -n "$preworld" ]; then + # Build a limited tree that only contains files that are + # crucial to installworld. + for file in $PREWORLD_FILES; do + dir=`dirname /$file` + mkdir -p $1/$dir >&3 2>&1 || return 1 + cp -p $SRCDIR/$file $1/$file || return 1 + done + elif ! [ -n "$nobuild" ]; then + (cd $SRCDIR; $make DESTDIR=$destdir distrib-dirs && + MAKEOBJDIRPREFIX=$destdir/usr/obj $make _obj SUBDIR_OVERRIDE=etc && + MAKEOBJDIRPREFIX=$destdir/usr/obj $make everything SUBDIR_OVERRIDE=etc && + MAKEOBJDIRPREFIX=$destdir/usr/obj $make DESTDIR=$destdir distribution) \ >&3 2>&1 || return 1 else - (cd $SRCDIR; $make DESTDIR=$1 distribution) >&3 2>&1 || return 1 + (cd $SRCDIR; $make DESTDIR=$destdir distrib-dirs && + $make DESTDIR=$destdir distribution) >&3 2>&1 || return 1 fi chflags -R noschg $1 >&3 2>&1 || return 1 rm -rf $1/usr/obj >&3 2>&1 || return 1 @@ -218,9 +228,15 @@ build_tree() # source tree. extract_tree() { + local files + # If we have a tarball, extract that into the new directory. if [ -n "$tarball" ]; then - if ! (mkdir -p $NEWTREE && tar xf $tarball -C $NEWTREE) \ + files= + if [ -n "$preworld" ]; then + files="$PREWORLD_FILES" + fi + if ! (mkdir -p $NEWTREE && tar xf $tarball -C $NEWTREE $files) \ >&3 2>&1; then echo "Failed to extract new tree." remove_tree $NEWTREE @@ -470,6 +486,39 @@ diffnode() esac } +# Run one-off commands after an update has completed. These commands +# are not tied to a specific file, so they cannot be handled by +# post_install_file(). +post_update() +{ + local args + + # None of these commands should be run for a pre-world update. + if [ -n "$preworld" ]; then + return + fi + + # If /etc/localtime exists and is not a symlink and /var/db/zoneinfo + # exists, run tzsetup -r to refresh /etc/localtime. + if [ -f ${DESTDIR}/etc/localtime -a \ + ! -L ${DESTDIR}/etc/localtime ]; then + if [ -f ${DESTDIR}/var/db/zoneinfo ]; then + if [ -n "${DESTDIR}" ]; then + args="-C ${DESTDIR}" + else + args="" + fi + log "tzsetup -r ${args}" + if [ -z "$dryrun" ]; then + tzsetup -r ${args} >&3 2>&1 + fi + else + warn "Needs update: /etc/localtime (required" \ + "manual update via tzsetup(1))" + fi + fi +} + # Create missing parent directories of a node in a target tree # preserving the owner, group, and permissions from a specified # template tree. @@ -567,6 +616,14 @@ post_install_file() fi fi ;; + /etc/services) + log "services_mkdb -q -o $DESTDIR/var/db/services.db" \ + "${DESTDIR}$1" + if [ -z "$dryrun" ]; then + services_mkdb -q -o $DESTDIR/var/db/services.db \ + ${DESTDIR}$1 >&3 2>&1 + fi + ;; esac } @@ -1010,16 +1067,6 @@ handle_modified_file() fi fi - # If the only change in the new file versus the old file is a - # change in the FreeBSD ID string and -F is specified, just - # update the FreeBSD ID string in the local file. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-9@FreeBSD.ORG Tue Jan 14 21:35:26 2014 Return-Path: Delivered-To: svn-src-stable-9@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 728349CF; Tue, 14 Jan 2014 21:35:26 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 443941C87; Tue, 14 Jan 2014 21:35:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0ELZQnS076328; Tue, 14 Jan 2014 21:35:26 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0ELZPVT076326; Tue, 14 Jan 2014 21:35:25 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201401142135.s0ELZPVT076326@svn.freebsd.org> From: Jilles Tjoelker Date: Tue, 14 Jan 2014 21:35:25 +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: r260651 - stable/9/usr.bin/find 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.17 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: Tue, 14 Jan 2014 21:35:26 -0000 Author: jilles Date: Tue Jan 14 21:35:25 2014 New Revision: 260651 URL: http://svnweb.freebsd.org/changeset/base/260651 Log: MFC r260336,r260355: find: Fix -lname and -ilname: * Take into account that readlink() does not add a terminating '\0'. * Do not match symlinks that are followed because of -H or -L. This is explicitly documented in GNU find's info file and is like -type l. * Fix matching symlinks in subdirectories when fts changes directories. As before, symlinks of length PATH_MAX or more are not handled correctly. (These can only be created on other operating systems.) Also, avoid some readlink() calls on files that are obviously not symlinks (because of fts(3) restrictions, not all of them). PR: bin/185393 Submitted by: Ben Reser (parts, original version) Modified: stable/9/usr.bin/find/find.1 stable/9/usr.bin/find/function.c Directory Properties: stable/9/usr.bin/find/ (props changed) Modified: stable/9/usr.bin/find/find.1 ============================================================================== --- stable/9/usr.bin/find/find.1 Tue Jan 14 21:20:51 2014 (r260650) +++ stable/9/usr.bin/find/find.1 Tue Jan 14 21:35:25 2014 (r260651) @@ -31,7 +31,7 @@ .\" @(#)find.1 8.7 (Berkeley) 5/9/95 .\" $FreeBSD$ .\" -.Dd September 9, 2012 +.Dd January 5, 2014 .Dt FIND 1 .Os .Sh NAME @@ -502,6 +502,8 @@ Like .Ic -name , but the contents of the symbolic link are matched instead of the file name. +Note that this only matches broken symbolic links +if symbolic links are being followed. This is a GNU find extension. .It Ic -ls This primary always evaluates to true. Modified: stable/9/usr.bin/find/function.c ============================================================================== --- stable/9/usr.bin/find/function.c Tue Jan 14 21:20:51 2014 (r260650) +++ stable/9/usr.bin/find/function.c Tue Jan 14 21:35:25 2014 (r260651) @@ -1082,11 +1082,24 @@ f_name(PLAN *plan, FTSENT *entry) { char fn[PATH_MAX]; const char *name; + ssize_t len; if (plan->flags & F_LINK) { - name = fn; - if (readlink(entry->fts_path, fn, sizeof(fn)) == -1) + /* + * The below test both avoids obviously useless readlink() + * calls and ensures that symlinks with existent target do + * not match if symlinks are being followed. + * Assumption: fts will stat all symlinks that are to be + * followed and will return the stat information. + */ + if (entry->fts_info != FTS_NSOK && entry->fts_info != FTS_SL && + entry->fts_info != FTS_SLNONE) + return 0; + len = readlink(entry->fts_accpath, fn, sizeof(fn) - 1); + if (len == -1) return 0; + fn[len] = '\0'; + name = fn; } else name = entry->fts_name; return !fnmatch(plan->c_data, name, From owner-svn-src-stable-9@FreeBSD.ORG Thu Jan 16 13:24:59 2014 Return-Path: Delivered-To: svn-src-stable-9@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 66C084C1; Thu, 16 Jan 2014 13:24:59 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 519901B3A; Thu, 16 Jan 2014 13:24:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0GDOxqa008635; Thu, 16 Jan 2014 13:24:59 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GDOxlN008634; Thu, 16 Jan 2014 13:24:59 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201401161324.s0GDOxlN008634@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 16 Jan 2014 13:24:59 +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: r260714 - stable/9/sys/netinet6 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.17 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: Thu, 16 Jan 2014 13:24:59 -0000 Author: ae Date: Thu Jan 16 13:24:58 2014 New Revision: 260714 URL: http://svnweb.freebsd.org/changeset/base/260714 Log: MFC r260481: Add MRT6_DLOG() macro for debugging. Reduce number of MRT6DEBUG ifdefs and fix some broken format strings. Modified: stable/9/sys/netinet6/ip6_mroute.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet6/ip6_mroute.c ============================================================================== --- stable/9/sys/netinet6/ip6_mroute.c Thu Jan 16 13:24:10 2014 (r260713) +++ stable/9/sys/netinet6/ip6_mroute.c Thu Jan 16 13:24:58 2014 (r260714) @@ -218,6 +218,14 @@ static VNET_DEFINE(u_int, mrt6debug) = 0 #define DEBUG_XMIT 0x10 #define DEBUG_REG 0x20 #define DEBUG_PIM 0x40 +#define DEBUG_ERR 0x80 +#define DEBUG_ANY 0x7f +#define MRT6_DLOG(m, fmt, ...) \ + if (V_mrt6debug & (m)) \ + log(((m) & DEBUG_ERR) ? LOG_ERR: LOG_DEBUG, \ + "%s: " fmt "\n", __func__, ##__VA_ARGS__) +#else +#define MRT6_DLOG(m, fmt, ...) #endif static void expire_upcalls(void *); @@ -523,12 +531,8 @@ static int ip6_mrouter_init(struct socket *so, int v, int cmd) { -#ifdef MRT6DEBUG - if (V_mrt6debug) - log(LOG_DEBUG, - "ip6_mrouter_init: so_type = %d, pr_protocol = %d\n", - so->so_type, so->so_proto->pr_protocol); -#endif + MRT6_DLOG(DEBUG_ANY, "so_type = %d, pr_protocol = %d", + so->so_type, so->so_proto->pr_protocol); if (so->so_type != SOCK_RAW || so->so_proto->pr_protocol != IPPROTO_ICMPV6) @@ -557,11 +561,7 @@ ip6_mrouter_init(struct socket *so, int expire_upcalls, NULL); MROUTER6_UNLOCK(); - -#ifdef MRT6DEBUG - if (V_mrt6debug) - log(LOG_DEBUG, "ip6_mrouter_init\n"); -#endif + MRT6_DLOG(DEBUG_ANY, "finished"); return (0); } @@ -639,11 +639,7 @@ X_ip6_mrouter_done(void) V_ip6_mrouter_ver = 0; MROUTER6_UNLOCK(); - -#ifdef MRT6DEBUG - if (V_mrt6debug) - log(LOG_DEBUG, "ip6_mrouter_done\n"); -#endif + MRT6_DLOG(DEBUG_ANY, "finished"); return (0); } @@ -724,14 +720,8 @@ add_m6if(struct mif6ctl *mifcp) nummifs = mifcp->mif6c_mifi + 1; MIF6_UNLOCK(); - -#ifdef MRT6DEBUG - if (V_mrt6debug) - log(LOG_DEBUG, - "add_mif #%d, phyint %s\n", - mifcp->mif6c_mifi, - ifp->if_xname); -#endif + MRT6_DLOG(DEBUG_ANY, "mif #%d, phyint %s", mifcp->mif6c_mifi, + if_name(ifp)); return (0); } @@ -774,11 +764,7 @@ del_m6if_locked(mifi_t *mifip) if (mif6table[mifi - 1].m6_ifp) break; nummifs = mifi; - -#ifdef MRT6DEBUG - if (V_mrt6debug) - log(LOG_DEBUG, "del_m6if %d, nummifs %d\n", *mifip, nummifs); -#endif + MRT6_DLOG(DEBUG_ANY, "mif %d, nummifs %d", *mifip, nummifs); return (0); } @@ -814,15 +800,10 @@ add_m6fc(struct mf6cctl *mfccp) /* If an entry already exists, just update the fields */ if (rt) { -#ifdef MRT6DEBUG - if (V_mrt6debug & DEBUG_MFC) { - log(LOG_DEBUG, - "add_m6fc no upcall h %d o %s g %s p %x\n", - ip6_sprintf(ip6bufo, &mfccp->mf6cc_origin.sin6_addr), - ip6_sprintf(ip6bufg, &mfccp->mf6cc_mcastgrp.sin6_addr), - mfccp->mf6cc_parent); - } -#endif + MRT6_DLOG(DEBUG_MFC, "no upcall o %s g %s p %x", + ip6_sprintf(ip6bufo, &mfccp->mf6cc_origin.sin6_addr), + ip6_sprintf(ip6bufg, &mfccp->mf6cc_mcastgrp.sin6_addr), + mfccp->mf6cc_parent); rt->mf6c_parent = mfccp->mf6cc_parent; rt->mf6c_ifset = mfccp->mf6cc_ifset; @@ -853,16 +834,12 @@ add_m6fc(struct mf6cctl *mfccp) &mfccp->mf6cc_mcastgrp.sin6_addr), mfccp->mf6cc_parent, rt->mf6c_stall); -#ifdef MRT6DEBUG - if (V_mrt6debug & DEBUG_MFC) - log(LOG_DEBUG, - "add_m6fc o %s g %s p %x dbg %x\n", - ip6_sprintf(ip6bufo, - &mfccp->mf6cc_origin.sin6_addr), - ip6_sprintf(ip6bufg, - &mfccp->mf6cc_mcastgrp.sin6_addr), - mfccp->mf6cc_parent, rt->mf6c_stall); -#endif + MRT6_DLOG(DEBUG_MFC, "o %s g %s p %x dbg %p", + ip6_sprintf(ip6bufo, + &mfccp->mf6cc_origin.sin6_addr), + ip6_sprintf(ip6bufg, + &mfccp->mf6cc_mcastgrp.sin6_addr), + mfccp->mf6cc_parent, rt->mf6c_stall); rt->mf6c_origin = mfccp->mf6cc_origin; rt->mf6c_mcastgrp = mfccp->mf6cc_mcastgrp; @@ -895,15 +872,10 @@ add_m6fc(struct mf6cctl *mfccp) * It is possible that an entry is being inserted without an upcall */ if (nstl == 0) { -#ifdef MRT6DEBUG - if (V_mrt6debug & DEBUG_MFC) - log(LOG_DEBUG, - "add_mfc no upcall h %d o %s g %s p %x\n", - hash, - ip6_sprintf(ip6bufo, &mfccp->mf6cc_origin.sin6_addr), - ip6_sprintf(ip6bufg, &mfccp->mf6cc_mcastgrp.sin6_addr), - mfccp->mf6cc_parent); -#endif + MRT6_DLOG(DEBUG_MFC, "no upcall h %lu o %s g %s p %x", hash, + ip6_sprintf(ip6bufo, &mfccp->mf6cc_origin.sin6_addr), + ip6_sprintf(ip6bufg, &mfccp->mf6cc_mcastgrp.sin6_addr), + mfccp->mf6cc_parent); for (rt = mf6ctable[hash]; rt; rt = rt->mf6c_next) { @@ -989,6 +961,9 @@ collate(struct timeval *t) static int del_m6fc(struct mf6cctl *mfccp) { +#ifdef MRT6DEBUG + char ip6bufo[INET6_ADDRSTRLEN], ip6bufg[INET6_ADDRSTRLEN]; +#endif struct sockaddr_in6 origin; struct sockaddr_in6 mcastgrp; struct mf6c *rt; @@ -999,14 +974,9 @@ del_m6fc(struct mf6cctl *mfccp) mcastgrp = mfccp->mf6cc_mcastgrp; hash = MF6CHASH(origin.sin6_addr, mcastgrp.sin6_addr); -#ifdef MRT6DEBUG - if (V_mrt6debug & DEBUG_MFC) { - char ip6bufo[INET6_ADDRSTRLEN], ip6bufg[INET6_ADDRSTRLEN]; - log(LOG_DEBUG,"del_m6fc orig %s mcastgrp %s\n", - ip6_sprintf(ip6bufo, &origin.sin6_addr), - ip6_sprintf(ip6bufg, &mcastgrp.sin6_addr)); - } -#endif + MRT6_DLOG(DEBUG_MFC, "orig %s mcastgrp %s", + ip6_sprintf(ip6bufo, &origin.sin6_addr), + ip6_sprintf(ip6bufg, &mcastgrp.sin6_addr)); MFC6_LOCK(); @@ -1077,13 +1047,9 @@ X_ip6_mforward(struct ip6_hdr *ip6, stru mifi_t mifi; char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; -#ifdef MRT6DEBUG - if (V_mrt6debug & DEBUG_FORWARD) - log(LOG_DEBUG, "ip6_mforward: src %s, dst %s, ifindex %d\n", - ip6_sprintf(ip6bufs, &ip6->ip6_src), - ip6_sprintf(ip6bufd, &ip6->ip6_dst), - ifp->if_index); -#endif + MRT6_DLOG(DEBUG_FORWARD, "src %s, dst %s, ifindex %d", + ip6_sprintf(ip6bufs, &ip6->ip6_src), + ip6_sprintf(ip6bufd, &ip6->ip6_dst), ifp->if_index); /* * Don't forward a packet with Hop limit of zero or one, @@ -1145,12 +1111,9 @@ X_ip6_mforward(struct ip6_hdr *ip6, stru #endif /* UPCALL_TIMING */ MRT6STAT_INC(mrt6s_no_route); -#ifdef MRT6DEBUG - if (V_mrt6debug & (DEBUG_FORWARD | DEBUG_MFC)) - log(LOG_DEBUG, "ip6_mforward: no rte s %s g %s\n", - ip6_sprintf(ip6bufs, &ip6->ip6_src), - ip6_sprintf(ip6bufd, &ip6->ip6_dst)); -#endif + MRT6_DLOG(DEBUG_FORWARD | DEBUG_MFC, "no rte s %s g %s", + ip6_sprintf(ip6bufs, &ip6->ip6_src), + ip6_sprintf(ip6bufd, &ip6->ip6_dst)); /* * Allocate mbufs early so that we don't do extra work if we @@ -1246,11 +1209,8 @@ X_ip6_mforward(struct ip6_hdr *ip6, stru return (EINVAL); } -#ifdef MRT6DEBUG - if (V_mrt6debug & DEBUG_FORWARD) - log(LOG_DEBUG, - "getting the iif info in the kernel\n"); -#endif + MRT6_DLOG(DEBUG_FORWARD, + "getting the iif info in the kernel"); for (mifp = mif6table, mifi = 0; mifi < nummifs && mifp->m6_ifp != ifp; @@ -1336,6 +1296,9 @@ X_ip6_mforward(struct ip6_hdr *ip6, stru static void expire_upcalls(void *unused) { +#ifdef MRT6DEBUG + char ip6bufo[INET6_ADDRSTRLEN], ip6bufg[INET6_ADDRSTRLEN]; +#endif struct rtdetq *rte; struct mf6c *mfc, **nptr; u_long i; @@ -1355,15 +1318,9 @@ expire_upcalls(void *unused) if (rte != NULL && mfc->mf6c_expire != 0 && --mfc->mf6c_expire == 0) { -#ifdef MRT6DEBUG - if (V_mrt6debug & DEBUG_EXPIRE) { - char ip6bufo[INET6_ADDRSTRLEN]; - char ip6bufg[INET6_ADDRSTRLEN]; - log(LOG_DEBUG, "expire_upcalls: expiring (%s %s)\n", - ip6_sprintf(ip6bufo, &mfc->mf6c_origin.sin6_addr), - ip6_sprintf(ip6bufg, &mfc->mf6c_mcastgrp.sin6_addr)); - } -#endif + MRT6_DLOG(DEBUG_EXPIRE, "expiring (%s %s)", + ip6_sprintf(ip6bufo, &mfc->mf6c_origin.sin6_addr), + ip6_sprintf(ip6bufg, &mfc->mf6c_mcastgrp.sin6_addr)); /* * drop all the packets * free the mbuf with the pkt, if, timing info @@ -1423,13 +1380,9 @@ ip6_mdq(struct mbuf *m, struct ifnet *if mifi = rt->mf6c_parent; if ((mifi >= nummifs) || (mif6table[mifi].m6_ifp != ifp)) { /* came in the wrong interface */ -#ifdef MRT6DEBUG - if (V_mrt6debug & DEBUG_FORWARD) - log(LOG_DEBUG, - "wrong if: ifid %d mifi %d mififid %x\n", - ifp->if_index, mifi, - mif6table[mifi].m6_ifp->if_index); -#endif + MRT6_DLOG(DEBUG_FORWARD, + "wrong if: ifid %d mifi %d mififid %x", ifp->if_index, + mifi, mif6table[mifi].m6_ifp->if_index); MRT6STAT_INC(mrt6s_wrong_if); rt->mf6c_wrong_if++; /* @@ -1506,10 +1459,8 @@ ip6_mdq(struct mbuf *m, struct ifnet *if MRT6STAT_INC(mrt6s_upcalls); if (socket_send(V_ip6_mrouter, mm, &sin6) < 0) { -#ifdef MRT6DEBUG - if (V_mrt6debug) - log(LOG_WARNING, "mdq, ip6_mrouter socket queue full\n"); -#endif + MRT6_DLOG(DEBUG_ANY, + "ip6_mrouter socket queue full"); MRT6STAT_INC(mrt6s_upq_sockfull); return (ENOBUFS); } /* if socket Q full */ @@ -1573,6 +1524,9 @@ ip6_mdq(struct mbuf *m, struct ifnet *if static void phyint_send(struct ip6_hdr *ip6, struct mif6 *mifp, struct mbuf *m) { +#ifdef MRT6DEBUG + char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; +#endif struct mbuf *mb_copy; struct ifnet *ifp = mifp->m6_ifp; int error = 0; @@ -1610,11 +1564,8 @@ phyint_send(struct ip6_hdr *ip6, struct error = ip6_output(mb_copy, NULL, NULL, IPV6_FORWARDING, &im6o, NULL, NULL); -#ifdef MRT6DEBUG - if (V_mrt6debug & DEBUG_XMIT) - log(LOG_DEBUG, "phyint_send on mif %d err %d\n", - mifp - mif6table, error); -#endif + MRT6_DLOG(DEBUG_XMIT, "mif %u err %d", + (uint16_t)(mifp - mif6table), error); return; } @@ -1650,11 +1601,8 @@ phyint_send(struct ip6_hdr *ip6, struct */ error = (*ifp->if_output)(ifp, mb_copy, (struct sockaddr *)&dst6, NULL); -#ifdef MRT6DEBUG - if (V_mrt6debug & DEBUG_XMIT) - log(LOG_DEBUG, "phyint_send on mif %d err %d\n", - mifp - mif6table, error); -#endif + MRT6_DLOG(DEBUG_XMIT, "mif %u err %d", + (uint16_t)(mifp - mif6table), error); } else { /* * pMTU discovery is intentionally disabled by default, since @@ -1664,19 +1612,11 @@ phyint_send(struct ip6_hdr *ip6, struct if (V_ip6_mcast_pmtu) icmp6_error(mb_copy, ICMP6_PACKET_TOO_BIG, 0, linkmtu); else { -#ifdef MRT6DEBUG - if (V_mrt6debug & DEBUG_XMIT) { - char ip6bufs[INET6_ADDRSTRLEN]; - char ip6bufd[INET6_ADDRSTRLEN]; - log(LOG_DEBUG, - "phyint_send: packet too big on %s o %s " - "g %s size %d(discarded)\n", - if_name(ifp), - ip6_sprintf(ip6bufs, &ip6->ip6_src), - ip6_sprintf(ip6bufd, &ip6->ip6_dst), - mb_copy->m_pkthdr.len); - } -#endif /* MRT6DEBUG */ + MRT6_DLOG(DEBUG_XMIT, " packet too big on %s o %s " + "g %s size %d (discarded)", if_name(ifp), + ip6_sprintf(ip6bufs, &ip6->ip6_src), + ip6_sprintf(ip6bufd, &ip6->ip6_dst), + mb_copy->m_pkthdr.len); m_freem(mb_copy); /* simply discard the packet */ } } @@ -1685,19 +1625,17 @@ phyint_send(struct ip6_hdr *ip6, struct static int register_send(struct ip6_hdr *ip6, struct mif6 *mif, struct mbuf *m) { +#ifdef MRT6DEBUG + char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; +#endif struct mbuf *mm; int i, len = m->m_pkthdr.len; static struct sockaddr_in6 sin6 = { sizeof(sin6), AF_INET6 }; struct mrt6msg *im6; -#ifdef MRT6DEBUG - if (V_mrt6debug) { - char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; - log(LOG_DEBUG, "** IPv6 register_send **\n src %s dst %s\n", - ip6_sprintf(ip6bufs, &ip6->ip6_src), - ip6_sprintf(ip6bufd, &ip6->ip6_dst)); - } -#endif + MRT6_DLOG(DEBUG_ANY, "src %s dst %s", + ip6_sprintf(ip6bufs, &ip6->ip6_src), + ip6_sprintf(ip6bufd, &ip6->ip6_dst)); PIM6STAT_INC(pim6s_snd_registers); /* Make a copy of the packet to send to the user level process */ @@ -1736,11 +1674,7 @@ register_send(struct ip6_hdr *ip6, struc MRT6STAT_INC(mrt6s_upcalls); if (socket_send(V_ip6_mrouter, mm, &sin6) < 0) { -#ifdef MRT6DEBUG - if (V_mrt6debug) - log(LOG_WARNING, - "register_send: ip6_mrouter socket queue full\n"); -#endif + MRT6_DLOG(DEBUG_ANY, "ip6_mrouter socket queue full"); MRT6STAT_INC(mrt6s_upq_sockfull); return (ENOBUFS); } @@ -1792,10 +1726,7 @@ pim6_input(struct mbuf **mp, int *offp, */ if (pimlen < PIM_MINLEN) { PIM6STAT_INC(pim6s_rcv_tooshort); -#ifdef MRT6DEBUG - if (V_mrt6debug & DEBUG_PIM) - log(LOG_DEBUG,"pim6_input: PIM packet too short\n"); -#endif + MRT6_DLOG(DEBUG_PIM, "PIM packet too short"); m_freem(m); return (IPPROTO_DONE); } @@ -1845,11 +1776,7 @@ pim6_input(struct mbuf **mp, int *offp, if (in6_cksum(m, IPPROTO_PIM, off, cksumlen)) { PIM6STAT_INC(pim6s_rcv_badsum); -#ifdef MRT6DEBUG - if (V_mrt6debug & DEBUG_PIM) - log(LOG_DEBUG, - "pim6_input: invalid checksum\n"); -#endif + MRT6_DLOG(DEBUG_PIM, "invalid checksum"); m_freem(m); return (IPPROTO_DONE); } @@ -1859,11 +1786,9 @@ pim6_input(struct mbuf **mp, int *offp, /* PIM version check */ if (pim->pim_ver != PIM_VERSION) { PIM6STAT_INC(pim6s_rcv_badversion); -#ifdef MRT6DEBUG - log(LOG_ERR, - "pim6_input: incorrect version %d, expecting %d\n", + MRT6_DLOG(DEBUG_ANY | DEBUG_ERR, + "incorrect version %d, expecting %d", pim->pim_ver, PIM_VERSION); -#endif m_freem(m); return (IPPROTO_DONE); } @@ -1887,12 +1812,8 @@ pim6_input(struct mbuf **mp, int *offp, PIM6STAT_INC(pim6s_rcv_registers); if ((reg_mif_num >= nummifs) || (reg_mif_num == (mifi_t) -1)) { -#ifdef MRT6DEBUG - if (V_mrt6debug & DEBUG_PIM) - log(LOG_DEBUG, - "pim6_input: register mif not set: %d\n", - reg_mif_num); -#endif + MRT6_DLOG(DEBUG_PIM, "register mif not set: %d", + reg_mif_num); m_freem(m); return (IPPROTO_DONE); } @@ -1908,35 +1829,25 @@ pim6_input(struct mbuf **mp, int *offp, if (pimlen < PIM6_REG_MINLEN) { PIM6STAT_INC(pim6s_rcv_tooshort); PIM6STAT_INC(pim6s_rcv_badregisters); -#ifdef MRT6DEBUG - log(LOG_ERR, - "pim6_input: register packet size too " - "small %d from %s\n", + MRT6_DLOG(DEBUG_ANY | DEBUG_ERR, "register packet " + "size too small %d from %s", pimlen, ip6_sprintf(ip6bufs, &ip6->ip6_src)); -#endif m_freem(m); return (IPPROTO_DONE); } eip6 = (struct ip6_hdr *) (reghdr + 1); -#ifdef MRT6DEBUG - if (V_mrt6debug & DEBUG_PIM) - log(LOG_DEBUG, - "pim6_input[register], eip6: %s -> %s, " - "eip6 plen %d\n", - ip6_sprintf(ip6bufs, &eip6->ip6_src), - ip6_sprintf(ip6bufd, &eip6->ip6_dst), - ntohs(eip6->ip6_plen)); -#endif + MRT6_DLOG(DEBUG_PIM, "eip6: %s -> %s, eip6 plen %d", + ip6_sprintf(ip6bufs, &eip6->ip6_src), + ip6_sprintf(ip6bufd, &eip6->ip6_dst), + ntohs(eip6->ip6_plen)); /* verify the version number of the inner packet */ if ((eip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) { PIM6STAT_INC(pim6s_rcv_badregisters); -#ifdef MRT6DEBUG - log(LOG_DEBUG, "pim6_input: invalid IP version (%d) " - "of the inner packet\n", + MRT6_DLOG(DEBUG_ANY, "invalid IP version (%d) " + "of the inner packet", (eip6->ip6_vfc & IPV6_VERSION)); -#endif m_freem(m); return (IPPROTO_NONE); } @@ -1944,13 +1855,9 @@ pim6_input(struct mbuf **mp, int *offp, /* verify the inner packet is destined to a mcast group */ if (!IN6_IS_ADDR_MULTICAST(&eip6->ip6_dst)) { PIM6STAT_INC(pim6s_rcv_badregisters); -#ifdef MRT6DEBUG - if (V_mrt6debug & DEBUG_PIM) - log(LOG_DEBUG, - "pim6_input: inner packet of register " - "is not multicast %s\n", - ip6_sprintf(ip6bufd, &eip6->ip6_dst)); -#endif + MRT6_DLOG(DEBUG_PIM, "inner packet of register " + "is not multicast %s", + ip6_sprintf(ip6bufd, &eip6->ip6_dst)); m_freem(m); return (IPPROTO_DONE); } @@ -1960,11 +1867,8 @@ pim6_input(struct mbuf **mp, int *offp, */ mcp = m_copy(m, 0, off + PIM6_REG_MINLEN); if (mcp == NULL) { -#ifdef MRT6DEBUG - log(LOG_ERR, - "pim6_input: pim register: " - "could not copy register head\n"); -#endif + MRT6_DLOG(DEBUG_ANY | DEBUG_ERR, "pim register: " + "could not copy register head"); m_freem(m); return (IPPROTO_DONE); } @@ -1973,16 +1877,10 @@ pim6_input(struct mbuf **mp, int *offp, * forward the inner ip6 packet; point m_data at the inner ip6. */ m_adj(m, off + PIM_MINLEN); -#ifdef MRT6DEBUG - if (V_mrt6debug & DEBUG_PIM) { - log(LOG_DEBUG, - "pim6_input: forwarding decapsulated register: " - "src %s, dst %s, mif %d\n", - ip6_sprintf(ip6bufs, &eip6->ip6_src), - ip6_sprintf(ip6bufd, &eip6->ip6_dst), - reg_mif_num); - } -#endif + MRT6_DLOG(DEBUG_PIM, "forwarding decapsulated register: " + "src %s, dst %s, mif %d", + ip6_sprintf(ip6bufs, &eip6->ip6_src), + ip6_sprintf(ip6bufd, &eip6->ip6_dst), reg_mif_num); rc = if_simloop(mif6table[reg_mif_num].m6_ifp, m, dst.sin6_family, 0); From owner-svn-src-stable-9@FreeBSD.ORG Thu Jan 16 14:08:14 2014 Return-Path: Delivered-To: svn-src-stable-9@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 5F6F6CB5; Thu, 16 Jan 2014 14:08:14 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4981D1FE9; Thu, 16 Jan 2014 14:08:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0GE8Ece024960; Thu, 16 Jan 2014 14:08:14 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GE8C9m024949; Thu, 16 Jan 2014 14:08:12 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401161408.s0GE8C9m024949@svn.freebsd.org> From: Andriy Gapon Date: Thu, 16 Jan 2014 14:08:12 +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: r260722 - in stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys 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.17 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: Thu, 16 Jan 2014 14:08:14 -0000 Author: avg Date: Thu Jan 16 14:08:11 2014 New Revision: 260722 URL: http://svnweb.freebsd.org/changeset/base/260722 Log: MFC r253821,254753,256259 MFV r253783: 3834 incremental replication of 'holey' file systems is slow MFV r254747:4047 panic from dbuf_free_range() from dmu_free_object() while doing zfs receive MFV r255257: 4082 zfs receive gets EFBIG from dmu_tx_hold_free() Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_impl.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Thu Jan 16 14:05:05 2014 (r260721) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Thu Jan 16 14:08:11 2014 (r260722) @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -39,6 +40,12 @@ #include #include +/* + * Number of times that zfs_free_range() took the slow path while doing + * a zfs receive. A nonzero value indicates a potential performance problem. + */ +uint64_t zfs_free_range_recv_miss; + static void dbuf_destroy(dmu_buf_impl_t *db); static boolean_t dbuf_undirty(dmu_buf_impl_t *db, dmu_tx_t *tx); static void dbuf_write(dbuf_dirty_record_t *dr, arc_buf_t *data, dmu_tx_t *tx); @@ -796,9 +803,12 @@ dbuf_unoverride(dbuf_dirty_record_t *dr) /* * Evict (if its unreferenced) or clear (if its referenced) any level-0 * data blocks in the free range, so that any future readers will find - * empty blocks. Also, if we happen accross any level-1 dbufs in the + * empty blocks. Also, if we happen across any level-1 dbufs in the * range that have not already been marked dirty, mark them dirty so * they stay in memory. + * + * This is a no-op if the dataset is in the middle of an incremental + * receive; see comment below for details. */ void dbuf_free_range(dnode_t *dn, uint64_t start, uint64_t end, dmu_tx_t *tx) @@ -814,7 +824,23 @@ dbuf_free_range(dnode_t *dn, uint64_t st last_l1 = end >> epbs; } dprintf_dnode(dn, "start=%llu end=%llu\n", start, end); + mutex_enter(&dn->dn_dbufs_mtx); + if (start >= dn->dn_unlisted_l0_blkid * dn->dn_datablksz) { + /* There can't be any dbufs in this range; no need to search. */ + mutex_exit(&dn->dn_dbufs_mtx); + return; + } else if (dmu_objset_is_receiving(dn->dn_objset)) { + /* + * If we are receiving, we expect there to be no dbufs in + * the range to be freed, because receive modifies each + * block at most once, and in offset order. If this is + * not the case, it can lead to performance problems, + * so note that we unexpectedly took the slow path. + */ + atomic_inc_64(&zfs_free_range_recv_miss); + } + for (db = list_head(&dn->dn_dbufs); db; db = db_next) { db_next = list_next(&dn->dn_dbufs, db); ASSERT(db->db_blkid != DMU_BONUS_BLKID); @@ -1702,6 +1728,9 @@ dbuf_create(dnode_t *dn, uint8_t level, return (odb); } list_insert_head(&dn->dn_dbufs, db); + if (db->db_level == 0 && db->db_blkid >= + dn->dn_unlisted_l0_blkid) + dn->dn_unlisted_l0_blkid = db->db_blkid + 1; db->db_state = DB_UNCACHED; mutex_exit(&dn->dn_dbufs_mtx); arc_space_consume(sizeof (dmu_buf_impl_t), ARC_SPACE_OTHER); Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Thu Jan 16 14:05:05 2014 (r260721) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Thu Jan 16 14:08:11 2014 (r260722) @@ -575,98 +575,93 @@ dmu_prefetch(objset_t *os, uint64_t obje * the end so that the file gets shorter over time (if we crashes in the * middle, this will leave us in a better state). We find allocated file * data by simply searching the allocated level 1 indirects. + * + * On input, *start should be the first offset that does not need to be + * freed (e.g. "offset + length"). On return, *start will be the first + * offset that should be freed. */ static int -get_next_chunk(dnode_t *dn, uint64_t *start, uint64_t limit) +get_next_chunk(dnode_t *dn, uint64_t *start, uint64_t minimum) { - uint64_t len = *start - limit; - uint64_t blkcnt = 0; - uint64_t maxblks = DMU_MAX_ACCESS / (1ULL << (dn->dn_indblkshift + 1)); + uint64_t maxblks = DMU_MAX_ACCESS >> (dn->dn_indblkshift + 1); + /* bytes of data covered by a level-1 indirect block */ uint64_t iblkrange = dn->dn_datablksz * EPB(dn->dn_indblkshift, SPA_BLKPTRSHIFT); - ASSERT(limit <= *start); + ASSERT3U(minimum, <=, *start); - if (len <= iblkrange * maxblks) { - *start = limit; + if (*start - minimum <= iblkrange * maxblks) { + *start = minimum; return (0); } ASSERT(ISP2(iblkrange)); - while (*start > limit && blkcnt < maxblks) { + for (uint64_t blks = 0; *start > minimum && blks < maxblks; blks++) { int err; - /* find next allocated L1 indirect */ + /* + * dnode_next_offset(BACKWARDS) will find an allocated L1 + * indirect block at or before the input offset. We must + * decrement *start so that it is at the end of the region + * to search. + */ + (*start)--; err = dnode_next_offset(dn, DNODE_FIND_BACKWARDS, start, 2, 1, 0); - /* if there are no more, then we are done */ + /* if there are no indirect blocks before start, we are done */ if (err == ESRCH) { - *start = limit; - return (0); - } else if (err) { + *start = minimum; + break; + } else if (err != 0) { return (err); } - blkcnt += 1; - /* reset offset to end of "next" block back */ + /* set start to the beginning of this L1 indirect */ *start = P2ALIGN(*start, iblkrange); - if (*start <= limit) - *start = limit; - else - *start -= 1; } + if (*start < minimum) + *start = minimum; return (0); } static int dmu_free_long_range_impl(objset_t *os, dnode_t *dn, uint64_t offset, - uint64_t length, boolean_t free_dnode) + uint64_t length) { - dmu_tx_t *tx; - uint64_t object_size, start, end, len; - boolean_t trunc = (length == DMU_OBJECT_END); - int align, err; - - align = 1 << dn->dn_datablkshift; - ASSERT(align > 0); - object_size = align == 1 ? dn->dn_datablksz : - (dn->dn_maxblkid + 1) << dn->dn_datablkshift; - - end = offset + length; - if (trunc || end > object_size) - end = object_size; - if (end <= offset) + uint64_t object_size = (dn->dn_maxblkid + 1) * dn->dn_datablksz; + int err; + + if (offset >= object_size) return (0); - length = end - offset; - while (length) { - start = end; - /* assert(offset <= start) */ - err = get_next_chunk(dn, &start, offset); + if (length == DMU_OBJECT_END || offset + length > object_size) + length = object_size - offset; + + while (length != 0) { + uint64_t chunk_end, chunk_begin; + + chunk_end = chunk_begin = offset + length; + + /* move chunk_begin backwards to the beginning of this chunk */ + err = get_next_chunk(dn, &chunk_begin, offset); if (err) return (err); - len = trunc ? DMU_OBJECT_END : end - start; + ASSERT3U(chunk_begin, >=, offset); + ASSERT3U(chunk_begin, <=, chunk_end); - tx = dmu_tx_create(os); - dmu_tx_hold_free(tx, dn->dn_object, start, len); + dmu_tx_t *tx = dmu_tx_create(os); + dmu_tx_hold_free(tx, dn->dn_object, + chunk_begin, chunk_end - chunk_begin); err = dmu_tx_assign(tx, TXG_WAIT); if (err) { dmu_tx_abort(tx); return (err); } - - dnode_free_range(dn, start, trunc ? -1 : len, tx); - - if (start == 0 && free_dnode) { - ASSERT(trunc); - dnode_free(dn, tx); - } - - length -= end - start; - + dnode_free_range(dn, chunk_begin, chunk_end - chunk_begin, tx); dmu_tx_commit(tx); - end = start; + + length -= chunk_end - chunk_begin; } return (0); } @@ -681,38 +676,42 @@ dmu_free_long_range(objset_t *os, uint64 err = dnode_hold(os, object, FTAG, &dn); if (err != 0) return (err); - err = dmu_free_long_range_impl(os, dn, offset, length, FALSE); + err = dmu_free_long_range_impl(os, dn, offset, length); + + /* + * It is important to zero out the maxblkid when freeing the entire + * file, so that (a) subsequent calls to dmu_free_long_range_impl() + * will take the fast path, and (b) dnode_reallocate() can verify + * that the entire file has been freed. + */ + if (offset == 0 && length == DMU_OBJECT_END) + dn->dn_maxblkid = 0; + dnode_rele(dn, FTAG); return (err); } int -dmu_free_object(objset_t *os, uint64_t object) +dmu_free_long_object(objset_t *os, uint64_t object) { - dnode_t *dn; dmu_tx_t *tx; int err; - err = dnode_hold_impl(os, object, DNODE_MUST_BE_ALLOCATED, - FTAG, &dn); + err = dmu_free_long_range(os, object, 0, DMU_OBJECT_END); if (err != 0) return (err); - if (dn->dn_nlevels == 1) { - tx = dmu_tx_create(os); - dmu_tx_hold_bonus(tx, object); - dmu_tx_hold_free(tx, dn->dn_object, 0, DMU_OBJECT_END); - err = dmu_tx_assign(tx, TXG_WAIT); - if (err == 0) { - dnode_free_range(dn, 0, DMU_OBJECT_END, tx); - dnode_free(dn, tx); - dmu_tx_commit(tx); - } else { - dmu_tx_abort(tx); - } + + tx = dmu_tx_create(os); + dmu_tx_hold_bonus(tx, object); + dmu_tx_hold_free(tx, object, 0, DMU_OBJECT_END); + err = dmu_tx_assign(tx, TXG_WAIT); + if (err == 0) { + err = dmu_object_free(os, object, tx); + dmu_tx_commit(tx); } else { - err = dmu_free_long_range_impl(os, dn, 0, DMU_OBJECT_END, TRUE); + dmu_tx_abort(tx); } - dnode_rele(dn, FTAG); + return (err); } Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Thu Jan 16 14:05:05 2014 (r260721) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Thu Jan 16 14:08:11 2014 (r260722) @@ -96,6 +96,32 @@ dump_free(dmu_sendarg_t *dsp, uint64_t o { struct drr_free *drrf = &(dsp->dsa_drr->drr_u.drr_free); + /* + * When we receive a free record, dbuf_free_range() assumes + * that the receiving system doesn't have any dbufs in the range + * being freed. This is always true because there is a one-record + * constraint: we only send one WRITE record for any given + * object+offset. We know that the one-record constraint is + * true because we always send data in increasing order by + * object,offset. + * + * If the increasing-order constraint ever changes, we should find + * another way to assert that the one-record constraint is still + * satisfied. + */ + ASSERT(object > dsp->dsa_last_data_object || + (object == dsp->dsa_last_data_object && + offset > dsp->dsa_last_data_offset)); + + /* + * If we are doing a non-incremental send, then there can't + * be any data in the dataset we're receiving into. Therefore + * a free record would simply be a no-op. Save space by not + * sending it to begin with. + */ + if (!dsp->dsa_incremental) + return (0); + if (length != -1ULL && offset + length < offset) length = -1ULL; @@ -162,6 +188,15 @@ dump_data(dmu_sendarg_t *dsp, dmu_object { struct drr_write *drrw = &(dsp->dsa_drr->drr_u.drr_write); + /* + * We send data in increasing object, offset order. + * See comment in dump_free() for details. + */ + ASSERT(object > dsp->dsa_last_data_object || + (object == dsp->dsa_last_data_object && + offset > dsp->dsa_last_data_offset)); + dsp->dsa_last_data_object = object; + dsp->dsa_last_data_offset = offset + blksz - 1; /* * If there is any kind of pending aggregation (currently either @@ -229,6 +264,10 @@ dump_freeobjects(dmu_sendarg_t *dsp, uin { struct drr_freeobjects *drrfo = &(dsp->dsa_drr->drr_u.drr_freeobjects); + /* See comment in dump_free(). */ + if (!dsp->dsa_incremental) + return (0); + /* * If there is a pending op, but it's not PENDING_FREEOBJECTS, * push it out, since free block aggregation can only be done for @@ -305,9 +344,9 @@ dump_dnode(dmu_sendarg_t *dsp, uint64_t if (dump_bytes(dsp, DN_BONUS(dnp), P2ROUNDUP(dnp->dn_bonuslen, 8)) != 0) return (SET_ERROR(EINTR)); - /* free anything past the end of the file */ + /* Free anything past the end of the file. */ if (dump_free(dsp, object, (dnp->dn_maxblkid + 1) * - (dnp->dn_datablkszsec << SPA_MINBLOCKSHIFT), -1ULL)) + (dnp->dn_datablkszsec << SPA_MINBLOCKSHIFT), -1ULL) != 0) return (SET_ERROR(EINTR)); if (dsp->dsa_err != 0) return (SET_ERROR(EINTR)); @@ -495,6 +534,7 @@ dmu_send_impl(void *tag, dsl_pool_t *dp, dsp->dsa_toguid = ds->ds_phys->ds_guid; ZIO_SET_CHECKSUM(&dsp->dsa_zc, 0, 0, 0, 0); dsp->dsa_pending_op = PENDING_NONE; + dsp->dsa_incremental = (fromtxg != 0); mutex_enter(&ds->ds_sendstream_lock); list_insert_head(&ds->ds_sendstreams, dsp); @@ -1238,7 +1278,7 @@ restore_freeobjects(struct restorearg *r if (dmu_object_info(os, obj, NULL) != 0) continue; - err = dmu_free_object(os, obj); + err = dmu_free_long_object(os, obj); if (err != 0) return (err); } @@ -1764,3 +1804,13 @@ dmu_recv_end(dmu_recv_cookie_t *drc, voi else return (dmu_recv_existing_end(drc)); } + +/* + * Return TRUE if this objset is currently being received into. + */ +boolean_t +dmu_objset_is_receiving(objset_t *os) +{ + return (os->os_dsl_dataset != NULL && + os->os_dsl_dataset->ds_owner == dmu_recv_tag); +} Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c Thu Jan 16 14:05:05 2014 (r260721) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c Thu Jan 16 14:08:11 2014 (r260722) @@ -587,8 +587,7 @@ dmu_tx_hold_free(dmu_tx_t *tx, uint64_t { dmu_tx_hold_t *txh; dnode_t *dn; - uint64_t start, end, i; - int err, shift; + int err; zio_t *zio; ASSERT(tx->tx_txg == 0); @@ -599,34 +598,49 @@ dmu_tx_hold_free(dmu_tx_t *tx, uint64_t return; dn = txh->txh_dnode; - /* first block */ - if (off != 0) - dmu_tx_count_write(txh, off, 1); - /* last block */ - if (len != DMU_OBJECT_END) - dmu_tx_count_write(txh, off+len, 1); - - dmu_tx_count_dnode(txh); - if (off >= (dn->dn_maxblkid+1) * dn->dn_datablksz) return; if (len == DMU_OBJECT_END) len = (dn->dn_maxblkid+1) * dn->dn_datablksz - off; + dmu_tx_count_dnode(txh); + /* - * For i/o error checking, read the first and last level-0 - * blocks, and all the level-1 blocks. The above count_write's - * have already taken care of the level-0 blocks. + * For i/o error checking, we read the first and last level-0 + * blocks if they are not aligned, and all the level-1 blocks. + * + * Note: dbuf_free_range() assumes that we have not instantiated + * any level-0 dbufs that will be completely freed. Therefore we must + * exercise care to not read or count the first and last blocks + * if they are blocksize-aligned. + */ + if (dn->dn_datablkshift == 0) { + if (off != 0 || len < dn->dn_datablksz) + dmu_tx_count_write(txh, 0, dn->dn_datablksz); + } else { + /* first block will be modified if it is not aligned */ + if (!IS_P2ALIGNED(off, 1 << dn->dn_datablkshift)) + dmu_tx_count_write(txh, off, 1); + /* last block will be modified if it is not aligned */ + if (!IS_P2ALIGNED(off + len, 1 << dn->dn_datablkshift)) + dmu_tx_count_write(txh, off+len, 1); + } + + /* + * Check level-1 blocks. */ if (dn->dn_nlevels > 1) { - shift = dn->dn_datablkshift + dn->dn_indblkshift - + int shift = dn->dn_datablkshift + dn->dn_indblkshift - SPA_BLKPTRSHIFT; - start = off >> shift; - end = dn->dn_datablkshift ? ((off+len) >> shift) : 0; + uint64_t start = off >> shift; + uint64_t end = (off + len) >> shift; + + ASSERT(dn->dn_datablkshift != 0); + ASSERT(dn->dn_indblkshift != 0); zio = zio_root(tx->tx_pool->dp_spa, NULL, NULL, ZIO_FLAG_CANFAIL); - for (i = start; i <= end; i++) { + for (uint64_t i = start; i <= end; i++) { uint64_t ibyte = i << shift; err = dnode_next_offset(dn, 0, &ibyte, 2, 1, 0); i = ibyte >> shift; Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Thu Jan 16 14:05:05 2014 (r260721) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Thu Jan 16 14:08:11 2014 (r260722) @@ -117,6 +117,7 @@ dnode_cons(void *arg, void *unused, int dn->dn_id_flags = 0; dn->dn_dbufs_count = 0; + dn->dn_unlisted_l0_blkid = 0; list_create(&dn->dn_dbufs, sizeof (dmu_buf_impl_t), offsetof(dmu_buf_impl_t, db_link)); @@ -170,6 +171,7 @@ dnode_dest(void *arg, void *unused) ASSERT0(dn->dn_id_flags); ASSERT0(dn->dn_dbufs_count); + ASSERT0(dn->dn_unlisted_l0_blkid); list_destroy(&dn->dn_dbufs); } @@ -475,6 +477,7 @@ dnode_destroy(dnode_t *dn) dn->dn_newuid = 0; dn->dn_newgid = 0; dn->dn_id_flags = 0; + dn->dn_unlisted_l0_blkid = 0; dmu_zfetch_rele(&dn->dn_zfetch); kmem_cache_free(dnode_cache, dn); @@ -705,6 +708,7 @@ dnode_move_impl(dnode_t *odn, dnode_t *n ASSERT(list_is_empty(&ndn->dn_dbufs)); list_move_tail(&ndn->dn_dbufs, &odn->dn_dbufs); ndn->dn_dbufs_count = odn->dn_dbufs_count; + ndn->dn_unlisted_l0_blkid = odn->dn_unlisted_l0_blkid; ndn->dn_bonus = odn->dn_bonus; ndn->dn_have_spill = odn->dn_have_spill; ndn->dn_zio = odn->dn_zio; @@ -739,6 +743,7 @@ dnode_move_impl(dnode_t *odn, dnode_t *n list_create(&odn->dn_dbufs, sizeof (dmu_buf_impl_t), offsetof(dmu_buf_impl_t, db_link)); odn->dn_dbufs_count = 0; + odn->dn_unlisted_l0_blkid = 0; odn->dn_bonus = NULL; odn->dn_zfetch.zf_dnode = NULL; @@ -1528,7 +1533,7 @@ dnode_free_range(dnode_t *dn, uint64_t o blkshift = dn->dn_datablkshift; epbs = dn->dn_indblkshift - SPA_BLKPTRSHIFT; - if (len == -1ULL) { + if (len == DMU_OBJECT_END) { len = UINT64_MAX - off; trunc = TRUE; } Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c Thu Jan 16 14:05:05 2014 (r260721) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c Thu Jan 16 14:08:11 2014 (r260722) @@ -899,7 +899,7 @@ dsl_destroy_head(const char *name) for (uint64_t obj = 0; error == 0; error = dmu_object_next(os, &obj, FALSE, prev_snap_txg)) - (void) dmu_free_object(os, obj); + (void) dmu_free_long_object(os, obj); /* sync out all frees */ txg_wait_synced(dmu_objset_pool(os), 0); dmu_objset_disown(os, FTAG); Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Thu Jan 16 14:05:05 2014 (r260721) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Thu Jan 16 14:08:11 2014 (r260722) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. */ @@ -583,7 +583,7 @@ int dmu_free_range(objset_t *os, uint64_ uint64_t size, dmu_tx_t *tx); int dmu_free_long_range(objset_t *os, uint64_t object, uint64_t offset, uint64_t size); -int dmu_free_object(objset_t *os, uint64_t object); +int dmu_free_long_object(objset_t *os, uint64_t object); /* * Convenience functions. Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_impl.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_impl.h Thu Jan 16 14:05:05 2014 (r260721) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_impl.h Thu Jan 16 14:08:11 2014 (r260722) @@ -21,8 +21,11 @@ /* * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + */ +/* * Copyright (c) 2012, Joyent, Inc. All rights reserved. * Copyright (c) 2012, Martin Matuska . All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. */ #ifndef _SYS_DMU_IMPL_H @@ -293,6 +296,9 @@ typedef struct dmu_sendarg { uint64_t dsa_toguid; int dsa_err; dmu_pendop_t dsa_pending_op; + boolean_t dsa_incremental; + uint64_t dsa_last_data_object; + uint64_t dsa_last_data_offset; } dmu_sendarg_t; Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h Thu Jan 16 14:05:05 2014 (r260721) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h Thu Jan 16 14:08:11 2014 (r260722) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. */ @@ -74,5 +74,6 @@ int dmu_recv_stream(dmu_recv_cookie_t *d #endif int cleanup_fd, uint64_t *action_handlep); int dmu_recv_end(dmu_recv_cookie_t *drc, void *owner); +boolean_t dmu_objset_is_receiving(objset_t *os); #endif /* _DMU_SEND_H */ Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Thu Jan 16 14:05:05 2014 (r260721) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Thu Jan 16 14:08:11 2014 (r260722) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. */ #ifndef _SYS_DNODE_H @@ -188,6 +188,8 @@ typedef struct dnode { /* protected by dn_dbufs_mtx; declared here to fill 32-bit hole */ uint32_t dn_dbufs_count; /* count of dn_dbufs */ + /* There are no level-0 blocks of this blkid or higher in dn_dbufs */ + uint64_t dn_unlisted_l0_blkid; /* protected by os_lock: */ list_node_t dn_dirty_link[TXG_SIZE]; /* next on dataset's dirty */ From owner-svn-src-stable-9@FreeBSD.ORG Thu Jan 16 14:11:56 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C1A0AFD0; Thu, 16 Jan 2014 14:11:56 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AE50910AB; Thu, 16 Jan 2014 14:11:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0GEBuqA028216; Thu, 16 Jan 2014 14:11:56 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GEBu4n028215; Thu, 16 Jan 2014 14:11:56 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401161411.s0GEBu4n028215@svn.freebsd.org> From: Andriy Gapon Date: Thu, 16 Jan 2014 14:11:56 +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: r260724 - stable/9/sys/kern 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.17 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: Thu, 16 Jan 2014 14:11:56 -0000 Author: avg Date: Thu Jan 16 14:11:56 2014 New Revision: 260724 URL: http://svnweb.freebsd.org/changeset/base/260724 Log: MFC r258354: taskqueue_cancel: garbage collect a write-only variable Modified: stable/9/sys/kern/subr_taskqueue.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/subr_taskqueue.c ============================================================================== --- stable/9/sys/kern/subr_taskqueue.c Thu Jan 16 14:11:45 2014 (r260723) +++ stable/9/sys/kern/subr_taskqueue.c Thu Jan 16 14:11:56 2014 (r260724) @@ -356,11 +356,9 @@ taskqueue_cancel_locked(struct taskqueue int taskqueue_cancel(struct taskqueue *queue, struct task *task, u_int *pendp) { - u_int pending; int error; TQ_LOCK(queue); - pending = task->ta_pending; error = taskqueue_cancel_locked(queue, task, pendp); TQ_UNLOCK(queue); From owner-svn-src-stable-9@FreeBSD.ORG Thu Jan 16 14:15:04 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C67C237E; Thu, 16 Jan 2014 14:15:04 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9956A10DE; Thu, 16 Jan 2014 14:15:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0GEF4vY028885; Thu, 16 Jan 2014 14:15:04 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GEF43d028884; Thu, 16 Jan 2014 14:15:04 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401161415.s0GEF43d028884@svn.freebsd.org> From: Andriy Gapon Date: Thu, 16 Jan 2014 14:15:04 +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: r260726 - stable/9/tools/regression/fsx 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.17 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: Thu, 16 Jan 2014 14:15:04 -0000 Author: avg Date: Thu Jan 16 14:15:04 2014 New Revision: 260726 URL: http://svnweb.freebsd.org/changeset/base/260726 Log: MFC r258351: fsx: new option to disable msync(MS_SYNC) after each write Modified: stable/9/tools/regression/fsx/fsx.c Directory Properties: stable/9/tools/regression/fsx/ (props changed) Modified: stable/9/tools/regression/fsx/fsx.c ============================================================================== --- stable/9/tools/regression/fsx/fsx.c Thu Jan 16 14:14:49 2014 (r260725) +++ stable/9/tools/regression/fsx/fsx.c Thu Jan 16 14:15:04 2014 (r260726) @@ -126,6 +126,7 @@ int randomoplen = 1; /* -O flag disable int seed = 1; /* -S flag */ int mapped_writes = 1; /* -W flag disables */ int mapped_reads = 1; /* -R flag disables it */ +int mapped_msync = 1; /* -U flag disables */ int fsxgoodfd = 0; FILE * fsxlogf = NULL; int badoff = -1; @@ -679,12 +680,12 @@ domapwrite(unsigned offset, unsigned siz if ((p = (char *)mmap(0, map_size, PROT_READ | PROT_WRITE, MAP_FILE | MAP_SHARED, fd, - (off_t)(offset - pg_offset))) == (char *)-1) { + (off_t)(offset - pg_offset))) == MAP_FAILED) { prterr("domapwrite: mmap"); report_failure(202); } memcpy(p + pg_offset, good_buf + offset, size); - if (msync(p, map_size, 0) != 0) { + if (mapped_msync && msync(p, map_size, MS_SYNC) != 0) { prterr("domapwrite: msync"); report_failure(203); } @@ -886,6 +887,7 @@ usage(void) -S seed: for random # generator (default 1) 0 gets timestamp\n\ -W: mapped write operations DISabled\n\ -R: mapped read operations DISabled)\n\ + -U: msync after mapped write operations DISabled\n\ fname: this filename is REQUIRED (no default)\n"); exit(90); } @@ -941,8 +943,8 @@ main(int argc, char **argv) setvbuf(stdout, (char *)0, _IOLBF, 0); /* line buffered stdout */ - while ((ch = getopt(argc, argv, "b:c:dl:m:no:p:qr:s:t:w:D:LN:OP:RS:W")) - != -1) + while ((ch = getopt(argc, argv, + "b:c:dl:m:no:p:qr:s:t:w:D:LN:OP:RS:UW")) != -1) switch (ch) { case 'b': simulatedopcount = getnum(optarg, &endp); @@ -1057,6 +1059,11 @@ main(int argc, char **argv) if (!quiet) fprintf(stdout, "mapped writes DISABLED\n"); break; + case 'U': + mapped_msync = 0; + if (!quiet) + fprintf(stdout, "mapped msync DISABLED\n"); + break; default: usage(); From owner-svn-src-stable-9@FreeBSD.ORG Thu Jan 16 14:17:45 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1AEA475A; Thu, 16 Jan 2014 14:17:45 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id EFCB51103; Thu, 16 Jan 2014 14:17:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0GEHit1029312; Thu, 16 Jan 2014 14:17:44 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GEHirX029311; Thu, 16 Jan 2014 14:17:44 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401161417.s0GEHirX029311@svn.freebsd.org> From: Andriy Gapon Date: Thu, 16 Jan 2014 14:17:44 +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: r260729 - stable/9/tools/regression/fsx 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.17 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: Thu, 16 Jan 2014 14:17:45 -0000 Author: avg Date: Thu Jan 16 14:17:44 2014 New Revision: 260729 URL: http://svnweb.freebsd.org/changeset/base/260729 Log: MFC r258352: fsx: add an option to randomly call msync(MS_INVALIDATE) Modified: stable/9/tools/regression/fsx/fsx.c Directory Properties: stable/9/tools/regression/fsx/ (props changed) Modified: stable/9/tools/regression/fsx/fsx.c ============================================================================== --- stable/9/tools/regression/fsx/fsx.c Thu Jan 16 14:17:31 2014 (r260728) +++ stable/9/tools/regression/fsx/fsx.c Thu Jan 16 14:17:44 2014 (r260729) @@ -90,6 +90,7 @@ int logcount = 0; /* total ops */ #define OP_MAPREAD 5 #define OP_MAPWRITE 6 #define OP_SKIPPED 7 +#define OP_INVALIDATE 8 int page_size; int page_mask; @@ -107,6 +108,7 @@ unsigned long testcalls = 0; /* calls t unsigned long simulatedopcount = 0; /* -b flag */ int closeprob = 0; /* -c flag */ +int invlprob = 0; /* -i flag */ int debug = 0; /* -d flag */ unsigned long debugstart = 0; /* -D flag */ unsigned long maxfilelen = 256 * 1024; /* -l flag */ @@ -131,6 +133,7 @@ int fsxgoodfd = 0; FILE * fsxlogf = NULL; int badoff = -1; int closeopen = 0; +int invl = 0; void @@ -182,14 +185,12 @@ prterr(char *prefix) void -log4(int operation, int arg0, int arg1, int arg2) +do_log4(int operation, int arg0, int arg1, int arg2) { struct log_entry *le; le = &oplog[logptr]; le->operation = operation; - if (closeopen) - le->operation = ~ le->operation; le->args[0] = arg0; le->args[1] = arg1; le->args[2] = arg2; @@ -201,10 +202,21 @@ log4(int operation, int arg0, int arg1, void +log4(int operation, int arg0, int arg1, int arg2) +{ + do_log4(operation, arg0, arg1, arg2); + if (closeopen) + do_log4(OP_CLOSEOPEN, 0, 0, 0); + if (invl) + do_log4(OP_INVALIDATE, 0, 0, 0); +} + + +void logdump(void) { - int i, count, down; struct log_entry *lp; + int i, count, down, opnum; prt("LOG DUMP (%d total operations):\n", logcount); if (logcount < LOGSIZE) { @@ -214,15 +226,28 @@ logdump(void) i = logptr; count = LOGSIZE; } + + opnum = i + 1 + (logcount/LOGSIZE)*LOGSIZE; for ( ; count > 0; count--) { - int opnum; + lp = &oplog[i]; + + if (lp->operation == OP_CLOSEOPEN || + lp->operation == OP_INVALIDATE) { + switch (lp->operation) { + case OP_CLOSEOPEN: + prt("\t\tCLOSE/OPEN\n"); + break; + case OP_INVALIDATE: + prt("\t\tMS_INVALIDATE\n"); + break; + } + i++; + if (i == LOGSIZE) + i = 0; + continue; + } - opnum = i+1 + (logcount/LOGSIZE)*LOGSIZE; prt("%d(%d mod 256): ", opnum, opnum%256); - lp = &oplog[i]; - if ((closeopen = lp->operation < 0)) - lp->operation = ~ lp->operation; - switch (lp->operation) { case OP_MAPREAD: prt("MAPREAD\t0x%x thru 0x%x\t(0x%x bytes)", @@ -275,9 +300,8 @@ logdump(void) prt("BOGUS LOG ENTRY (operation code = %d)!", lp->operation); } - if (closeopen) - prt("\n\t\tCLOSE/OPEN"); prt("\n"); + opnum++; i++; if (i == LOGSIZE) i = 0; @@ -779,6 +803,36 @@ docloseopen(void) void +doinvl(void) +{ + char *p; + + if (file_size == 0) + return; + if (testcalls <= simulatedopcount) + return; + if (debug) + prt("%lu msync(MS_INVALIDATE)\n", testcalls); + + if ((p = (char *)mmap(0, file_size, PROT_READ | PROT_WRITE, + MAP_FILE | MAP_SHARED, fd, 0)) == MAP_FAILED) { + prterr("doinvl: mmap"); + report_failure(205); + } + + if (msync(p, 0, MS_SYNC | MS_INVALIDATE) != 0) { + prterr("doinvl: msync"); + report_failure(206); + } + + if (munmap(p, file_size) != 0) { + prterr("doinvl: munmap"); + report_failure(207); + } +} + + +void test(void) { unsigned long offset; @@ -798,6 +852,8 @@ test(void) if (closeprob) closeopen = (rv >> 3) < (1 << 28) / closeprob; + if (invlprob) + invl = (rv >> 3) < (1 << 28) / invlprob; if (debugstart > 0 && testcalls >= debugstart) debug = 1; @@ -845,6 +901,8 @@ test(void) } if (sizechecks && testcalls > simulatedopcount) check_size(); + if (invl) + doinvl(); if (closeopen) docloseopen(); } @@ -869,6 +927,7 @@ usage(void) -b opnum: beginning operation number (default 1)\n\ -c P: 1 in P chance of file close+open at each op (default infinity)\n\ -d: debug output for all operations\n\ + -i P: 1 in P chance of calling msync(MS_INVALIDATE) (default infinity)\n\ -l flen: the upper bound on file size (default 262144)\n\ -m startop:endop: monitor (print debug output) specified byte range (default 0:infinity)\n\ -n: no verifications of file size\n\ @@ -944,7 +1003,7 @@ main(int argc, char **argv) setvbuf(stdout, (char *)0, _IOLBF, 0); /* line buffered stdout */ while ((ch = getopt(argc, argv, - "b:c:dl:m:no:p:qr:s:t:w:D:LN:OP:RS:UW")) != -1) + "b:c:di:l:m:no:p:qr:s:t:w:D:LN:OP:RS:UW")) != -1) switch (ch) { case 'b': simulatedopcount = getnum(optarg, &endp); @@ -967,6 +1026,15 @@ main(int argc, char **argv) case 'd': debug = 1; break; + case 'i': + invlprob = getnum(optarg, &endp); + if (!quiet) + fprintf(stdout, + "Chance of MS_INVALIDATE is 1 in %d\n", + invlprob); + if (invlprob <= 0) + usage(); + break; case 'l': maxfilelen = getnum(optarg, &endp); if (maxfilelen <= 0) From owner-svn-src-stable-9@FreeBSD.ORG Thu Jan 16 14:21:42 2014 Return-Path: Delivered-To: svn-src-stable-9@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 9170DC57; Thu, 16 Jan 2014 14:21:42 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7D62E119F; Thu, 16 Jan 2014 14:21:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0GELgql031847; Thu, 16 Jan 2014 14:21:42 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GELgXp031846; Thu, 16 Jan 2014 14:21:42 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401161421.s0GELgXp031846@svn.freebsd.org> From: Andriy Gapon Date: Thu, 16 Jan 2014 14:21:42 +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: r260732 - stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.17 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: Thu, 16 Jan 2014 14:21:42 -0000 Author: avg Date: Thu Jan 16 14:21:41 2014 New Revision: 260732 URL: http://svnweb.freebsd.org/changeset/base/260732 Log: MFC r258638,258642: expose zfs_flags as debug.zfs_flags r/w tunable and sysctl Sponsored by: HybridCluster Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Thu Jan 16 14:21:24 2014 (r260731) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Thu Jan 16 14:21:41 2014 (r260732) @@ -243,6 +243,10 @@ int zfs_flags = ~(ZFS_DEBUG_DPRINTF | ZF #else int zfs_flags = 0; #endif +SYSCTL_DECL(_debug); +TUNABLE_INT("debug.zfs_flags", &zfs_flags); +SYSCTL_INT(_debug, OID_AUTO, zfs_flags, CTLFLAG_RWTUN, &zfs_flags, 0, + "ZFS debug flags."); /* * zfs_recover can be set to nonzero to attempt to recover from From owner-svn-src-stable-9@FreeBSD.ORG Thu Jan 16 14:24:22 2014 Return-Path: Delivered-To: svn-src-stable-9@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 B0365FF6; Thu, 16 Jan 2014 14:24:22 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9C57311BF; Thu, 16 Jan 2014 14:24:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0GEOMRK032434; Thu, 16 Jan 2014 14:24:22 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GEOMWD032433; Thu, 16 Jan 2014 14:24:22 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401161424.s0GEOMWD032433@svn.freebsd.org> From: Andriy Gapon Date: Thu, 16 Jan 2014 14:24:22 +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: r260734 - stable/9/tools/tools/zfsboottest 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.17 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: Thu, 16 Jan 2014 14:24:22 -0000 Author: avg Date: Thu Jan 16 14:24:22 2014 New Revision: 260734 URL: http://svnweb.freebsd.org/changeset/base/260734 Log: MFC r258647: zfsboottest: properly specify a library dependency Modified: stable/9/tools/tools/zfsboottest/Makefile Directory Properties: stable/9/tools/tools/zfsboottest/ (props changed) Modified: stable/9/tools/tools/zfsboottest/Makefile ============================================================================== --- stable/9/tools/tools/zfsboottest/Makefile Thu Jan 16 14:22:03 2014 (r260733) +++ stable/9/tools/tools/zfsboottest/Makefile Thu Jan 16 14:24:22 2014 (r260734) @@ -16,7 +16,7 @@ CFLAGS= -O1 \ -I. \ -fdiagnostics-show-option \ -W -Wextra -Wno-sign-compare -Wno-unused-parameter -LDFLAGS+=-lmd +LDADD+= -lmd .if ${MACHINE_CPUARCH} == "amd64" beforedepend zfsboottest.o: machine From owner-svn-src-stable-9@FreeBSD.ORG Thu Jan 16 14:27:29 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E39085DF; Thu, 16 Jan 2014 14:27:29 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D06AF11F6; Thu, 16 Jan 2014 14:27:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0GERTaZ032960; Thu, 16 Jan 2014 14:27:29 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GERTuh032959; Thu, 16 Jan 2014 14:27:29 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401161427.s0GERTuh032959@svn.freebsd.org> From: Andriy Gapon Date: Thu, 16 Jan 2014 14:27:29 +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: r260738 - stable/9/sys/kern 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.17 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: Thu, 16 Jan 2014 14:27:30 -0000 Author: avg Date: Thu Jan 16 14:27:29 2014 New Revision: 260738 URL: http://svnweb.freebsd.org/changeset/base/260738 Log: MFC r258648: use saner calculations in should_yield Modified: stable/9/sys/kern/kern_synch.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_synch.c ============================================================================== --- stable/9/sys/kern/kern_synch.c Thu Jan 16 14:27:20 2014 (r260737) +++ stable/9/sys/kern/kern_synch.c Thu Jan 16 14:27:29 2014 (r260738) @@ -578,7 +578,7 @@ int should_yield(void) { - return ((unsigned int)(ticks - curthread->td_swvoltick) >= hogticks); + return ((u_int)ticks - (u_int)curthread->td_swvoltick >= hogticks); } void From owner-svn-src-stable-9@FreeBSD.ORG Thu Jan 16 14:30:36 2014 Return-Path: Delivered-To: svn-src-stable-9@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 990998AD; Thu, 16 Jan 2014 14:30:36 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7AE001217; Thu, 16 Jan 2014 14:30:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0GEUaVv035988; Thu, 16 Jan 2014 14:30:36 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GEUaZZ035986; Thu, 16 Jan 2014 14:30:36 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401161430.s0GEUaZZ035986@svn.freebsd.org> From: Andriy Gapon Date: Thu, 16 Jan 2014 14:30:36 +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: r260740 - in stable/9/sys/cddl: compat/opensolaris/kern contrib/opensolaris/uts/common/sys 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.17 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: Thu, 16 Jan 2014 14:30:36 -0000 Author: avg Date: Thu Jan 16 14:30:35 2014 New Revision: 260740 URL: http://svnweb.freebsd.org/changeset/base/260740 Log: MFC r258628: opensolaris taskq: some cosmetic changes Modified: stable/9/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c stable/9/sys/cddl/contrib/opensolaris/uts/common/sys/taskq.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c ============================================================================== --- stable/9/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c Thu Jan 16 14:30:26 2014 (r260739) +++ stable/9/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c Thu Jan 16 14:30:35 2014 (r260740) @@ -121,7 +121,7 @@ taskq_dispatch(taskq_t *tq, task_func_t mflag = M_WAITOK; else mflag = M_NOWAIT; - /* + /* * If TQ_FRONT is given, we want higher priority for this task, so it * can go at the front of the queue. */ @@ -140,8 +140,6 @@ taskq_dispatch(taskq_t *tq, task_func_t return ((taskqid_t)(void *)task); } -#define TASKQ_MAGIC 0x74541c - static void taskq_run_safe(void *arg, int pending __unused) { @@ -156,7 +154,7 @@ taskq_dispatch_safe(taskq_t *tq, task_fu { int prio; - /* + /* * If TQ_FRONT is given, we want higher priority for this task, so it * can go at the front of the queue. */ Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/sys/taskq.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/sys/taskq.h Thu Jan 16 14:30:26 2014 (r260739) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/sys/taskq.h Thu Jan 16 14:30:35 2014 (r260740) @@ -70,24 +70,23 @@ struct proc; extern taskq_t *system_taskq; -extern void taskq_init(void); -extern void taskq_mp_init(void); +void taskq_init(void); +void taskq_mp_init(void); -extern taskq_t *taskq_create(const char *, int, pri_t, int, int, uint_t); -extern taskq_t *taskq_create_instance(const char *, int, int, pri_t, int, - int, uint_t); -extern taskq_t *taskq_create_proc(const char *, int, pri_t, int, int, +taskq_t *taskq_create(const char *, int, pri_t, int, int, uint_t); +taskq_t *taskq_create_instance(const char *, int, int, pri_t, int, int, uint_t); +taskq_t *taskq_create_proc(const char *, int, pri_t, int, int, struct proc *, uint_t); -extern taskq_t *taskq_create_sysdc(const char *, int, int, int, +taskq_t *taskq_create_sysdc(const char *, int, int, int, struct proc *, uint_t, uint_t); -extern taskqid_t taskq_dispatch(taskq_t *, task_func_t, void *, uint_t); -extern void nulltask(void *); -extern void taskq_destroy(taskq_t *); -extern void taskq_wait(taskq_t *); -extern void taskq_suspend(taskq_t *); -extern int taskq_suspended(taskq_t *); -extern void taskq_resume(taskq_t *); -extern int taskq_member(taskq_t *, kthread_t *); +taskqid_t taskq_dispatch(taskq_t *, task_func_t, void *, uint_t); +void nulltask(void *); +void taskq_destroy(taskq_t *); +void taskq_wait(taskq_t *); +void taskq_suspend(taskq_t *); +int taskq_suspended(taskq_t *); +void taskq_resume(taskq_t *); +int taskq_member(taskq_t *, kthread_t *); #endif /* _KERNEL */ From owner-svn-src-stable-9@FreeBSD.ORG Thu Jan 16 14:35:08 2014 Return-Path: Delivered-To: svn-src-stable-9@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 312E6D21; Thu, 16 Jan 2014 14:35:08 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1263112AD; Thu, 16 Jan 2014 14:35:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0GEZ7Sl036689; Thu, 16 Jan 2014 14:35:07 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GEZ7YT036683; Thu, 16 Jan 2014 14:35:07 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401161435.s0GEZ7YT036683@svn.freebsd.org> From: Andriy Gapon Date: Thu, 16 Jan 2014 14:35:07 +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: r260743 - in stable/9/sys/cddl: compat/opensolaris/kern compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/fs/zfs/sys contrib/opensolaris/uts/co... 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.17 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: Thu, 16 Jan 2014 14:35:08 -0000 Author: avg Date: Thu Jan 16 14:35:06 2014 New Revision: 260743 URL: http://svnweb.freebsd.org/changeset/base/260743 Log: MFC r258630: 734 taskq_dispatch_prealloc() desired Deleted: stable/9/sys/cddl/compat/opensolaris/sys/taskq.h Modified: stable/9/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c stable/9/sys/cddl/contrib/opensolaris/uts/common/sys/taskq.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c ============================================================================== --- stable/9/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c Thu Jan 16 14:34:53 2014 (r260742) +++ stable/9/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c Thu Jan 16 14:35:06 2014 (r260743) @@ -46,7 +46,7 @@ static void system_taskq_init(void *arg) { - taskq_zone = uma_zcreate("taskq_zone", sizeof(struct ostask), + taskq_zone = uma_zcreate("taskq_zone", sizeof(taskq_ent_t), NULL, NULL, NULL, NULL, 0, 0); system_taskq = taskq_create("system_taskq", mp_ncpus, 0, 0, 0, 0); } @@ -104,9 +104,9 @@ taskq_member(taskq_t *tq, kthread_t *thr static void taskq_run(void *arg, int pending __unused) { - struct ostask *task = arg; + taskq_ent_t *task = arg; - task->ost_func(task->ost_arg); + task->tqent_func(task->tqent_arg); uma_zfree(taskq_zone, task); } @@ -114,7 +114,7 @@ taskq_run(void *arg, int pending __unuse taskqid_t taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) { - struct ostask *task; + taskq_ent_t *task; int mflag, prio; if ((flags & (TQ_SLEEP | TQ_NOQUEUE)) == TQ_SLEEP) @@ -131,26 +131,26 @@ taskq_dispatch(taskq_t *tq, task_func_t if (task == NULL) return (0); - task->ost_func = func; - task->ost_arg = arg; + task->tqent_func = func; + task->tqent_arg = arg; - TASK_INIT(&task->ost_task, prio, taskq_run, task); - taskqueue_enqueue(tq->tq_queue, &task->ost_task); + TASK_INIT(&task->tqent_task, prio, taskq_run, task); + taskqueue_enqueue(tq->tq_queue, &task->tqent_task); return ((taskqid_t)(void *)task); } static void -taskq_run_safe(void *arg, int pending __unused) +taskq_run_ent(void *arg, int pending __unused) { - struct ostask *task = arg; + taskq_ent_t *task = arg; - task->ost_func(task->ost_arg); + task->tqent_func(task->tqent_arg); } -taskqid_t -taskq_dispatch_safe(taskq_t *tq, task_func_t func, void *arg, u_int flags, - struct ostask *task) +void +taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, u_int flags, + taskq_ent_t *task) { int prio; @@ -160,11 +160,9 @@ taskq_dispatch_safe(taskq_t *tq, task_fu */ prio = !!(flags & TQ_FRONT); - task->ost_func = func; - task->ost_arg = arg; + task->tqent_func = func; + task->tqent_arg = arg; - TASK_INIT(&task->ost_task, prio, taskq_run_safe, task); - taskqueue_enqueue(tq->tq_queue, &task->ost_task); - - return ((taskqid_t)(void *)task); + TASK_INIT(&task->tqent_task, prio, taskq_run_ent, task); + taskqueue_enqueue(tq->tq_queue, &task->tqent_task); } Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu Jan 16 14:34:53 2014 (r260742) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu Jan 16 14:35:06 2014 (r260743) @@ -823,7 +823,7 @@ static taskq_t * spa_taskq_create(spa_t *spa, const char *name, enum zti_modes mode, uint_t value) { - uint_t flags = TASKQ_PREPOPULATE; + uint_t flags = 0; boolean_t batch = B_FALSE; switch (mode) { Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Thu Jan 16 14:34:53 2014 (r260742) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Thu Jan 16 14:35:06 2014 (r260743) @@ -23,6 +23,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. + * Copyright 2011 Nexenta Systems, Inc. All rights reserved. */ #ifndef _ZIO_H @@ -472,10 +473,9 @@ struct zio { zio_cksum_report_t *io_cksum_report; uint64_t io_ena; -#ifdef _KERNEL - /* FreeBSD only. */ - struct ostask io_task; -#endif + /* Taskq dispatching state */ + taskq_ent_t io_tqent; + avl_node_t io_trim_node; list_node_t io_trim_link; }; Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Thu Jan 16 14:34:53 2014 (r260742) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Thu Jan 16 14:35:06 2014 (r260743) @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011 Nexenta Systems, Inc. All rights reserved. */ #include @@ -1184,7 +1185,7 @@ zio_taskq_dispatch(zio_t *zio, enum zio_ { spa_t *spa = zio->io_spa; zio_type_t t = zio->io_type; - int flags = TQ_SLEEP | (cutinline ? TQ_FRONT : 0); + int flags = (cutinline ? TQ_FRONT : 0); ASSERT(q == ZIO_TASKQ_ISSUE || q == ZIO_TASKQ_INTERRUPT); @@ -1210,13 +1211,19 @@ zio_taskq_dispatch(zio_t *zio, enum zio_ q++; ASSERT3U(q, <, ZIO_TASKQ_TYPES); -#ifdef _KERNEL - (void) taskq_dispatch_safe(spa->spa_zio_taskq[t][q], - (task_func_t *)zio_execute, zio, flags, &zio->io_task); + + /* + * NB: We are assuming that the zio can only be dispatched + * to a single taskq at a time. It would be a grievous error + * to dispatch the zio to another taskq at the same time. + */ +#if defined(illumos) || !defined(_KERNEL) + ASSERT(zio->io_tqent.tqent_next == NULL); #else - (void) taskq_dispatch(spa->spa_zio_taskq[t][q], - (task_func_t *)zio_execute, zio, flags); + ASSERT(zio->io_tqent.tqent_task.ta_pending == 0); #endif + taskq_dispatch_ent(spa->spa_zio_taskq[t][q], + (task_func_t *)zio_execute, zio, flags, &zio->io_tqent); } static boolean_t @@ -3134,16 +3141,15 @@ zio_done(zio_t *zio) * Reexecution is potentially a huge amount of work. * Hand it off to the otherwise-unused claim taskq. */ -#ifdef _KERNEL - (void) taskq_dispatch_safe( - spa->spa_zio_taskq[ZIO_TYPE_CLAIM][ZIO_TASKQ_ISSUE], - (task_func_t *)zio_reexecute, zio, TQ_SLEEP, - &zio->io_task); +#if defined(illumos) || !defined(_KERNEL) + ASSERT(zio->io_tqent.tqent_next == NULL); #else - (void) taskq_dispatch( - spa->spa_zio_taskq[ZIO_TYPE_CLAIM][ZIO_TASKQ_ISSUE], - (task_func_t *)zio_reexecute, zio, TQ_SLEEP); + ASSERT(zio->io_tqent.tqent_task.ta_pending == 0); #endif + (void) taskq_dispatch_ent( + spa->spa_zio_taskq[ZIO_TYPE_CLAIM][ZIO_TASKQ_ISSUE], + (task_func_t *)zio_reexecute, zio, 0, + &zio->io_tqent); } return (ZIO_PIPELINE_STOP); } Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/sys/taskq.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/sys/taskq.h Thu Jan 16 14:34:53 2014 (r260742) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/sys/taskq.h Thu Jan 16 14:35:06 2014 (r260743) @@ -45,6 +45,12 @@ typedef struct taskq taskq_t; typedef uintptr_t taskqid_t; typedef void (task_func_t)(void *); +typedef struct taskq_ent { + struct task tqent_task; + task_func_t *tqent_func; + void *tqent_arg; +} taskq_ent_t; + struct proc; /* @@ -80,6 +86,8 @@ taskq_t *taskq_create_proc(const char *, taskq_t *taskq_create_sysdc(const char *, int, int, int, struct proc *, uint_t, uint_t); taskqid_t taskq_dispatch(taskq_t *, task_func_t, void *, uint_t); +void taskq_dispatch_ent(taskq_t *, task_func_t, void *, uint_t, + taskq_ent_t *); void nulltask(void *); void taskq_destroy(taskq_t *); void taskq_wait(taskq_t *); From owner-svn-src-stable-9@FreeBSD.ORG Thu Jan 16 14:37:41 2014 Return-Path: Delivered-To: svn-src-stable-9@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 AD1A5211; Thu, 16 Jan 2014 14:37:41 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 98DC812D1; Thu, 16 Jan 2014 14:37:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0GEbfUV037133; Thu, 16 Jan 2014 14:37:41 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GEbfrs037132; Thu, 16 Jan 2014 14:37:41 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401161437.s0GEbfrs037132@svn.freebsd.org> From: Andriy Gapon Date: Thu, 16 Jan 2014 14:37:41 +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: r260746 - stable/9/sys/cddl/contrib/opensolaris/uts/common 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.17 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: Thu, 16 Jan 2014 14:37:41 -0000 Author: avg Date: Thu Jan 16 14:37:41 2014 New Revision: 260746 URL: http://svnweb.freebsd.org/changeset/base/260746 Log: MFC r258743: drop ZUT_OBJ Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/Makefile.files Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/Makefile.files ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/Makefile.files Thu Jan 16 14:37:31 2014 (r260745) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/Makefile.files Thu Jan 16 14:37:41 2014 (r260746) @@ -126,6 +126,3 @@ ZFS_OBJS += \ zfs_vfsops.o \ zfs_vnops.o \ zvol.o - -ZUT_OBJS += \ - zut.o From owner-svn-src-stable-9@FreeBSD.ORG Thu Jan 16 14:42:09 2014 Return-Path: Delivered-To: svn-src-stable-9@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 35478587; Thu, 16 Jan 2014 14:42:09 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 16C1A135A; Thu, 16 Jan 2014 14:42:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0GEg8lZ040326; Thu, 16 Jan 2014 14:42:08 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GEg85X040324; Thu, 16 Jan 2014 14:42:08 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401161442.s0GEg85X040324@svn.freebsd.org> From: Andriy Gapon Date: Thu, 16 Jan 2014 14:42:08 +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: r260748 - in stable/9/cddl/contrib/opensolaris/lib/libzpool/common: . sys 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.17 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: Thu, 16 Jan 2014 14:42:09 -0000 Author: avg Date: Thu Jan 16 14:42:08 2014 New Revision: 260748 URL: http://svnweb.freebsd.org/changeset/base/260748 Log: MFC r258630: 734 taskq_dispatch_prealloc() desired Modified: stable/9/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h stable/9/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c Directory Properties: stable/9/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h ============================================================================== --- stable/9/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Thu Jan 16 14:37:50 2014 (r260747) +++ stable/9/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Thu Jan 16 14:42:08 2014 (r260748) @@ -23,6 +23,9 @@ * Copyright (c) 2013 by Delphix. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. */ +/* + * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + */ #ifndef _SYS_ZFS_CONTEXT_H #define _SYS_ZFS_CONTEXT_H @@ -365,6 +368,16 @@ typedef struct taskq taskq_t; typedef uintptr_t taskqid_t; typedef void (task_func_t)(void *); +typedef struct taskq_ent { + struct taskq_ent *tqent_next; + struct taskq_ent *tqent_prev; + task_func_t *tqent_func; + void *tqent_arg; + uintptr_t tqent_flags; +} taskq_ent_t; + +#define TQENT_FLAG_PREALLOC 0x1 /* taskq_dispatch_ent used */ + #define TASKQ_PREPOPULATE 0x0001 #define TASKQ_CPR_SAFE 0x0002 /* Use CPR safe protocol */ #define TASKQ_DYNAMIC 0x0004 /* Use dynamic thread scheduling */ @@ -376,6 +389,7 @@ typedef void (task_func_t)(void *); #define TQ_NOQUEUE 0x02 /* Do not enqueue if can't dispatch */ #define TQ_FRONT 0x08 /* Queue in front */ + extern taskq_t *system_taskq; extern taskq_t *taskq_create(const char *, int, pri_t, int, int, uint_t); @@ -384,6 +398,8 @@ extern taskq_t *taskq_create(const char #define taskq_create_sysdc(a, b, d, e, p, dc, f) \ (taskq_create(a, b, maxclsyspri, d, e, f)) extern taskqid_t taskq_dispatch(taskq_t *, task_func_t, void *, uint_t); +extern void taskq_dispatch_ent(taskq_t *, task_func_t, void *, uint_t, + taskq_ent_t *); extern void taskq_destroy(taskq_t *); extern void taskq_wait(taskq_t *); extern int taskq_member(taskq_t *, void *); Modified: stable/9/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c Thu Jan 16 14:37:50 2014 (r260747) +++ stable/9/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c Thu Jan 16 14:42:08 2014 (r260748) @@ -22,19 +22,15 @@ * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + */ #include int taskq_now; taskq_t *system_taskq; -typedef struct task { - struct task *task_next; - struct task *task_prev; - task_func_t *task_func; - void *task_arg; -} task_t; - #define TASKQ_ACTIVE 0x00010000 struct taskq { @@ -51,18 +47,18 @@ struct taskq { int tq_maxalloc; kcondvar_t tq_maxalloc_cv; int tq_maxalloc_wait; - task_t *tq_freelist; - task_t tq_task; + taskq_ent_t *tq_freelist; + taskq_ent_t tq_task; }; -static task_t * +static taskq_ent_t * task_alloc(taskq_t *tq, int tqflags) { - task_t *t; + taskq_ent_t *t; int rv; again: if ((t = tq->tq_freelist) != NULL && tq->tq_nalloc >= tq->tq_minalloc) { - tq->tq_freelist = t->task_next; + tq->tq_freelist = t->tqent_next; } else { if (tq->tq_nalloc >= tq->tq_maxalloc) { if (!(tqflags & KM_SLEEP)) @@ -87,7 +83,7 @@ again: if ((t = tq->tq_freelist) != NULL } mutex_exit(&tq->tq_lock); - t = kmem_alloc(sizeof (task_t), tqflags & KM_SLEEP); + t = kmem_alloc(sizeof (taskq_ent_t), tqflags & KM_SLEEP); mutex_enter(&tq->tq_lock); if (t != NULL) @@ -97,15 +93,15 @@ again: if ((t = tq->tq_freelist) != NULL } static void -task_free(taskq_t *tq, task_t *t) +task_free(taskq_t *tq, taskq_ent_t *t) { if (tq->tq_nalloc <= tq->tq_minalloc) { - t->task_next = tq->tq_freelist; + t->tqent_next = tq->tq_freelist; tq->tq_freelist = t; } else { tq->tq_nalloc--; mutex_exit(&tq->tq_lock); - kmem_free(t, sizeof (task_t)); + kmem_free(t, sizeof (taskq_ent_t)); mutex_enter(&tq->tq_lock); } @@ -116,7 +112,7 @@ task_free(taskq_t *tq, task_t *t) taskqid_t taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t tqflags) { - task_t *t; + taskq_ent_t *t; if (taskq_now) { func(arg); @@ -130,26 +126,58 @@ taskq_dispatch(taskq_t *tq, task_func_t return (0); } if (tqflags & TQ_FRONT) { - t->task_next = tq->tq_task.task_next; - t->task_prev = &tq->tq_task; + t->tqent_next = tq->tq_task.tqent_next; + t->tqent_prev = &tq->tq_task; } else { - t->task_next = &tq->tq_task; - t->task_prev = tq->tq_task.task_prev; + t->tqent_next = &tq->tq_task; + t->tqent_prev = tq->tq_task.tqent_prev; } - t->task_next->task_prev = t; - t->task_prev->task_next = t; - t->task_func = func; - t->task_arg = arg; + t->tqent_next->tqent_prev = t; + t->tqent_prev->tqent_next = t; + t->tqent_func = func; + t->tqent_arg = arg; cv_signal(&tq->tq_dispatch_cv); mutex_exit(&tq->tq_lock); return (1); } void +taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags, + taskq_ent_t *t) +{ + ASSERT(func != NULL); + ASSERT(!(tq->tq_flags & TASKQ_DYNAMIC)); + + /* + * Mark it as a prealloc'd task. This is important + * to ensure that we don't free it later. + */ + t->tqent_flags |= TQENT_FLAG_PREALLOC; + /* + * Enqueue the task to the underlying queue. + */ + mutex_enter(&tq->tq_lock); + + if (flags & TQ_FRONT) { + t->tqent_next = tq->tq_task.tqent_next; + t->tqent_prev = &tq->tq_task; + } else { + t->tqent_next = &tq->tq_task; + t->tqent_prev = tq->tq_task.tqent_prev; + } + t->tqent_next->tqent_prev = t; + t->tqent_prev->tqent_next = t; + t->tqent_func = func; + t->tqent_arg = arg; + cv_signal(&tq->tq_dispatch_cv); + mutex_exit(&tq->tq_lock); +} + +void taskq_wait(taskq_t *tq) { mutex_enter(&tq->tq_lock); - while (tq->tq_task.task_next != &tq->tq_task || tq->tq_active != 0) + while (tq->tq_task.tqent_next != &tq->tq_task || tq->tq_active != 0) cv_wait(&tq->tq_wait_cv, &tq->tq_lock); mutex_exit(&tq->tq_lock); } @@ -158,27 +186,32 @@ static void * taskq_thread(void *arg) { taskq_t *tq = arg; - task_t *t; + taskq_ent_t *t; + boolean_t prealloc; mutex_enter(&tq->tq_lock); while (tq->tq_flags & TASKQ_ACTIVE) { - if ((t = tq->tq_task.task_next) == &tq->tq_task) { + if ((t = tq->tq_task.tqent_next) == &tq->tq_task) { if (--tq->tq_active == 0) cv_broadcast(&tq->tq_wait_cv); cv_wait(&tq->tq_dispatch_cv, &tq->tq_lock); tq->tq_active++; continue; } - t->task_prev->task_next = t->task_next; - t->task_next->task_prev = t->task_prev; + t->tqent_prev->tqent_next = t->tqent_next; + t->tqent_next->tqent_prev = t->tqent_prev; + t->tqent_next = NULL; + t->tqent_prev = NULL; + prealloc = t->tqent_flags & TQENT_FLAG_PREALLOC; mutex_exit(&tq->tq_lock); rw_enter(&tq->tq_threadlock, RW_READER); - t->task_func(t->task_arg); + t->tqent_func(t->tqent_arg); rw_exit(&tq->tq_threadlock); mutex_enter(&tq->tq_lock); - task_free(tq, t); + if (!prealloc) + task_free(tq, t); } tq->tq_nthreads--; cv_broadcast(&tq->tq_wait_cv); @@ -217,8 +250,8 @@ taskq_create(const char *name, int nthre tq->tq_nthreads = nthreads; tq->tq_minalloc = minalloc; tq->tq_maxalloc = maxalloc; - tq->tq_task.task_next = &tq->tq_task; - tq->tq_task.task_prev = &tq->tq_task; + tq->tq_task.tqent_next = &tq->tq_task; + tq->tq_task.tqent_prev = &tq->tq_task; tq->tq_threadlist = kmem_alloc(nthreads * sizeof (thread_t), KM_SLEEP); if (flags & TASKQ_PREPOPULATE) { From owner-svn-src-stable-9@FreeBSD.ORG Thu Jan 16 14:48:06 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9314E9CF; Thu, 16 Jan 2014 14:48:06 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 73918139B; Thu, 16 Jan 2014 14:48:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0GEm6lV041188; Thu, 16 Jan 2014 14:48:06 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GEm5tv041185; Thu, 16 Jan 2014 14:48:05 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401161448.s0GEm5tv041185@svn.freebsd.org> From: Andriy Gapon Date: Thu, 16 Jan 2014 14:48:05 +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: r260751 - in stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys 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.17 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: Thu, 16 Jan 2014 14:48:06 -0000 Author: avg Date: Thu Jan 16 14:48:05 2014 New Revision: 260751 URL: http://svnweb.freebsd.org/changeset/base/260751 Log: MFC r258631: MFV r247578 3581 spa_zio_taskq[ZIO_TYPE_FREE][ZIO_TASKQ_ISSUE]->tq_lock is piping hot Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu Jan 16 14:47:29 2014 (r260750) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu Jan 16 14:48:05 2014 (r260751) @@ -95,23 +95,25 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, check_hos static int zfs_ccw_retry_interval = 300; typedef enum zti_modes { - zti_mode_fixed, /* value is # of threads (min 1) */ - zti_mode_online_percent, /* value is % of online CPUs */ - zti_mode_batch, /* cpu-intensive; value is ignored */ - zti_mode_null, /* don't create a taskq */ - zti_nmodes + ZTI_MODE_FIXED, /* value is # of threads (min 1) */ + ZTI_MODE_ONLINE_PERCENT, /* value is % of online CPUs */ + ZTI_MODE_BATCH, /* cpu-intensive; value is ignored */ + ZTI_MODE_NULL, /* don't create a taskq */ + ZTI_NMODES } zti_modes_t; -#define ZTI_FIX(n) { zti_mode_fixed, (n) } -#define ZTI_PCT(n) { zti_mode_online_percent, (n) } -#define ZTI_BATCH { zti_mode_batch, 0 } -#define ZTI_NULL { zti_mode_null, 0 } +#define ZTI_P(n, q) { ZTI_MODE_FIXED, (n), (q) } +#define ZTI_PCT(n) { ZTI_MODE_ONLINE_PERCENT, (n), 1 } +#define ZTI_BATCH { ZTI_MODE_BATCH, 0, 1 } +#define ZTI_NULL { ZTI_MODE_NULL, 0, 0 } -#define ZTI_ONE ZTI_FIX(1) +#define ZTI_N(n) ZTI_P(n, 1) +#define ZTI_ONE ZTI_N(1) typedef struct zio_taskq_info { - enum zti_modes zti_mode; + zti_modes_t zti_mode; uint_t zti_value; + uint_t zti_count; } zio_taskq_info_t; static const char *const zio_taskq_types[ZIO_TASKQ_TYPES] = { @@ -119,17 +121,30 @@ static const char *const zio_taskq_types }; /* - * Define the taskq threads for the following I/O types: - * NULL, READ, WRITE, FREE, CLAIM, and IOCTL + * This table defines the taskq settings for each ZFS I/O type. When + * initializing a pool, we use this table to create an appropriately sized + * taskq. Some operations are low volume and therefore have a small, static + * number of threads assigned to their taskqs using the ZTI_N(#) or ZTI_ONE + * macros. Other operations process a large amount of data; the ZTI_BATCH + * macro causes us to create a taskq oriented for throughput. Some operations + * are so high frequency and short-lived that the taskq itself can become a a + * point of lock contention. The ZTI_P(#, #) macro indicates that we need an + * additional degree of parallelism specified by the number of threads per- + * taskq and the number of taskqs; when dispatching an event in this case, the + * particular taskq is chosen at random. + * + * The different taskq priorities are to handle the different contexts (issue + * and interrupt) and then to reserve threads for ZIO_PRIORITY_NOW I/Os that + * need to be handled with minimum delay. */ const zio_taskq_info_t zio_taskqs[ZIO_TYPES][ZIO_TASKQ_TYPES] = { /* ISSUE ISSUE_HIGH INTR INTR_HIGH */ - { ZTI_ONE, ZTI_NULL, ZTI_ONE, ZTI_NULL }, - { ZTI_FIX(8), ZTI_NULL, ZTI_BATCH, ZTI_NULL }, - { ZTI_BATCH, ZTI_FIX(5), ZTI_FIX(8), ZTI_FIX(5) }, - { ZTI_FIX(100), ZTI_NULL, ZTI_ONE, ZTI_NULL }, - { ZTI_ONE, ZTI_NULL, ZTI_ONE, ZTI_NULL }, - { ZTI_ONE, ZTI_NULL, ZTI_ONE, ZTI_NULL }, + { ZTI_ONE, ZTI_NULL, ZTI_ONE, ZTI_NULL }, /* NULL */ + { ZTI_N(8), ZTI_NULL, ZTI_BATCH, ZTI_NULL }, /* READ */ + { ZTI_BATCH, ZTI_N(5), ZTI_N(8), ZTI_N(5) }, /* WRITE */ + { ZTI_P(12, 8), ZTI_NULL, ZTI_ONE, ZTI_NULL }, /* FREE */ + { ZTI_ONE, ZTI_NULL, ZTI_ONE, ZTI_NULL }, /* CLAIM */ + { ZTI_ONE, ZTI_NULL, ZTI_ONE, ZTI_NULL }, /* IOCTL */ }; static void spa_sync_version(void *arg, dmu_tx_t *tx); @@ -819,50 +834,124 @@ spa_get_errlists(spa_t *spa, avl_tree_t offsetof(spa_error_entry_t, se_avl)); } -static taskq_t * -spa_taskq_create(spa_t *spa, const char *name, enum zti_modes mode, - uint_t value) +static void +spa_taskqs_init(spa_t *spa, zio_type_t t, zio_taskq_type_t q) { + const zio_taskq_info_t *ztip = &zio_taskqs[t][q]; + enum zti_modes mode = ztip->zti_mode; + uint_t value = ztip->zti_value; + uint_t count = ztip->zti_count; + spa_taskqs_t *tqs = &spa->spa_zio_taskq[t][q]; + char name[32]; uint_t flags = 0; boolean_t batch = B_FALSE; - switch (mode) { - case zti_mode_null: - return (NULL); /* no taskq needed */ - - case zti_mode_fixed: - ASSERT3U(value, >=, 1); - value = MAX(value, 1); - break; + if (mode == ZTI_MODE_NULL) { + tqs->stqs_count = 0; + tqs->stqs_taskq = NULL; + return; + } - case zti_mode_batch: - batch = B_TRUE; - flags |= TASKQ_THREADS_CPU_PCT; - value = zio_taskq_batch_pct; - break; + ASSERT3U(count, >, 0); - case zti_mode_online_percent: - flags |= TASKQ_THREADS_CPU_PCT; - break; + tqs->stqs_count = count; + tqs->stqs_taskq = kmem_alloc(count * sizeof (taskq_t *), KM_SLEEP); - default: - panic("unrecognized mode for %s taskq (%u:%u) in " - "spa_activate()", - name, mode, value); - break; - } + for (uint_t i = 0; i < count; i++) { + taskq_t *tq; + + switch (mode) { + case ZTI_MODE_FIXED: + ASSERT3U(value, >=, 1); + value = MAX(value, 1); + break; + + case ZTI_MODE_BATCH: + batch = B_TRUE; + flags |= TASKQ_THREADS_CPU_PCT; + value = zio_taskq_batch_pct; + break; + + case ZTI_MODE_ONLINE_PERCENT: + flags |= TASKQ_THREADS_CPU_PCT; + break; + + default: + panic("unrecognized mode for %s_%s taskq (%u:%u) in " + "spa_activate()", + zio_type_name[t], zio_taskq_types[q], mode, value); + break; + } + + if (count > 1) { + (void) snprintf(name, sizeof (name), "%s_%s_%u", + zio_type_name[t], zio_taskq_types[q], i); + } else { + (void) snprintf(name, sizeof (name), "%s_%s", + zio_type_name[t], zio_taskq_types[q]); + } #ifdef SYSDC - if (zio_taskq_sysdc && spa->spa_proc != &p0) { - if (batch) - flags |= TASKQ_DC_BATCH; + if (zio_taskq_sysdc && spa->spa_proc != &p0) { + if (batch) + flags |= TASKQ_DC_BATCH; - return (taskq_create_sysdc(name, value, 50, INT_MAX, - spa->spa_proc, zio_taskq_basedc, flags)); - } + tq = taskq_create_sysdc(name, value, 50, INT_MAX, + spa->spa_proc, zio_taskq_basedc, flags); + } else { +#endif + tq = taskq_create_proc(name, value, maxclsyspri, 50, + INT_MAX, spa->spa_proc, flags); +#ifdef SYSDC + } #endif - return (taskq_create_proc(name, value, maxclsyspri, 50, INT_MAX, - spa->spa_proc, flags)); + + tqs->stqs_taskq[i] = tq; + } +} + +static void +spa_taskqs_fini(spa_t *spa, zio_type_t t, zio_taskq_type_t q) +{ + spa_taskqs_t *tqs = &spa->spa_zio_taskq[t][q]; + + if (tqs->stqs_taskq == NULL) { + ASSERT0(tqs->stqs_count); + return; + } + + for (uint_t i = 0; i < tqs->stqs_count; i++) { + ASSERT3P(tqs->stqs_taskq[i], !=, NULL); + taskq_destroy(tqs->stqs_taskq[i]); + } + + kmem_free(tqs->stqs_taskq, tqs->stqs_count * sizeof (taskq_t *)); + tqs->stqs_taskq = NULL; +} + +/* + * Dispatch a task to the appropriate taskq for the ZFS I/O type and priority. + * Note that a type may have multiple discrete taskqs to avoid lock contention + * on the taskq itself. In that case we choose which taskq at random by using + * the low bits of gethrtime(). + */ +void +spa_taskq_dispatch_ent(spa_t *spa, zio_type_t t, zio_taskq_type_t q, + task_func_t *func, void *arg, uint_t flags, taskq_ent_t *ent) +{ + spa_taskqs_t *tqs = &spa->spa_zio_taskq[t][q]; + taskq_t *tq; + + ASSERT3P(tqs->stqs_taskq, !=, NULL); + ASSERT3U(tqs->stqs_count, !=, 0); + + if (tqs->stqs_count == 1) { + tq = tqs->stqs_taskq[0]; + } else { + tq = tqs->stqs_taskq[gethrtime() % tqs->stqs_count]; + } + + taskq_dispatch_ent(tq, func, arg, flags, ent); } static void @@ -870,16 +959,7 @@ spa_create_zio_taskqs(spa_t *spa) { for (int t = 0; t < ZIO_TYPES; t++) { for (int q = 0; q < ZIO_TASKQ_TYPES; q++) { - const zio_taskq_info_t *ztip = &zio_taskqs[t][q]; - enum zti_modes mode = ztip->zti_mode; - uint_t value = ztip->zti_value; - char name[32]; - - (void) snprintf(name, sizeof (name), - "%s_%s", zio_type_name[t], zio_taskq_types[q]); - - spa->spa_zio_taskq[t][q] = - spa_taskq_create(spa, name, mode, value); + spa_taskqs_init(spa, t, q); } } } @@ -1056,9 +1136,7 @@ spa_deactivate(spa_t *spa) for (int t = 0; t < ZIO_TYPES; t++) { for (int q = 0; q < ZIO_TASKQ_TYPES; q++) { - if (spa->spa_zio_taskq[t][q] != NULL) - taskq_destroy(spa->spa_zio_taskq[t][q]); - spa->spa_zio_taskq[t][q] = NULL; + spa_taskqs_fini(spa, t, q); } } Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Thu Jan 16 14:47:29 2014 (r260750) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Thu Jan 16 14:48:05 2014 (r260751) @@ -81,16 +81,16 @@ typedef struct spa_config_dirent { char *scd_path; } spa_config_dirent_t; -enum zio_taskq_type { +typedef enum zio_taskq_type { ZIO_TASKQ_ISSUE = 0, ZIO_TASKQ_ISSUE_HIGH, ZIO_TASKQ_INTERRUPT, ZIO_TASKQ_INTERRUPT_HIGH, ZIO_TASKQ_TYPES -}; +} zio_taskq_type_t; /* - * State machine for the zpool-pooname process. The states transitions + * State machine for the zpool-poolname process. The states transitions * are done as follows: * * From To Routine @@ -108,6 +108,11 @@ typedef enum spa_proc_state { SPA_PROC_GONE /* spa_thread() is exiting, spa_proc = &p0 */ } spa_proc_state_t; +typedef struct spa_taskqs { + uint_t stqs_count; + taskq_t **stqs_taskq; +} spa_taskqs_t; + struct spa { /* * Fields protected by spa_namespace_lock. @@ -126,7 +131,7 @@ struct spa { uint8_t spa_sync_on; /* sync threads are running */ spa_load_state_t spa_load_state; /* current load operation */ uint64_t spa_import_flags; /* import specific flags */ - taskq_t *spa_zio_taskq[ZIO_TYPES][ZIO_TASKQ_TYPES]; + spa_taskqs_t spa_zio_taskq[ZIO_TYPES][ZIO_TASKQ_TYPES]; dsl_pool_t *spa_dsl_pool; boolean_t spa_is_initializing; /* true while opening pool */ metaslab_class_t *spa_normal_class; /* normal data class */ @@ -258,6 +263,9 @@ struct spa { extern const char *spa_config_path; +extern void spa_taskq_dispatch_ent(spa_t *spa, zio_type_t t, zio_taskq_type_t q, + task_func_t *func, void *arg, uint_t flags, taskq_ent_t *ent); + #ifdef __cplusplus } #endif Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Thu Jan 16 14:47:29 2014 (r260750) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Thu Jan 16 14:48:05 2014 (r260751) @@ -1181,7 +1181,7 @@ zio_free_bp_init(zio_t *zio) */ static void -zio_taskq_dispatch(zio_t *zio, enum zio_taskq_type q, boolean_t cutinline) +zio_taskq_dispatch(zio_t *zio, zio_taskq_type_t q, boolean_t cutinline) { spa_t *spa = zio->io_spa; zio_type_t t = zio->io_type; @@ -1204,10 +1204,11 @@ zio_taskq_dispatch(zio_t *zio, enum zio_ t = ZIO_TYPE_NULL; /* - * If this is a high priority I/O, then use the high priority taskq. + * If this is a high priority I/O, then use the high priority taskq if + * available. */ if (zio->io_priority == ZIO_PRIORITY_NOW && - spa->spa_zio_taskq[t][q + 1] != NULL) + spa->spa_zio_taskq[t][q + 1].stqs_count != 0) q++; ASSERT3U(q, <, ZIO_TASKQ_TYPES); @@ -1222,19 +1223,24 @@ zio_taskq_dispatch(zio_t *zio, enum zio_ #else ASSERT(zio->io_tqent.tqent_task.ta_pending == 0); #endif - taskq_dispatch_ent(spa->spa_zio_taskq[t][q], - (task_func_t *)zio_execute, zio, flags, &zio->io_tqent); + spa_taskq_dispatch_ent(spa, t, q, (task_func_t *)zio_execute, zio, + flags, &zio->io_tqent); } static boolean_t -zio_taskq_member(zio_t *zio, enum zio_taskq_type q) +zio_taskq_member(zio_t *zio, zio_taskq_type_t q) { kthread_t *executor = zio->io_executor; spa_t *spa = zio->io_spa; - for (zio_type_t t = 0; t < ZIO_TYPES; t++) - if (taskq_member(spa->spa_zio_taskq[t][q], executor)) - return (B_TRUE); + for (zio_type_t t = 0; t < ZIO_TYPES; t++) { + spa_taskqs_t *tqs = &spa->spa_zio_taskq[t][q]; + uint_t i; + for (i = 0; i < tqs->stqs_count; i++) { + if (taskq_member(tqs->stqs_taskq[i], executor)) + return (B_TRUE); + } + } return (B_FALSE); } @@ -3146,10 +3152,9 @@ zio_done(zio_t *zio) #else ASSERT(zio->io_tqent.tqent_task.ta_pending == 0); #endif - (void) taskq_dispatch_ent( - spa->spa_zio_taskq[ZIO_TYPE_CLAIM][ZIO_TASKQ_ISSUE], - (task_func_t *)zio_reexecute, zio, 0, - &zio->io_tqent); + spa_taskq_dispatch_ent(spa, ZIO_TYPE_CLAIM, + ZIO_TASKQ_ISSUE, (task_func_t *)zio_reexecute, zio, + 0, &zio->io_tqent); } return (ZIO_PIPELINE_STOP); } From owner-svn-src-stable-9@FreeBSD.ORG Thu Jan 16 15:10:32 2014 Return-Path: Delivered-To: svn-src-stable-9@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 926309DD; Thu, 16 Jan 2014 15:10:32 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7AE6E15D6; Thu, 16 Jan 2014 15:10:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0GFAWE7050555; Thu, 16 Jan 2014 15:10:32 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GFAU5L050535; Thu, 16 Jan 2014 15:10:30 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401161510.s0GFAU5L050535@svn.freebsd.org> From: Andriy Gapon Date: Thu, 16 Jan 2014 15:10:30 +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: r260754 - in stable/9: cddl/contrib/opensolaris/lib/libzpool/common cddl/contrib/opensolaris/lib/libzpool/common/sys sys/cddl/compat/opensolaris/sys sys/cddl/contrib/opensolaris/uts/com... 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.17 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: Thu, 16 Jan 2014 15:10:32 -0000 Author: avg Date: Thu Jan 16 15:10:29 2014 New Revision: 260754 URL: http://svnweb.freebsd.org/changeset/base/260754 Log: MFC r255437: MFV r247844 (illumos-gate 13975:ef6409bc370f) Note that a different kind of cv_timedwait_hires shim is provided in this branch because cv_timedwait_sbt is not available for better emulation. Sponsored by: HybridCluster [merge] Modified: stable/9/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c stable/9/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h stable/9/sys/cddl/compat/opensolaris/sys/kcondvar.h stable/9/sys/cddl/compat/opensolaris/sys/time.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg_impl.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Directory Properties: stable/9/cddl/contrib/opensolaris/ (props changed) stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Thu Jan 16 14:48:26 2014 (r260753) +++ stable/9/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Thu Jan 16 15:10:29 2014 (r260754) @@ -349,6 +349,41 @@ top: return (1); } +/*ARGSUSED*/ +clock_t +cv_timedwait_hires(kcondvar_t *cv, kmutex_t *mp, hrtime_t tim, hrtime_t res, + int flag) +{ + int error; + timestruc_t ts; + hrtime_t delta; + + ASSERT(flag == 0); + +top: + delta = tim - gethrtime(); + if (delta <= 0) + return (-1); + + ts.tv_sec = delta / NANOSEC; + ts.tv_nsec = delta % NANOSEC; + + ASSERT(mutex_owner(mp) == curthread); + mp->m_owner = NULL; + error = pthread_cond_timedwait(cv, &mp->m_lock, &ts); + mp->m_owner = curthread; + + if (error == ETIMEDOUT) + return (-1); + + if (error == EINTR) + goto top; + + ASSERT(error == 0); + + return (1); +} + void cv_signal(kcondvar_t *cv) { Modified: stable/9/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h ============================================================================== --- stable/9/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Thu Jan 16 14:48:26 2014 (r260753) +++ stable/9/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Thu Jan 16 15:10:29 2014 (r260754) @@ -316,6 +316,8 @@ extern void cv_init(kcondvar_t *cv, char extern void cv_destroy(kcondvar_t *cv); extern void cv_wait(kcondvar_t *cv, kmutex_t *mp); extern clock_t cv_timedwait(kcondvar_t *cv, kmutex_t *mp, clock_t abstime); +extern clock_t cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim, + hrtime_t res, int flag); extern void cv_signal(kcondvar_t *cv); extern void cv_broadcast(kcondvar_t *cv); Modified: stable/9/sys/cddl/compat/opensolaris/sys/kcondvar.h ============================================================================== --- stable/9/sys/cddl/compat/opensolaris/sys/kcondvar.h Thu Jan 16 14:48:26 2014 (r260753) +++ stable/9/sys/cddl/compat/opensolaris/sys/kcondvar.h Thu Jan 16 15:10:29 2014 (r260754) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2007 Pawel Jakub Dawidek + * Copyright (c) 2013 iXsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,6 +37,8 @@ #include #include +#include +#include typedef struct cv kcondvar_t; @@ -57,6 +60,18 @@ typedef enum { } while (0) #define cv_init(cv, name, type, arg) zfs_cv_init((cv), (name), (type), (arg)) +static clock_t +cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim, hrtime_t res, + int flag) +{ + /* XXX real hires is not available. */ + + /* We do not attempt to support any flags yet. */ + ASSERT(flag == 0); + + return (cv_timedwait(cvp, mp, NSEC_TO_TICK(tim))); +} + #endif /* _KERNEL */ #endif /* _OPENSOLARIS_SYS_CONDVAR_H_ */ Modified: stable/9/sys/cddl/compat/opensolaris/sys/time.h ============================================================================== --- stable/9/sys/cddl/compat/opensolaris/sys/time.h Thu Jan 16 14:48:26 2014 (r260753) +++ stable/9/sys/cddl/compat/opensolaris/sys/time.h Thu Jan 16 15:10:29 2014 (r260754) @@ -37,6 +37,9 @@ #define NANOSEC 1000000000 #define TIME_MAX LLONG_MAX +#define MSEC2NSEC(m) ((hrtime_t)(m) * (NANOSEC / MILLISEC)) +#define NSEC2MSEC(n) ((n) / (NANOSEC / MILLISEC)) + typedef longlong_t hrtime_t; #if defined(__i386__) || defined(__powerpc__) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c Thu Jan 16 14:48:26 2014 (r260753) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c Thu Jan 16 15:10:29 2014 (r260754) @@ -744,7 +744,8 @@ dsl_dir_tempreserve_space(dsl_dir_t *dd, err = dsl_pool_tempreserve_space(dd->dd_pool, asize, tx); } else { if (err == EAGAIN) { - txg_delay(dd->dd_pool, tx->tx_txg, 1); + txg_delay(dd->dd_pool, tx->tx_txg, + MSEC2NSEC(10), MSEC2NSEC(10)); err = SET_ERROR(ERESTART); } dsl_pool_memory_pressure(dd->dd_pool); Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Thu Jan 16 14:48:26 2014 (r260753) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Thu Jan 16 15:10:29 2014 (r260754) @@ -85,6 +85,9 @@ SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, write_l &zfs_write_limit_override, 0, "Force a txg if dirty buffers exceed this value (bytes)"); +hrtime_t zfs_throttle_delay = MSEC2NSEC(10); +hrtime_t zfs_throttle_resolution = MSEC2NSEC(10); + int dsl_pool_open_special_dir(dsl_pool_t *dp, const char *name, dsl_dir_t **ddp) { @@ -538,12 +541,13 @@ dsl_pool_sync(dsl_pool_t *dp, uint64_t t * Weight the throughput calculation towards the current value: * thru = 3/4 old_thru + 1/4 new_thru * - * Note: write_time is in nanosecs, so write_time/MICROSEC - * yields millisecs + * Note: write_time is in nanosecs while dp_throughput is expressed in + * bytes per millisecond. */ ASSERT(zfs_write_limit_min > 0); - if (data_written > zfs_write_limit_min / 8 && write_time > MICROSEC) { - uint64_t throughput = data_written / (write_time / MICROSEC); + if (data_written > zfs_write_limit_min / 8 && + write_time > MSEC2NSEC(1)) { + uint64_t throughput = data_written / NSEC2MSEC(write_time); if (dp->dp_throughput) dp->dp_throughput = throughput / 4 + @@ -641,8 +645,10 @@ dsl_pool_tempreserve_space(dsl_pool_t *d * the caller 1 clock tick. This will slow down the "fill" * rate until the sync process can catch up with us. */ - if (reserved && reserved > (write_limit - (write_limit >> 3))) - txg_delay(dp, tx->tx_txg, 1); + if (reserved && reserved > (write_limit - (write_limit >> 3))) { + txg_delay(dp, tx->tx_txg, zfs_throttle_delay, + zfs_throttle_resolution); + } return (0); } Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Thu Jan 16 14:48:26 2014 (r260753) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Thu Jan 16 15:10:29 2014 (r260754) @@ -443,7 +443,7 @@ dsl_scan_check_pause(dsl_scan_t *scn, co zfs_resilver_min_time_ms : zfs_scan_min_time_ms; elapsed_nanosecs = gethrtime() - scn->scn_sync_start_time; if (elapsed_nanosecs / NANOSEC > zfs_txg_timeout || - (elapsed_nanosecs / MICROSEC > mintime && + (NSEC2MSEC(elapsed_nanosecs) > mintime && txg_sync_waiting(scn->scn_dp)) || spa_shutting_down(scn->scn_dp->dp_spa)) { if (zb) { @@ -1348,7 +1348,7 @@ dsl_scan_free_should_pause(dsl_scan_t *s elapsed_nanosecs = gethrtime() - scn->scn_sync_start_time; return (elapsed_nanosecs / NANOSEC > zfs_txg_timeout || - (elapsed_nanosecs / MICROSEC > zfs_free_min_time_ms && + (NSEC2MSEC(elapsed_nanosecs) > zfs_free_min_time_ms && txg_sync_waiting(scn->scn_dp)) || spa_shutting_down(scn->scn_dp->dp_spa)); } @@ -1472,7 +1472,7 @@ dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t * "free_bpobj/bptree txg %llu", (longlong_t)scn->scn_visited_this_txg, (longlong_t) - (gethrtime() - scn->scn_sync_start_time) / MICROSEC, + NSEC2MSEC(gethrtime() - scn->scn_sync_start_time), (longlong_t)tx->tx_txg); scn->scn_visited_this_txg = 0; /* @@ -1520,7 +1520,7 @@ dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t * zfs_dbgmsg("visited %llu blocks in %llums", (longlong_t)scn->scn_visited_this_txg, - (longlong_t)(gethrtime() - scn->scn_sync_start_time) / MICROSEC); + (longlong_t)NSEC2MSEC(gethrtime() - scn->scn_sync_start_time)); if (!scn->scn_pausing) { /* finished with scan. */ Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Thu Jan 16 14:48:26 2014 (r260753) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Thu Jan 16 15:10:29 2014 (r260754) @@ -538,8 +538,8 @@ spa_add(const char *name, nvlist_t *conf hdlr.cyh_level = CY_LOW_LEVEL; #endif - spa->spa_deadman_synctime = zfs_deadman_synctime * - zfs_txg_synctime_ms * MICROSEC; + spa->spa_deadman_synctime = MSEC2NSEC(zfs_deadman_synctime * + zfs_txg_synctime_ms); #ifdef illumos /* @@ -548,7 +548,7 @@ spa_add(const char *name, nvlist_t *conf * an expensive operation we don't want to check too frequently. * Instead wait for 5 synctimes before checking again. */ - when.cyt_interval = 5ULL * zfs_txg_synctime_ms * MICROSEC; + when.cyt_interval = MSEC2NSEC(5 * zfs_txg_synctime_ms); when.cyt_when = CY_INFINITY; mutex_enter(&cpu_lock); spa->spa_deadman_cycid = cyclic_add(&hdlr, &when); Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h Thu Jan 16 14:48:26 2014 (r260753) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h Thu Jan 16 15:10:29 2014 (r260754) @@ -74,13 +74,8 @@ extern void txg_rele_to_quiesce(txg_hand extern void txg_rele_to_sync(txg_handle_t *txghp); extern void txg_register_callbacks(txg_handle_t *txghp, list_t *tx_callbacks); -/* - * Delay the caller by the specified number of ticks or until - * the txg closes (whichever comes first). This is intended - * to be used to throttle writers when the system nears its - * capacity. - */ -extern void txg_delay(struct dsl_pool *dp, uint64_t txg, int ticks); +extern void txg_delay(struct dsl_pool *dp, uint64_t txg, hrtime_t delta, + hrtime_t resolution); /* * Wait until the given transaction group has finished syncing. Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg_impl.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg_impl.h Thu Jan 16 14:48:26 2014 (r260753) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg_impl.h Thu Jan 16 15:10:29 2014 (r260754) @@ -70,7 +70,7 @@ struct tx_cpu { kmutex_t tc_open_lock; /* protects tx_open_txg */ kmutex_t tc_lock; /* protects the rest of this struct */ kcondvar_t tc_cv[TXG_SIZE]; - uint64_t tc_count[TXG_SIZE]; + uint64_t tc_count[TXG_SIZE]; /* tx hold count on each txg */ list_t tc_callbacks[TXG_SIZE]; /* commit cb list */ char tc_pad[8]; /* pad to fill 3 cache lines */ }; @@ -87,8 +87,8 @@ struct tx_cpu { * every cpu (see txg_quiesce()). */ typedef struct tx_state { - tx_cpu_t *tx_cpu; /* protects right to enter txg */ - kmutex_t tx_sync_lock; /* protects tx_state_t */ + tx_cpu_t *tx_cpu; /* protects access to tx_open_txg */ + kmutex_t tx_sync_lock; /* protects the rest of this struct */ uint64_t tx_open_txg; /* currently open txg id */ uint64_t tx_quiesced_txg; /* quiesced txg waiting for sync */ uint64_t tx_syncing_txg; /* currently syncing txg id */ Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Thu Jan 16 14:48:26 2014 (r260753) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Thu Jan 16 15:10:29 2014 (r260754) @@ -241,7 +241,7 @@ txg_thread_exit(tx_state_t *tx, callb_cp } static void -txg_thread_wait(tx_state_t *tx, callb_cpr_t *cpr, kcondvar_t *cv, uint64_t time) +txg_thread_wait(tx_state_t *tx, callb_cpr_t *cpr, kcondvar_t *cv, clock_t time) { CALLB_CPR_SAFE_BEGIN(cpr); @@ -370,6 +370,9 @@ txg_quiesce(dsl_pool_t *dp, uint64_t txg ASSERT(txg == tx->tx_open_txg); tx->tx_open_txg++; + DTRACE_PROBE2(txg__quiescing, dsl_pool_t *, dp, uint64_t, txg); + DTRACE_PROBE2(txg__opened, dsl_pool_t *, dp, uint64_t, tx->tx_open_txg); + /* * Now that we've incremented tx_open_txg, we can let threads * enter the next transaction group. @@ -501,6 +504,7 @@ txg_sync_thread(void *arg) txg = tx->tx_quiesced_txg; tx->tx_quiesced_txg = 0; tx->tx_syncing_txg = txg; + DTRACE_PROBE2(txg__syncing, dsl_pool_t *, dp, uint64_t, txg); cv_broadcast(&tx->tx_quiesce_more_cv); dprintf("txg=%llu quiesce_txg=%llu sync_txg=%llu\n", @@ -514,6 +518,7 @@ txg_sync_thread(void *arg) mutex_enter(&tx->tx_sync_lock); tx->tx_synced_txg = txg; tx->tx_syncing_txg = 0; + DTRACE_PROBE2(txg__synced, dsl_pool_t *, dp, uint64_t, txg); cv_broadcast(&tx->tx_sync_done_cv); /* @@ -563,21 +568,22 @@ txg_quiesce_thread(void *arg) */ dprintf("quiesce done, handing off txg %llu\n", txg); tx->tx_quiesced_txg = txg; + DTRACE_PROBE2(txg__quiesced, dsl_pool_t *, dp, uint64_t, txg); cv_broadcast(&tx->tx_sync_more_cv); cv_broadcast(&tx->tx_quiesce_done_cv); } } /* - * Delay this thread by 'ticks' if we are still in the open transaction - * group and there is already a waiting txg quiescing or quiesced. - * Abort the delay if this txg stalls or enters the quiescing state. + * Delay this thread by delay nanoseconds if we are still in the open + * transaction group and there is already a waiting txg quiesing or quiesced. + * Abort the delay if this txg stalls or enters the quiesing state. */ void -txg_delay(dsl_pool_t *dp, uint64_t txg, int ticks) +txg_delay(dsl_pool_t *dp, uint64_t txg, hrtime_t delay, hrtime_t resolution) { tx_state_t *tx = &dp->dp_tx; - clock_t timeout = ddi_get_lbolt() + ticks; + hrtime_t start = gethrtime(); /* don't delay if this txg could transition to quiescing immediately */ if (tx->tx_open_txg > txg || @@ -590,10 +596,11 @@ txg_delay(dsl_pool_t *dp, uint64_t txg, return; } - while (ddi_get_lbolt() < timeout && - tx->tx_syncing_txg < txg-1 && !txg_stalled(dp)) - (void) cv_timedwait(&tx->tx_quiesce_more_cv, &tx->tx_sync_lock, - timeout - ddi_get_lbolt()); + while (gethrtime() - start < delay && + tx->tx_syncing_txg < txg-1 && !txg_stalled(dp)) { + (void) cv_timedwait_hires(&tx->tx_quiesce_more_cv, + &tx->tx_sync_lock, delay, resolution, 0); + } mutex_exit(&tx->tx_sync_lock); } From owner-svn-src-stable-9@FreeBSD.ORG Thu Jan 16 15:22:26 2014 Return-Path: Delivered-To: svn-src-stable-9@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 95419E4E; Thu, 16 Jan 2014 15:22:26 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 805C016A2; Thu, 16 Jan 2014 15:22:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0GFMQSO057006; Thu, 16 Jan 2014 15:22:26 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GFMQtR057005; Thu, 16 Jan 2014 15:22:26 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401161522.s0GFMQtR057005@svn.freebsd.org> From: Andriy Gapon Date: Thu, 16 Jan 2014 15:22:26 +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: r260756 - stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.17 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: Thu, 16 Jan 2014 15:22:26 -0000 Author: avg Date: Thu Jan 16 15:22:26 2014 New Revision: 260756 URL: http://svnweb.freebsd.org/changeset/base/260756 Log: MFC r248426: Fix typo in sysctl description MFC slacker: mm Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Thu Jan 16 15:11:48 2014 (r260755) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Thu Jan 16 15:22:26 2014 (r260756) @@ -275,7 +275,7 @@ uint64_t zfs_deadman_synctime = 1000ULL; TUNABLE_QUAD("vfs.zfs.deadman_synctime", &zfs_deadman_synctime); SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, deadman_synctime, CTLFLAG_RDTUN, &zfs_deadman_synctime, 0, - "Stalled ZFS I/O expiration time in units of vfs.zfs.txg_synctime_ms"); + "Stalled ZFS I/O expiration time in units of vfs.zfs.txg.synctime_ms"); /* * Default value of -1 for zfs_deadman_enabled is resolved in From owner-svn-src-stable-9@FreeBSD.ORG Thu Jan 16 15:43:17 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DF379549; Thu, 16 Jan 2014 15:43:17 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BF39B1832; Thu, 16 Jan 2014 15:43:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0GFhHYs064727; Thu, 16 Jan 2014 15:43:17 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GFhHxM064725; Thu, 16 Jan 2014 15:43:17 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401161543.s0GFhHxM064725@svn.freebsd.org> From: Andriy Gapon Date: Thu, 16 Jan 2014 15:43:17 +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: r260760 - in stable/9: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.17 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: Thu, 16 Jan 2014 15:43:18 -0000 Author: avg Date: Thu Jan 16 15:43:17 2014 New Revision: 260760 URL: http://svnweb.freebsd.org/changeset/base/260760 Log: MFC r254074: MFV r254070: Merge vendor bugfix for ZFS test suite that triggers false positives Modified: stable/9/cddl/contrib/opensolaris/cmd/ztest/ztest.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Directory Properties: stable/9/cddl/contrib/opensolaris/ (props changed) stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/cmd/ztest/ztest.c Thu Jan 16 15:29:44 2014 (r260759) +++ stable/9/cddl/contrib/opensolaris/cmd/ztest/ztest.c Thu Jan 16 15:43:17 2014 (r260760) @@ -186,6 +186,7 @@ static const ztest_shared_opts_t ztest_o extern uint64_t metaslab_gang_bang; extern uint64_t metaslab_df_alloc_threshold; +extern uint64_t zfs_deadman_synctime; static ztest_shared_opts_t *ztest_shared_opts; static ztest_shared_opts_t ztest_opts; @@ -365,7 +366,7 @@ ztest_info_t ztest_info[] = { { ztest_fault_inject, 1, &zopt_sometimes }, { ztest_ddt_repair, 1, &zopt_sometimes }, { ztest_dmu_snapshot_hold, 1, &zopt_sometimes }, - { ztest_reguid, 1, &zopt_sometimes }, + { ztest_reguid, 1, &zopt_rarely }, { ztest_spa_rename, 1, &zopt_rarely }, { ztest_scrub, 1, &zopt_rarely }, { ztest_spa_upgrade, 1, &zopt_rarely }, @@ -4756,6 +4757,14 @@ ztest_fault_inject(ztest_ds_t *zd, uint6 ASSERT(leaves >= 1); /* + * Grab the name lock as reader. There are some operations + * which don't like to have their vdevs changed while + * they are in progress (i.e. spa_change_guid). Those + * operations will have grabbed the name lock as writer. + */ + (void) rw_rdlock(&ztest_name_lock); + + /* * We need SCL_STATE here because we're going to look at vd0->vdev_tsd. */ spa_config_enter(spa, SCL_STATE, FTAG, RW_READER); @@ -4784,7 +4793,14 @@ ztest_fault_inject(ztest_ds_t *zd, uint6 if (vd0 != NULL && vd0->vdev_top->vdev_islog) islog = B_TRUE; - if (vd0 != NULL && maxfaults != 1) { + /* + * If the top-level vdev needs to be resilvered + * then we only allow faults on the device that is + * resilvering. + */ + if (vd0 != NULL && maxfaults != 1 && + (!vdev_resilver_needed(vd0->vdev_top, NULL, NULL) || + vd0->vdev_resilvering)) { /* * Make vd0 explicitly claim to be unreadable, * or unwriteable, or reach behind its back @@ -4815,6 +4831,7 @@ ztest_fault_inject(ztest_ds_t *zd, uint6 if (sav->sav_count == 0) { spa_config_exit(spa, SCL_STATE, FTAG); + (void) rw_unlock(&ztest_name_lock); return; } vd0 = sav->sav_vdevs[ztest_random(sav->sav_count)]; @@ -4828,6 +4845,7 @@ ztest_fault_inject(ztest_ds_t *zd, uint6 } spa_config_exit(spa, SCL_STATE, FTAG); + (void) rw_unlock(&ztest_name_lock); /* * If we can tolerate two or more faults, or we're dealing @@ -5293,16 +5311,33 @@ static void * ztest_deadman_thread(void *arg) { ztest_shared_t *zs = arg; - int grace = 300; - hrtime_t delta; - - delta = (zs->zs_thread_stop - zs->zs_thread_start) / NANOSEC + grace; + spa_t *spa = ztest_spa; + hrtime_t delta, total = 0; - (void) poll(NULL, 0, (int)(1000 * delta)); + for (;;) { + delta = (zs->zs_thread_stop - zs->zs_thread_start) / + NANOSEC + zfs_deadman_synctime; - fatal(0, "failed to complete within %d seconds of deadline", grace); + (void) poll(NULL, 0, (int)(1000 * delta)); - return (NULL); + /* + * If the pool is suspended then fail immediately. Otherwise, + * check to see if the pool is making any progress. If + * vdev_deadman() discovers that there hasn't been any recent + * I/Os then it will end up aborting the tests. + */ + if (spa_suspended(spa)) { + fatal(0, "aborting test after %llu seconds because " + "pool has transitioned to a suspended state.", + zfs_deadman_synctime); + return (NULL); + } + vdev_deadman(spa->spa_root_vdev); + + total += zfs_deadman_synctime; + (void) printf("ztest has been running for %lld seconds\n", + total); + } } static void @@ -6031,6 +6066,7 @@ main(int argc, char **argv) (void) setvbuf(stdout, NULL, _IOLBF, 0); dprintf_setup(&argc, argv); + zfs_deadman_synctime = 300; ztest_fd_rand = open("/dev/urandom", O_RDONLY); ASSERT3S(ztest_fd_rand, >=, 0); Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu Jan 16 15:29:44 2014 (r260759) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu Jan 16 15:43:17 2014 (r260760) @@ -774,6 +774,7 @@ spa_change_guid(spa_t *spa) int error; uint64_t guid; + mutex_enter(&spa->spa_vdev_top_lock); mutex_enter(&spa_namespace_lock); guid = spa_generate_guid(NULL); @@ -786,6 +787,7 @@ spa_change_guid(spa_t *spa) } mutex_exit(&spa_namespace_lock); + mutex_exit(&spa->spa_vdev_top_lock); return (error); } @@ -4939,7 +4941,6 @@ spa_vdev_detach(spa_t *spa, uint64_t gui if (pvd->vdev_ops == &vdev_spare_ops) cvd->vdev_unspare = B_FALSE; vdev_remove_parent(cvd); - cvd->vdev_resilvering = B_FALSE; } @@ -5574,6 +5575,13 @@ spa_vdev_resilver_done_hunt(vdev_t *vd) return (oldvd); } + if (vd->vdev_resilvering && vdev_dtl_empty(vd, DTL_MISSING) && + vdev_dtl_empty(vd, DTL_OUTAGE)) { + ASSERT(vd->vdev_ops->vdev_op_leaf); + vd->vdev_resilvering = B_FALSE; + vdev_config_dirty(vd->vdev_top); + } + /* * Check for a completed replacement. We always consider the first * vdev in the list to be the oldest vdev, and the last one to be From owner-svn-src-stable-9@FreeBSD.ORG Thu Jan 16 15:59:10 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C45D296; Thu, 16 Jan 2014 15:59:10 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AA4631966; Thu, 16 Jan 2014 15:59:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0GFxAOu069868; Thu, 16 Jan 2014 15:59:10 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GFx9v7069858; Thu, 16 Jan 2014 15:59:09 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401161559.s0GFx9v7069858@svn.freebsd.org> From: Andriy Gapon Date: Thu, 16 Jan 2014 15:59:09 +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: r260764 - in stable/9: cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/libzpool/common/sys sys/cddl/compat/opensolaris/sys sys/cddl/contrib/opensolaris/uts/common/fs/zfs... 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.17 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: Thu, 16 Jan 2014 15:59:10 -0000 Author: avg Date: Thu Jan 16 15:59:08 2014 New Revision: 260764 URL: http://svnweb.freebsd.org/changeset/base/260764 Log: MFC r258632,258704: MFV r255255: 4045 zfs write throttle & i/o scheduler performance work Note a change in dmu_tx_delay: pause_sbt is not available in this branch. Sponsored by: HybridCluster [merge] Added: stable/9/sys/cddl/compat/opensolaris/sys/disp.h - copied unchanged from r258632, head/sys/cddl/compat/opensolaris/sys/disp.h Modified: stable/9/cddl/contrib/opensolaris/cmd/ztest/ztest.c stable/9/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_tx.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/sa_impl.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg_impl.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_cache.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: stable/9/cddl/contrib/opensolaris/ (props changed) stable/9/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/ (props changed) stable/9/cddl/contrib/opensolaris/cmd/zfs/ (props changed) stable/9/cddl/contrib/opensolaris/lib/libzfs/ (props changed) stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/cmd/ztest/ztest.c Thu Jan 16 15:57:39 2014 (r260763) +++ stable/9/cddl/contrib/opensolaris/cmd/ztest/ztest.c Thu Jan 16 15:59:08 2014 (r260764) @@ -186,7 +186,7 @@ static const ztest_shared_opts_t ztest_o extern uint64_t metaslab_gang_bang; extern uint64_t metaslab_df_alloc_threshold; -extern uint64_t zfs_deadman_synctime; +extern uint64_t zfs_deadman_synctime_ms; static ztest_shared_opts_t *ztest_shared_opts; static ztest_shared_opts_t ztest_opts; @@ -5315,10 +5315,10 @@ ztest_deadman_thread(void *arg) hrtime_t delta, total = 0; for (;;) { - delta = (zs->zs_thread_stop - zs->zs_thread_start) / - NANOSEC + zfs_deadman_synctime; + delta = zs->zs_thread_stop - zs->zs_thread_start + + MSEC2NSEC(zfs_deadman_synctime_ms); - (void) poll(NULL, 0, (int)(1000 * delta)); + (void) poll(NULL, 0, (int)NSEC2MSEC(delta)); /* * If the pool is suspended then fail immediately. Otherwise, @@ -5329,12 +5329,12 @@ ztest_deadman_thread(void *arg) if (spa_suspended(spa)) { fatal(0, "aborting test after %llu seconds because " "pool has transitioned to a suspended state.", - zfs_deadman_synctime); + zfs_deadman_synctime_ms / 1000); return (NULL); } vdev_deadman(spa->spa_root_vdev); - total += zfs_deadman_synctime; + total += zfs_deadman_synctime_ms/1000; (void) printf("ztest has been running for %lld seconds\n", total); } @@ -6066,7 +6066,7 @@ main(int argc, char **argv) (void) setvbuf(stdout, NULL, _IOLBF, 0); dprintf_setup(&argc, argv); - zfs_deadman_synctime = 300; + zfs_deadman_synctime_ms = 300000; ztest_fd_rand = open("/dev/urandom", O_RDONLY); ASSERT3S(ztest_fd_rand, >=, 0); Modified: stable/9/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h ============================================================================== --- stable/9/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Thu Jan 16 15:57:39 2014 (r260763) +++ stable/9/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Thu Jan 16 15:59:08 2014 (r260764) @@ -65,6 +65,7 @@ extern "C" { #include #include #include +#include #include #include #include @@ -204,6 +205,8 @@ extern int aok; */ #define curthread ((void *)(uintptr_t)thr_self()) +#define kpreempt(x) sched_yield() + typedef struct kthread kthread_t; #define thread_create(stk, stksize, func, arg, len, pp, state, pri) \ Copied: stable/9/sys/cddl/compat/opensolaris/sys/disp.h (from r258632, head/sys/cddl/compat/opensolaris/sys/disp.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/cddl/compat/opensolaris/sys/disp.h Thu Jan 16 15:59:08 2014 (r260764, copy of r258632, head/sys/cddl/compat/opensolaris/sys/disp.h) @@ -0,0 +1,40 @@ +/*- + * Copyright (c) 2013 Andriy Gapon + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _OPENSOLARIS_SYS_DISP_H_ +#define _OPENSOLARIS_SYS_DISP_H_ + +#ifdef _KERNEL + +#include + +#define kpreempt(x) kern_yield(PRI_USER) + +#endif /* _KERNEL */ + +#endif /* _OPENSOLARIS_SYS_DISP_H_ */ Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Jan 16 15:57:39 2014 (r260763) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Jan 16 15:59:08 2014 (r260764) @@ -127,6 +127,7 @@ #include #include #include +#include #ifdef _KERNEL #include #endif @@ -150,10 +151,6 @@ static kmutex_t arc_reclaim_thr_lock; static kcondvar_t arc_reclaim_thr_cv; /* used to signal reclaim thr */ static uint8_t arc_thread_exit; -extern int zfs_write_limit_shift; -extern uint64_t zfs_write_limit_max; -extern kmutex_t zfs_write_limit_lock; - #define ARC_REDUCE_DNLC_PERCENT 3 uint_t arc_reduce_dnlc_percent = ARC_REDUCE_DNLC_PERCENT; @@ -162,6 +159,12 @@ typedef enum arc_reclaim_strategy { ARC_RECLAIM_CONS /* Conservative reclaim strategy */ } arc_reclaim_strategy_t; +/* + * The number of iterations through arc_evict_*() before we + * drop & reacquire the lock. + */ +int arc_evict_iterations = 100; + /* number of seconds before growing cache again */ static int arc_grow_retry = 60; @@ -177,6 +180,11 @@ static int arc_shrink_shift = 5; */ static int arc_min_prefetch_lifespan; +/* + * If this percent of memory is free, don't throttle. + */ +int arc_lotsfree_percent = 10; + static int arc_dead; extern int zfs_prefetch_disable; @@ -526,6 +534,7 @@ typedef struct arc_write_callback arc_wr struct arc_write_callback { void *awcb_private; arc_done_func_t *awcb_ready; + arc_done_func_t *awcb_physdone; arc_done_func_t *awcb_done; arc_buf_t *awcb_buf; }; @@ -1312,7 +1321,7 @@ arc_change_state(arc_state_t *new_state, kmutex_t *lock; ASSERT(MUTEX_HELD(hash_lock)); - ASSERT(new_state != old_state); + ASSERT3P(new_state, !=, old_state); ASSERT(refcnt == 0 || ab->b_datacnt > 0); ASSERT(ab->b_datacnt == 0 || !GHOST_STATE(new_state)); ASSERT(ab->b_datacnt <= 1 || old_state != arc_anon); @@ -1937,8 +1946,10 @@ arc_evict(arc_state_t *state, uint64_t s kmutex_t *hash_lock; boolean_t have_lock; void *stolen = NULL; + arc_buf_hdr_t marker = { 0 }; + int count = 0; static int evict_metadata_offset, evict_data_offset; - int i, idx, offset, list_count, count; + int i, idx, offset, list_count, lists; ASSERT(state == arc_mru || state == arc_mfu); @@ -1958,7 +1969,7 @@ arc_evict(arc_state_t *state, uint64_t s idx = evict_data_offset; } bytes_remaining = evicted_state->arcs_lsize[type]; - count = 0; + lists = 0; evict_start: list = &list_start[idx]; @@ -1985,6 +1996,33 @@ evict_start: if (recycle && ab->b_size != bytes && ab_prev && ab_prev->b_size == bytes) continue; + + /* ignore markers */ + if (ab->b_spa == 0) + continue; + + /* + * It may take a long time to evict all the bufs requested. + * To avoid blocking all arc activity, periodically drop + * the arcs_mtx and give other threads a chance to run + * before reacquiring the lock. + * + * If we are looking for a buffer to recycle, we are in + * the hot code path, so don't sleep. + */ + if (!recycle && count++ > arc_evict_iterations) { + list_insert_after(list, ab, &marker); + mutex_exit(evicted_lock); + mutex_exit(lock); + kpreempt(KPREEMPT_SYNC); + mutex_enter(lock); + mutex_enter(evicted_lock); + ab_prev = list_prev(list, &marker); + list_remove(list, &marker); + count = 0; + continue; + } + hash_lock = HDR_LOCK(ab); have_lock = MUTEX_HELD(hash_lock); if (have_lock || mutex_tryenter(hash_lock)) { @@ -2051,7 +2089,7 @@ evict_start: mutex_exit(evicted_lock); mutex_exit(lock); idx = ((idx + 1) & (list_count - 1)); - count++; + lists++; goto evict_start; } } else { @@ -2063,10 +2101,10 @@ evict_start: mutex_exit(lock); idx = ((idx + 1) & (list_count - 1)); - count++; + lists++; if (bytes_evicted < bytes) { - if (count < list_count) + if (lists < list_count) goto evict_start; else dprintf("only evicted %lld bytes from %x", @@ -2084,28 +2122,14 @@ evict_start: ARCSTAT_INCR(arcstat_mutex_miss, missed); /* - * We have just evicted some data into the ghost state, make - * sure we also adjust the ghost state size if necessary. + * Note: we have just evicted some data into the ghost state, + * potentially putting the ghost size over the desired size. Rather + * that evicting from the ghost list in this hot code path, leave + * this chore to the arc_reclaim_thread(). */ - if (arc_no_grow && - arc_mru_ghost->arcs_size + arc_mfu_ghost->arcs_size > arc_c) { - int64_t mru_over = arc_anon->arcs_size + arc_mru->arcs_size + - arc_mru_ghost->arcs_size - arc_c; - - if (mru_over > 0 && arc_mru_ghost->arcs_lsize[type] > 0) { - int64_t todelete = - MIN(arc_mru_ghost->arcs_lsize[type], mru_over); - arc_evict_ghost(arc_mru_ghost, 0, todelete); - } else if (arc_mfu_ghost->arcs_lsize[type] > 0) { - int64_t todelete = MIN(arc_mfu_ghost->arcs_lsize[type], - arc_mru_ghost->arcs_size + - arc_mfu_ghost->arcs_size - arc_c); - arc_evict_ghost(arc_mfu_ghost, 0, todelete); - } - } + if (stolen) ARCSTAT_BUMP(arcstat_stolen); - return (stolen); } @@ -2122,9 +2146,10 @@ arc_evict_ghost(arc_state_t *state, uint kmutex_t *hash_lock, *lock; uint64_t bytes_deleted = 0; uint64_t bufs_skipped = 0; + int count = 0; static int evict_offset; int list_count, idx = evict_offset; - int offset, count = 0; + int offset, lists = 0; ASSERT(GHOST_STATE(state)); @@ -2142,6 +2167,8 @@ evict_start: mutex_enter(lock); for (ab = list_tail(list); ab; ab = ab_prev) { ab_prev = list_prev(list, ab); + if (ab->b_type > ARC_BUFC_NUMTYPES) + panic("invalid ab=%p", (void *)ab); if (spa && ab->b_spa != spa) continue; @@ -2153,6 +2180,23 @@ evict_start: /* caller may be trying to modify this buffer, skip it */ if (MUTEX_HELD(hash_lock)) continue; + + /* + * It may take a long time to evict all the bufs requested. + * To avoid blocking all arc activity, periodically drop + * the arcs_mtx and give other threads a chance to run + * before reacquiring the lock. + */ + if (count++ > arc_evict_iterations) { + list_insert_after(list, ab, &marker); + mutex_exit(lock); + kpreempt(KPREEMPT_SYNC); + mutex_enter(lock); + ab_prev = list_prev(list, &marker); + list_remove(list, &marker); + count = 0; + continue; + } if (mutex_tryenter(hash_lock)) { ASSERT(!HDR_IO_IN_PROGRESS(ab)); ASSERT(ab->b_buf == NULL); @@ -2188,14 +2232,16 @@ evict_start: mutex_enter(lock); ab_prev = list_prev(list, &marker); list_remove(list, &marker); - } else + } else { bufs_skipped += 1; + } + } mutex_exit(lock); idx = ((idx + 1) & (ARC_BUFC_NUMDATALISTS - 1)); - count++; + lists++; - if (count < list_count) + if (lists < list_count) goto evict_start; evict_offset = idx; @@ -2203,7 +2249,7 @@ evict_start: (bytes < 0 || bytes_deleted < bytes)) { list_start = &state->arcs_lists[0]; list_count = ARC_BUFC_NUMMETADATALISTS; - offset = count = 0; + offset = lists = 0; goto evict_start; } @@ -3083,7 +3129,7 @@ arc_read_done(zio_t *zio) */ int arc_read(zio_t *pio, spa_t *spa, const blkptr_t *bp, arc_done_func_t *done, - void *private, int priority, int zio_flags, uint32_t *arc_flags, + void *private, zio_priority_t priority, int zio_flags, uint32_t *arc_flags, const zbookmark_t *zb) { arc_buf_hdr_t *hdr; @@ -3699,6 +3745,18 @@ arc_write_ready(zio_t *zio) hdr->b_flags |= ARC_IO_IN_PROGRESS; } +/* + * The SPA calls this callback for each physical write that happens on behalf + * of a logical write. See the comment in dbuf_write_physdone() for details. + */ +static void +arc_write_physdone(zio_t *zio) +{ + arc_write_callback_t *cb = zio->io_private; + if (cb->awcb_physdone != NULL) + cb->awcb_physdone(zio, cb->awcb_buf, cb->awcb_private); +} + static void arc_write_done(zio_t *zio) { @@ -3779,8 +3837,9 @@ arc_write_done(zio_t *zio) zio_t * arc_write(zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp, arc_buf_t *buf, boolean_t l2arc, boolean_t l2arc_compress, - const zio_prop_t *zp, arc_done_func_t *ready, arc_done_func_t *done, - void *private, int priority, int zio_flags, const zbookmark_t *zb) + const zio_prop_t *zp, arc_done_func_t *ready, arc_done_func_t *physdone, + arc_done_func_t *done, void *private, zio_priority_t priority, + int zio_flags, const zbookmark_t *zb) { arc_buf_hdr_t *hdr = buf->b_hdr; arc_write_callback_t *callback; @@ -3797,18 +3856,20 @@ arc_write(zio_t *pio, spa_t *spa, uint64 hdr->b_flags |= ARC_L2COMPRESS; callback = kmem_zalloc(sizeof (arc_write_callback_t), KM_SLEEP); callback->awcb_ready = ready; + callback->awcb_physdone = physdone; callback->awcb_done = done; callback->awcb_private = private; callback->awcb_buf = buf; zio = zio_write(pio, spa, txg, bp, buf->b_data, hdr->b_size, zp, - arc_write_ready, arc_write_done, callback, priority, zio_flags, zb); + arc_write_ready, arc_write_physdone, arc_write_done, callback, + priority, zio_flags, zb); return (zio); } static int -arc_memory_throttle(uint64_t reserve, uint64_t inflight_data, uint64_t txg) +arc_memory_throttle(uint64_t reserve, uint64_t txg) { #ifdef _KERNEL uint64_t available_memory = @@ -3822,7 +3883,9 @@ arc_memory_throttle(uint64_t reserve, ui MIN(available_memory, vmem_size(heap_arena, VMEM_FREE)); #endif #endif /* sun */ - if (available_memory >= zfs_write_limit_max) + + if (cnt.v_free_count + cnt.v_cache_count > + (uint64_t)physmem * arc_lotsfree_percent / 100) return (0); if (txg > last_txg) { @@ -3846,20 +3909,6 @@ arc_memory_throttle(uint64_t reserve, ui return (SET_ERROR(EAGAIN)); } page_load = 0; - - if (arc_size > arc_c_min) { - uint64_t evictable_memory = - arc_mru->arcs_lsize[ARC_BUFC_DATA] + - arc_mru->arcs_lsize[ARC_BUFC_METADATA] + - arc_mfu->arcs_lsize[ARC_BUFC_DATA] + - arc_mfu->arcs_lsize[ARC_BUFC_METADATA]; - available_memory += MIN(evictable_memory, arc_size - arc_c_min); - } - - if (inflight_data > available_memory / 4) { - ARCSTAT_INCR(arcstat_memory_throttle_count, 1); - return (SET_ERROR(ERESTART)); - } #endif return (0); } @@ -3877,15 +3926,6 @@ arc_tempreserve_space(uint64_t reserve, int error; uint64_t anon_size; -#ifdef ZFS_DEBUG - /* - * Once in a while, fail for no reason. Everything should cope. - */ - if (spa_get_random(10000) == 0) { - dprintf("forcing random failure\n"); - return (SET_ERROR(ERESTART)); - } -#endif if (reserve > arc_c/4 && !arc_no_grow) arc_c = MIN(arc_c_max, reserve * 4); if (reserve > arc_c) @@ -3903,7 +3943,8 @@ arc_tempreserve_space(uint64_t reserve, * in order to compress/encrypt/etc the data. We therefore need to * make sure that there is sufficient available memory for this. */ - if (error = arc_memory_throttle(reserve, anon_size, txg)) + error = arc_memory_throttle(reserve, txg); + if (error != 0) return (error); /* @@ -4094,11 +4135,20 @@ arc_init(void) arc_dead = FALSE; arc_warm = B_FALSE; - if (zfs_write_limit_max == 0) - zfs_write_limit_max = ptob(physmem) >> zfs_write_limit_shift; - else - zfs_write_limit_shift = 0; - mutex_init(&zfs_write_limit_lock, NULL, MUTEX_DEFAULT, NULL); + /* + * Calculate maximum amount of dirty data per pool. + * + * If it has been set by /etc/system, take that. + * Otherwise, use a percentage of physical memory defined by + * zfs_dirty_data_max_percent (default 10%) with a cap at + * zfs_dirty_data_max_max (default 4GB). + */ + if (zfs_dirty_data_max == 0) { + zfs_dirty_data_max = ptob(physmem) * + zfs_dirty_data_max_percent / 100; + zfs_dirty_data_max = MIN(zfs_dirty_data_max, + zfs_dirty_data_max_max); + } #ifdef _KERNEL if (TUNABLE_INT_FETCH("vfs.zfs.prefetch_disable", &zfs_prefetch_disable)) @@ -4177,8 +4227,6 @@ arc_fini(void) mutex_destroy(&arc_l2c_only->arcs_locks[i].arcs_lock); } - mutex_destroy(&zfs_write_limit_lock); - buf_fini(); ASSERT(arc_loaned_bytes == 0); Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Thu Jan 16 15:57:39 2014 (r260763) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Thu Jan 16 15:59:08 2014 (r260764) @@ -841,7 +841,7 @@ dbuf_free_range(dnode_t *dn, uint64_t st atomic_inc_64(&zfs_free_range_recv_miss); } - for (db = list_head(&dn->dn_dbufs); db; db = db_next) { + for (db = list_head(&dn->dn_dbufs); db != NULL; db = db_next) { db_next = list_next(&dn->dn_dbufs, db); ASSERT(db->db_blkid != DMU_BONUS_BLKID); @@ -1187,6 +1187,8 @@ dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t sizeof (dbuf_dirty_record_t), offsetof(dbuf_dirty_record_t, dr_dirty_node)); } + if (db->db_blkid != DMU_BONUS_BLKID && os->os_dsl_dataset != NULL) + dr->dr_accounted = db->db.db_size; dr->dr_dbuf = db; dr->dr_txg = tx->tx_txg; dr->dr_next = *drp; @@ -1270,7 +1272,10 @@ dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t dbuf_rele(parent, FTAG); mutex_enter(&db->db_mtx); - /* possible race with dbuf_undirty() */ + /* + * Since we've dropped the mutex, it's possible that + * dbuf_undirty() might have changed this out from under us. + */ if (db->db_last_dirty == dr || dn->dn_object == DMU_META_DNODE_OBJECT) { mutex_enter(&di->dt.di.dr_mtx); @@ -1340,7 +1345,11 @@ dbuf_undirty(dmu_buf_impl_t *db, dmu_tx_ ASSERT(db->db.db_size != 0); - /* XXX would be nice to fix up dn_towrite_space[] */ + /* + * Any space we accounted for in dp_dirty_* will be cleaned up by + * dsl_pool_sync(). This is relatively rare so the discrepancy + * is not a big deal. + */ *drp = dr->dr_next; @@ -1520,7 +1529,7 @@ dbuf_assign_arcbuf(dmu_buf_impl_t *db, a /* * "Clear" the contents of this dbuf. This will mark the dbuf - * EVICTING and clear *most* of its references. Unfortunetely, + * EVICTING and clear *most* of its references. Unfortunately, * when we are not holding the dn_dbufs_mtx, we can't clear the * entry in the dn_dbufs list. We have to wait until dbuf_destroy() * in this case. For callers from the DMU we will usually see: @@ -1707,7 +1716,7 @@ dbuf_create(dnode_t *dn, uint8_t level, db->db.db_offset = 0; } else { int blocksize = - db->db_level ? 1<dn_indblkshift : dn->dn_datablksz; + db->db_level ? 1 << dn->dn_indblkshift : dn->dn_datablksz; db->db.db_size = blocksize; db->db.db_offset = db->db_blkid * blocksize; } @@ -1816,7 +1825,7 @@ dbuf_destroy(dmu_buf_impl_t *db) } void -dbuf_prefetch(dnode_t *dn, uint64_t blkid) +dbuf_prefetch(dnode_t *dn, uint64_t blkid, zio_priority_t prio) { dmu_buf_impl_t *db = NULL; blkptr_t *bp = NULL; @@ -1840,8 +1849,6 @@ dbuf_prefetch(dnode_t *dn, uint64_t blki if (dbuf_findbp(dn, 0, blkid, TRUE, &db, &bp) == 0) { if (bp && !BP_IS_HOLE(bp)) { - int priority = dn->dn_type == DMU_OT_DDT_ZAP ? - ZIO_PRIORITY_DDT_PREFETCH : ZIO_PRIORITY_ASYNC_READ; dsl_dataset_t *ds = dn->dn_objset->os_dsl_dataset; uint32_t aflags = ARC_NOWAIT | ARC_PREFETCH; zbookmark_t zb; @@ -1850,7 +1857,7 @@ dbuf_prefetch(dnode_t *dn, uint64_t blki dn->dn_object, 0, blkid); (void) arc_read(NULL, dn->dn_objset->os_spa, - bp, NULL, NULL, priority, + bp, NULL, NULL, prio, ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE, &aflags, &zb); } @@ -2535,6 +2542,38 @@ dbuf_write_ready(zio_t *zio, arc_buf_t * mutex_exit(&db->db_mtx); } +/* + * The SPA will call this callback several times for each zio - once + * for every physical child i/o (zio->io_phys_children times). This + * allows the DMU to monitor the progress of each logical i/o. For example, + * there may be 2 copies of an indirect block, or many fragments of a RAID-Z + * block. There may be a long delay before all copies/fragments are completed, + * so this callback allows us to retire dirty space gradually, as the physical + * i/os complete. + */ +/* ARGSUSED */ +static void +dbuf_write_physdone(zio_t *zio, arc_buf_t *buf, void *arg) +{ + dmu_buf_impl_t *db = arg; + objset_t *os = db->db_objset; + dsl_pool_t *dp = dmu_objset_pool(os); + dbuf_dirty_record_t *dr; + int delta = 0; + + dr = db->db_data_pending; + ASSERT3U(dr->dr_txg, ==, zio->io_txg); + + /* + * The callback will be called io_phys_children times. Retire one + * portion of our dirty space each time we are called. Any rounding + * error will be cleaned up by dsl_pool_sync()'s call to + * dsl_pool_undirty_space(). + */ + delta = dr->dr_accounted / zio->io_phys_children; + dsl_pool_undirty_space(dp, delta, zio->io_txg); +} + /* ARGSUSED */ static void dbuf_write_done(zio_t *zio, arc_buf_t *buf, void *vdb) @@ -2629,6 +2668,7 @@ dbuf_write_done(zio_t *zio, arc_buf_t *b ASSERT(db->db_dirtycnt > 0); db->db_dirtycnt -= 1; db->db_data_pending = NULL; + dbuf_rele_and_unlock(db, (void *)(uintptr_t)txg); } @@ -2747,8 +2787,8 @@ dbuf_write(dbuf_dirty_record_t *dr, arc_ ASSERT(db->db_state != DB_NOFILL); dr->dr_zio = zio_write(zio, os->os_spa, txg, db->db_blkptr, data->b_data, arc_buf_size(data), &zp, - dbuf_write_override_ready, dbuf_write_override_done, dr, - ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_MUSTSUCCEED, &zb); + dbuf_write_override_ready, NULL, dbuf_write_override_done, + dr, ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_MUSTSUCCEED, &zb); mutex_enter(&db->db_mtx); dr->dt.dl.dr_override_state = DR_NOT_OVERRIDDEN; zio_write_override(dr->dr_zio, &dr->dt.dl.dr_overridden_by, @@ -2758,7 +2798,7 @@ dbuf_write(dbuf_dirty_record_t *dr, arc_ ASSERT(zp.zp_checksum == ZIO_CHECKSUM_OFF); dr->dr_zio = zio_write(zio, os->os_spa, txg, db->db_blkptr, NULL, db->db.db_size, &zp, - dbuf_write_nofill_ready, dbuf_write_nofill_done, db, + dbuf_write_nofill_ready, NULL, dbuf_write_nofill_done, db, ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_MUSTSUCCEED | ZIO_FLAG_NODATA, &zb); } else { @@ -2766,7 +2806,7 @@ dbuf_write(dbuf_dirty_record_t *dr, arc_ dr->dr_zio = arc_write(zio, os->os_spa, txg, db->db_blkptr, data, DBUF_IS_L2CACHEABLE(db), DBUF_IS_L2COMPRESSIBLE(db), &zp, dbuf_write_ready, - dbuf_write_done, db, ZIO_PRIORITY_ASYNC_WRITE, - ZIO_FLAG_MUSTSUCCEED, &zb); + dbuf_write_physdone, dbuf_write_done, db, + ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_MUSTSUCCEED, &zb); } } Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Thu Jan 16 15:57:39 2014 (r260763) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Thu Jan 16 15:59:08 2014 (r260764) @@ -374,13 +374,11 @@ static int dmu_buf_hold_array_by_dnode(dnode_t *dn, uint64_t offset, uint64_t length, int read, void *tag, int *numbufsp, dmu_buf_t ***dbpp, uint32_t flags) { - dsl_pool_t *dp = NULL; dmu_buf_t **dbp; uint64_t blkid, nblks, i; uint32_t dbuf_flags; int err; zio_t *zio; - hrtime_t start; ASSERT(length <= DMU_MAX_ACCESS); @@ -408,9 +406,6 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, } dbp = kmem_zalloc(sizeof (dmu_buf_t *) * nblks, KM_SLEEP); - if (dn->dn_objset->os_dsl_dataset) - dp = dn->dn_objset->os_dsl_dataset->ds_dir->dd_pool; - start = gethrtime(); zio = zio_root(dn->dn_objset->os_spa, NULL, NULL, ZIO_FLAG_CANFAIL); blkid = dbuf_whichblock(dn, offset); for (i = 0; i < nblks; i++) { @@ -434,9 +429,6 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, /* wait for async i/o */ err = zio_wait(zio); - /* track read overhead when we are in sync context */ - if (dp && dsl_pool_sync_context(dp)) - dp->dp_read_overhead += gethrtime() - start; if (err) { dmu_buf_rele_array(dbp, nblks, tag); return (err); @@ -518,12 +510,22 @@ dmu_buf_rele_array(dmu_buf_t **dbp_fake, kmem_free(dbp, sizeof (dmu_buf_t *) * numbufs); } +/* + * Issue prefetch i/os for the given blocks. + * + * Note: The assumption is that we *know* these blocks will be needed + * almost immediately. Therefore, the prefetch i/os will be issued at + * ZIO_PRIORITY_SYNC_READ + * + * Note: indirect blocks and other metadata will be read synchronously, + * causing this function to block if they are not already cached. + */ void dmu_prefetch(objset_t *os, uint64_t object, uint64_t offset, uint64_t len) { dnode_t *dn; uint64_t blkid; - int nblks, i, err; + int nblks, err; if (zfs_prefetch_disable) return; @@ -536,7 +538,7 @@ dmu_prefetch(objset_t *os, uint64_t obje rw_enter(&dn->dn_struct_rwlock, RW_READER); blkid = dbuf_whichblock(dn, object * sizeof (dnode_phys_t)); - dbuf_prefetch(dn, blkid); + dbuf_prefetch(dn, blkid, ZIO_PRIORITY_SYNC_READ); rw_exit(&dn->dn_struct_rwlock); return; } @@ -553,16 +555,16 @@ dmu_prefetch(objset_t *os, uint64_t obje rw_enter(&dn->dn_struct_rwlock, RW_READER); if (dn->dn_datablkshift) { int blkshift = dn->dn_datablkshift; - nblks = (P2ROUNDUP(offset+len, 1<> blkshift; + nblks = (P2ROUNDUP(offset + len, 1 << blkshift) - + P2ALIGN(offset, 1 << blkshift)) >> blkshift; } else { nblks = (offset < dn->dn_datablksz); } if (nblks != 0) { blkid = dbuf_whichblock(dn, offset); - for (i = 0; i < nblks; i++) - dbuf_prefetch(dn, blkid+i); + for (int i = 0; i < nblks; i++) + dbuf_prefetch(dn, blkid + i, ZIO_PRIORITY_SYNC_READ); } rw_exit(&dn->dn_struct_rwlock); @@ -1376,7 +1378,7 @@ dmu_sync_late_arrival(zio_t *pio, objset zio_nowait(zio_write(pio, os->os_spa, dmu_tx_get_txg(tx), zgd->zgd_bp, zgd->zgd_db->db_data, zgd->zgd_db->db_size, zp, - dmu_sync_late_arrival_ready, dmu_sync_late_arrival_done, dsa, + dmu_sync_late_arrival_ready, NULL, dmu_sync_late_arrival_done, dsa, ZIO_PRIORITY_SYNC_WRITE, ZIO_FLAG_CANFAIL, zb)); return (0); @@ -1516,8 +1518,9 @@ dmu_sync(zio_t *pio, uint64_t txg, dmu_s zio_nowait(arc_write(pio, os->os_spa, txg, bp, dr->dt.dl.dr_data, DBUF_IS_L2CACHEABLE(db), - DBUF_IS_L2COMPRESSIBLE(db), &zp, dmu_sync_ready, dmu_sync_done, - dsa, ZIO_PRIORITY_SYNC_WRITE, ZIO_FLAG_CANFAIL, &zb)); + DBUF_IS_L2COMPRESSIBLE(db), &zp, dmu_sync_ready, + NULL, dmu_sync_done, dsa, ZIO_PRIORITY_SYNC_WRITE, + ZIO_FLAG_CANFAIL, &zb)); return (0); } Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Thu Jan 16 15:57:39 2014 (r260763) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Thu Jan 16 15:59:08 2014 (r260764) @@ -1028,7 +1028,7 @@ dmu_objset_sync(objset_t *os, zio_t *pio zio = arc_write(pio, os->os_spa, tx->tx_txg, os->os_rootbp, os->os_phys_buf, DMU_OS_IS_L2CACHEABLE(os), DMU_OS_IS_L2COMPRESSIBLE(os), &zp, dmu_objset_write_ready, - dmu_objset_write_done, os, ZIO_PRIORITY_ASYNC_WRITE, + NULL, dmu_objset_write_done, os, ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_MUSTSUCCEED, &zb); /* Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c Thu Jan 16 15:57:39 2014 (r260763) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c Thu Jan 16 15:59:08 2014 (r260764) @@ -54,6 +54,7 @@ dmu_tx_create_dd(dsl_dir_t *dd) offsetof(dmu_tx_hold_t, txh_node)); list_create(&tx->tx_callbacks, sizeof (dmu_tx_callback_t), offsetof(dmu_tx_callback_t, dcb_node)); + tx->tx_start = gethrtime(); #ifdef ZFS_DEBUG refcount_create(&tx->tx_space_written); refcount_create(&tx->tx_space_freed); @@ -597,13 +598,13 @@ dmu_tx_hold_free(dmu_tx_t *tx, uint64_t if (txh == NULL) return; dn = txh->txh_dnode; + dmu_tx_count_dnode(txh); if (off >= (dn->dn_maxblkid+1) * dn->dn_datablksz) return; if (len == DMU_OBJECT_END) len = (dn->dn_maxblkid+1) * dn->dn_datablksz - off; - dmu_tx_count_dnode(txh); /* * For i/o error checking, we read the first and last level-0 @@ -911,6 +912,162 @@ dmu_tx_dirty_buf(dmu_tx_t *tx, dmu_buf_i } #endif +/* + * If we can't do 10 iops, something is wrong. Let us go ahead + * and hit zfs_dirty_data_max. + */ +hrtime_t zfs_delay_max_ns = MSEC2NSEC(100); +int zfs_delay_resolution_ns = 100 * 1000; /* 100 microseconds */ + +/* + * We delay transactions when we've determined that the backend storage + * isn't able to accommodate the rate of incoming writes. + * + * If there is already a transaction waiting, we delay relative to when + * that transaction finishes waiting. This way the calculated min_time + * is independent of the number of threads concurrently executing + * transactions. + * + * If we are the only waiter, wait relative to when the transaction + * started, rather than the current time. This credits the transaction for + * "time already served", e.g. reading indirect blocks. + * + * The minimum time for a transaction to take is calculated as: + * min_time = scale * (dirty - min) / (max - dirty) + * min_time is then capped at zfs_delay_max_ns. + * + * The delay has two degrees of freedom that can be adjusted via tunables. + * The percentage of dirty data at which we start to delay is defined by + * zfs_delay_min_dirty_percent. This should typically be at or above + * zfs_vdev_async_write_active_max_dirty_percent so that we only start to + * delay after writing at full speed has failed to keep up with the incoming + * write rate. The scale of the curve is defined by zfs_delay_scale. Roughly + * speaking, this variable determines the amount of delay at the midpoint of + * the curve. + * + * delay + * 10ms +-------------------------------------------------------------*+ + * | *| + * 9ms + *+ + * | *| + * 8ms + *+ + * | * | + * 7ms + * + + * | * | + * 6ms + * + + * | * | + * 5ms + * + + * | * | + * 4ms + * + + * | * | + * 3ms + * + + * | * | + * 2ms + (midpoint) * + + * | | ** | + * 1ms + v *** + + * | zfs_delay_scale ----------> ******** | + * 0 +-------------------------------------*********----------------+ + * 0% <- zfs_dirty_data_max -> 100% + * + * Note that since the delay is added to the outstanding time remaining on the + * most recent transaction, the delay is effectively the inverse of IOPS. + * Here the midpoint of 500us translates to 2000 IOPS. The shape of the curve + * was chosen such that small changes in the amount of accumulated dirty data + * in the first 3/4 of the curve yield relatively small differences in the + * amount of delay. + * + * The effects can be easier to understand when the amount of delay is + * represented on a log scale: + * + * delay + * 100ms +-------------------------------------------------------------++ + * + + + * | | + * + *+ + * 10ms + *+ + * + ** + + * | (midpoint) ** | + * + | ** + + * 1ms + v **** + + * + zfs_delay_scale ----------> ***** + + * | **** | + * + **** + + * 100us + ** + + * + * + + * | * | + * + * + + * 10us + * + + * + + + * | | + * + + + * +--------------------------------------------------------------+ + * 0% <- zfs_dirty_data_max -> 100% + * + * Note here that only as the amount of dirty data approaches its limit does + * the delay start to increase rapidly. The goal of a properly tuned system + * should be to keep the amount of dirty data out of that range by first + * ensuring that the appropriate limits are set for the I/O scheduler to reach + * optimal throughput on the backend storage, and then by changing the value + * of zfs_delay_scale to increase the steepness of the curve. + */ +static void +dmu_tx_delay(dmu_tx_t *tx, uint64_t dirty) +{ + dsl_pool_t *dp = tx->tx_pool; + uint64_t delay_min_bytes = + zfs_dirty_data_max * zfs_delay_min_dirty_percent / 100; + hrtime_t wakeup, min_tx_time, now; + + if (dirty <= delay_min_bytes) + return; + + /* + * The caller has already waited until we are under the max. + * We make them pass us the amount of dirty data so we don't + * have to handle the case of it being >= the max, which could + * cause a divide-by-zero if it's == the max. + */ + ASSERT3U(dirty, <, zfs_dirty_data_max); + + now = gethrtime(); + min_tx_time = zfs_delay_scale * + (dirty - delay_min_bytes) / (zfs_dirty_data_max - dirty); + if (now > tx->tx_start + min_tx_time) + return; + + min_tx_time = MIN(min_tx_time, zfs_delay_max_ns); + + DTRACE_PROBE3(delay__mintime, dmu_tx_t *, tx, uint64_t, dirty, + uint64_t, min_tx_time); + + mutex_enter(&dp->dp_lock); + wakeup = MAX(tx->tx_start + min_tx_time, + dp->dp_last_wakeup + min_tx_time); + dp->dp_last_wakeup = wakeup; + mutex_exit(&dp->dp_lock); + +#ifdef _KERNEL +#ifdef illumos + mutex_enter(&curthread->t_delay_lock); + while (cv_timedwait_hires(&curthread->t_delay_cv, + &curthread->t_delay_lock, wakeup, zfs_delay_resolution_ns, + CALLOUT_FLAG_ABSOLUTE | CALLOUT_FLAG_ROUNDUP) > 0) + continue; + mutex_exit(&curthread->t_delay_lock); +#else + /* XXX High resolution callouts are not available */ + ASSERT(wakeup >= now); + pause("dmu_tx_delay", NSEC_TO_TICK(wakeup - now)); +#endif +#else + hrtime_t delta = wakeup - gethrtime(); + struct timespec ts; + ts.tv_sec = delta / NANOSEC; + ts.tv_nsec = delta % NANOSEC; + (void) nanosleep(&ts, NULL); +#endif +} + static int dmu_tx_try_assign(dmu_tx_t *tx, txg_how_t txg_how) { @@ -941,6 +1098,12 @@ dmu_tx_try_assign(dmu_tx_t *tx, txg_how_ return (SET_ERROR(ERESTART)); } + if (!tx->tx_waited && + dsl_pool_need_dirty_delay(tx->tx_pool)) { + tx->tx_wait_dirty = B_TRUE; + return (SET_ERROR(ERESTART)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-9@FreeBSD.ORG Thu Jan 16 16:04:21 2014 Return-Path: Delivered-To: svn-src-stable-9@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 AB074701; Thu, 16 Jan 2014 16:04:21 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 957711A1D; Thu, 16 Jan 2014 16:04:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0GG4LnA073576; Thu, 16 Jan 2014 16:04:21 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GG4LiS073572; Thu, 16 Jan 2014 16:04:21 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401161604.s0GG4LiS073572@svn.freebsd.org> From: Andriy Gapon Date: Thu, 16 Jan 2014 16:04:21 +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: r260766 - in stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys 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.17 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: Thu, 16 Jan 2014 16:04:21 -0000 Author: avg Date: Thu Jan 16 16:04:20 2014 New Revision: 260766 URL: http://svnweb.freebsd.org/changeset/base/260766 Log: MFC r258633: MFV r255256: 3954 metaslabs continue to load even after hitting zfs_mg_alloc_failure limit Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Thu Jan 16 16:00:05 2014 (r260765) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Thu Jan 16 16:04:20 2014 (r260766) @@ -58,7 +58,8 @@ int zfs_condense_pct = 200; /* * This value defines the number of allowed allocation failures per vdev. * If a device reaches this threshold in a given txg then we consider skipping - * allocations on that device. + * allocations on that device. The value of zfs_mg_alloc_failures is computed + * in zio_init() unless it has been overridden in /etc/system. */ int zfs_mg_alloc_failures = 0; @@ -69,6 +70,21 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, mg_alloc_ TUNABLE_INT("vfs.zfs.mg_alloc_failures", &zfs_mg_alloc_failures); /* + * The zfs_mg_noalloc_threshold defines which metaslab groups should + * be eligible for allocation. The value is defined as a percentage of + * a free space. Metaslab groups that have more free space than + * zfs_mg_noalloc_threshold are always eligible for allocations. Once + * a metaslab group's free space is less than or equal to the + * zfs_mg_noalloc_threshold the allocator will avoid allocating to that + * group unless all groups in the pool have reached zfs_mg_noalloc_threshold. + * Once all groups in the pool reach zfs_mg_noalloc_threshold then all + * groups are allowed to accept allocations. Gang blocks are always + * eligible to allocate on any metaslab group. The default value of 0 means + * no metaslab group will be excluded based on this criterion. + */ +int zfs_mg_noalloc_threshold = 0; + +/* * Metaslab debugging: when set, keeps all space maps in core to verify frees. */ static int metaslab_debug = 0; @@ -234,6 +250,53 @@ metaslab_compare(const void *x1, const v return (0); } +/* + * Update the allocatable flag and the metaslab group's capacity. + * The allocatable flag is set to true if the capacity is below + * the zfs_mg_noalloc_threshold. If a metaslab group transitions + * from allocatable to non-allocatable or vice versa then the metaslab + * group's class is updated to reflect the transition. + */ +static void +metaslab_group_alloc_update(metaslab_group_t *mg) +{ + vdev_t *vd = mg->mg_vd; + metaslab_class_t *mc = mg->mg_class; + vdev_stat_t *vs = &vd->vdev_stat; + boolean_t was_allocatable; + + ASSERT(vd == vd->vdev_top); + + mutex_enter(&mg->mg_lock); + was_allocatable = mg->mg_allocatable; + + mg->mg_free_capacity = ((vs->vs_space - vs->vs_alloc) * 100) / + (vs->vs_space + 1); + + mg->mg_allocatable = (mg->mg_free_capacity > zfs_mg_noalloc_threshold); + + /* + * The mc_alloc_groups maintains a count of the number of + * groups in this metaslab class that are still above the + * zfs_mg_noalloc_threshold. This is used by the allocating + * threads to determine if they should avoid allocations to + * a given group. The allocator will avoid allocations to a group + * if that group has reached or is below the zfs_mg_noalloc_threshold + * and there are still other groups that are above the threshold. + * When a group transitions from allocatable to non-allocatable or + * vice versa we update the metaslab class to reflect that change. + * When the mc_alloc_groups value drops to 0 that means that all + * groups have reached the zfs_mg_noalloc_threshold making all groups + * eligible for allocations. This effectively means that all devices + * are balanced again. + */ + if (was_allocatable && !mg->mg_allocatable) + mc->mc_alloc_groups--; + else if (!was_allocatable && mg->mg_allocatable) + mc->mc_alloc_groups++; + mutex_exit(&mg->mg_lock); +} + metaslab_group_t * metaslab_group_create(metaslab_class_t *mc, vdev_t *vd) { @@ -284,6 +347,7 @@ metaslab_group_activate(metaslab_group_t return; mg->mg_aliquot = metaslab_aliquot * MAX(1, mg->mg_vd->vdev_children); + metaslab_group_alloc_update(mg); if ((mgprev = mc->mc_rotor) == NULL) { mg->mg_prev = mg; @@ -369,6 +433,29 @@ metaslab_group_sort(metaslab_group_t *mg } /* + * Determine if a given metaslab group should skip allocations. A metaslab + * group should avoid allocations if its used capacity has crossed the + * zfs_mg_noalloc_threshold and there is at least one metaslab group + * that can still handle allocations. + */ +static boolean_t +metaslab_group_allocatable(metaslab_group_t *mg) +{ + vdev_t *vd = mg->mg_vd; + spa_t *spa = vd->vdev_spa; + metaslab_class_t *mc = mg->mg_class; + + /* + * A metaslab group is considered allocatable if its free capacity + * is greater than the set value of zfs_mg_noalloc_threshold, it's + * associated with a slog, or there are no other metaslab groups + * with free capacity greater than zfs_mg_noalloc_threshold. + */ + return (mg->mg_free_capacity > zfs_mg_noalloc_threshold || + mc != spa_normal_class(spa) || mc->mc_alloc_groups == 0); +} + +/* * ========================================================================== * Common allocator routines * ========================================================================== @@ -1317,6 +1404,8 @@ metaslab_sync_reassess(metaslab_group_t vdev_t *vd = mg->mg_vd; int64_t failures = mg->mg_alloc_failures; + metaslab_group_alloc_update(mg); + /* * Re-evaluate all metaslabs which have lower offsets than the * bonus area. @@ -1418,6 +1507,8 @@ metaslab_group_alloc(metaslab_group_t *m if (msp == NULL) return (-1ULL); + mutex_enter(&msp->ms_lock); + /* * If we've already reached the allowable number of failed * allocation attempts on this metaslab group then we @@ -1434,11 +1525,10 @@ metaslab_group_alloc(metaslab_group_t *m "asize %llu, failures %llu", spa_name(spa), mg->mg_vd->vdev_id, txg, mg, psize, asize, mg->mg_alloc_failures); + mutex_exit(&msp->ms_lock); return (-1ULL); } - mutex_enter(&msp->ms_lock); - /* * Ensure that the metaslab we have selected is still * capable of handling our request. It's possible that @@ -1591,6 +1681,21 @@ top: } else { allocatable = vdev_allocatable(vd); } + + /* + * Determine if the selected metaslab group is eligible + * for allocations. If we're ganging or have requested + * an allocation for the smallest gang block size + * then we don't want to avoid allocating to the this + * metaslab group. If we're in this condition we should + * try to allocate from any device possible so that we + * don't inadvertently return ENOSPC and suspend the pool + * even though space is still available. + */ + if (allocatable && CAN_FASTGANG(flags) && + psize > SPA_GANGBLOCKSIZE) + allocatable = metaslab_group_allocatable(mg); + if (!allocatable) goto next; Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h Thu Jan 16 16:00:05 2014 (r260765) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h Thu Jan 16 16:04:20 2014 (r260766) @@ -24,7 +24,7 @@ */ /* - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. */ #ifndef _SYS_METASLAB_IMPL_H @@ -45,6 +45,7 @@ struct metaslab_class { metaslab_group_t *mc_rotor; space_map_ops_t *mc_ops; uint64_t mc_aliquot; + uint64_t mc_alloc_groups; /* # of allocatable groups */ uint64_t mc_alloc; /* total allocated space */ uint64_t mc_deferred; /* total deferred frees */ uint64_t mc_space; /* total space (alloc + free) */ @@ -57,6 +58,8 @@ struct metaslab_group { uint64_t mg_aliquot; uint64_t mg_bonus_area; uint64_t mg_alloc_failures; + boolean_t mg_allocatable; /* can we allocate? */ + uint64_t mg_free_capacity; /* percentage free */ int64_t mg_bias; int64_t mg_activation_count; metaslab_class_t *mg_class; Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Thu Jan 16 16:00:05 2014 (r260765) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Thu Jan 16 16:04:20 2014 (r260766) @@ -2418,7 +2418,7 @@ zio_alloc_zil(spa_t *spa, uint64_t txg, if (error) { error = metaslab_alloc(spa, spa_normal_class(spa), size, new_bp, 1, txg, old_bp, - METASLAB_HINTBP_AVOID | METASLAB_GANG_AVOID); + METASLAB_HINTBP_AVOID); } if (error == 0) { From owner-svn-src-stable-9@FreeBSD.ORG Thu Jan 16 16:08:15 2014 Return-Path: Delivered-To: svn-src-stable-9@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 3E569CD1; Thu, 16 Jan 2014 16:08:15 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1CD891A4C; Thu, 16 Jan 2014 16:08:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0GG8EgD074380; Thu, 16 Jan 2014 16:08:14 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GG8EKZ074377; Thu, 16 Jan 2014 16:08:14 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401161608.s0GG8EKZ074377@svn.freebsd.org> From: Andriy Gapon Date: Thu, 16 Jan 2014 16:08:14 +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: r260770 - stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys 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.17 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: Thu, 16 Jan 2014 16:08:15 -0000 Author: avg Date: Thu Jan 16 16:08:14 2014 New Revision: 260770 URL: http://svnweb.freebsd.org/changeset/base/260770 Log: MFC r258634: MFV r258376: 3964 L2ARC should always compress metadata buffers Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h Thu Jan 16 16:07:59 2014 (r260769) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h Thu Jan 16 16:08:14 2014 (r260770) @@ -329,7 +329,8 @@ boolean_t dbuf_is_metadata(dmu_buf_impl_ ((_db)->db_objset->os_secondary_cache == ZFS_CACHE_METADATA))) #define DBUF_IS_L2COMPRESSIBLE(_db) \ - ((_db)->db_objset->os_compress != ZIO_COMPRESS_OFF) + ((_db)->db_objset->os_compress != ZIO_COMPRESS_OFF || \ + (dbuf_is_metadata(_db) && zfs_mdcomp_disable == B_FALSE)) #ifdef ZFS_DEBUG Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Thu Jan 16 16:07:59 2014 (r260769) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Thu Jan 16 16:08:14 2014 (r260770) @@ -24,6 +24,7 @@ * Copyright (c) 2013 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. + * Copyright 2013 DEY Storage Systems, Inc. */ /* Portions Copyright 2010 Robert Milkowski */ @@ -807,6 +808,8 @@ int dmu_diff(const char *tosnap_name, co #define ZFS_CRC64_POLY 0xC96C5795D7870F42ULL /* ECMA-182, reflected form */ extern uint64_t zfs_crc64_table[256]; +extern int zfs_mdcomp_disable; + #ifdef __cplusplus } #endif Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h Thu Jan 16 16:07:59 2014 (r260769) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h Thu Jan 16 16:08:14 2014 (r260770) @@ -130,7 +130,7 @@ struct objset { ((os)->os_secondary_cache == ZFS_CACHE_ALL || \ (os)->os_secondary_cache == ZFS_CACHE_METADATA) -#define DMU_OS_IS_L2COMPRESSIBLE(os) ((os)->os_compress != ZIO_COMPRESS_OFF) +#define DMU_OS_IS_L2COMPRESSIBLE(os) (zfs_mdcomp_disable == B_FALSE) /* called from zpl */ int dmu_objset_hold(const char *name, void *tag, objset_t **osp); From owner-svn-src-stable-9@FreeBSD.ORG Thu Jan 16 16:13:33 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 35780406; Thu, 16 Jan 2014 16:13:33 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 21AAD1AEB; Thu, 16 Jan 2014 16:13:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0GGDXoj078098; Thu, 16 Jan 2014 16:13:33 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GGDWc3078097; Thu, 16 Jan 2014 16:13:32 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401161613.s0GGDWc3078097@svn.freebsd.org> From: Andriy Gapon Date: Thu, 16 Jan 2014 16:13:32 +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: r260774 - stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.17 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: Thu, 16 Jan 2014 16:13:33 -0000 Author: avg Date: Thu Jan 16 16:13:32 2014 New Revision: 260774 URL: http://svnweb.freebsd.org/changeset/base/260774 Log: MFC r258739: zfs mappedread_sf: assert that a page is never partially valid Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Jan 16 16:13:21 2014 (r260773) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Jan 16 16:13:32 2014 (r260774) @@ -572,6 +572,8 @@ mappedread_sf(vnode_t *vp, int nbytes, u vm_page_activate(pp); } vm_page_unlock(pp); + } else { + ASSERT3U(pp->valid, ==, VM_PAGE_BITS_ALL); } if (error) break; From owner-svn-src-stable-9@FreeBSD.ORG Thu Jan 16 16:15:49 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 43094938; Thu, 16 Jan 2014 16:15:49 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2E72C1B13; Thu, 16 Jan 2014 16:15:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0GGFni5078758; Thu, 16 Jan 2014 16:15:49 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GGFmDJ078750; Thu, 16 Jan 2014 16:15:48 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401161615.s0GGFmDJ078750@svn.freebsd.org> From: Andriy Gapon Date: Thu, 16 Jan 2014 16:15:48 +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: r260777 - stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.17 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: Thu, 16 Jan 2014 16:15:49 -0000 Author: avg Date: Thu Jan 16 16:15:48 2014 New Revision: 260777 URL: http://svnweb.freebsd.org/changeset/base/260777 Log: MFC r258720: MFV r258665: 4347 ZPL can use dmu_tx_assign(TXG_WAIT) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Thu Jan 16 16:15:38 2014 (r260776) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Thu Jan 16 16:15:48 2014 (r260777) @@ -951,7 +951,6 @@ zfs_make_xattrdir(znode_t *zp, vattr_t * return (SET_ERROR(EDQUOT)); } -top: tx = dmu_tx_create(zfsvfs->z_os); dmu_tx_hold_sa_create(tx, acl_ids.z_aclp->z_acl_bytes + ZFS_SA_BASE_ATTR_SIZE); @@ -960,13 +959,8 @@ top: fuid_dirtied = zfsvfs->z_fuid_dirty; if (fuid_dirtied) zfs_fuid_txhold(zfsvfs, tx); - error = dmu_tx_assign(tx, TXG_NOWAIT); + error = dmu_tx_assign(tx, TXG_WAIT); if (error) { - if (error == ERESTART) { - dmu_tx_wait(tx); - dmu_tx_abort(tx); - goto top; - } zfs_acl_ids_free(&acl_ids); dmu_tx_abort(tx); return (error); Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Jan 16 16:15:38 2014 (r260776) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Jan 16 16:15:48 2014 (r260777) @@ -104,11 +104,18 @@ * (3) All range locks must be grabbed before calling dmu_tx_assign(), * as they can span dmu_tx_assign() calls. * - * (4) Always pass TXG_NOWAIT as the second argument to dmu_tx_assign(). - * This is critical because we don't want to block while holding locks. - * Note, in particular, that if a lock is sometimes acquired before - * the tx assigns, and sometimes after (e.g. z_lock), then failing to - * use a non-blocking assign can deadlock the system. The scenario: + * (4) If ZPL locks are held, pass TXG_NOWAIT as the second argument to + * dmu_tx_assign(). This is critical because we don't want to block + * while holding locks. + * + * If no ZPL locks are held (aside from ZFS_ENTER()), use TXG_WAIT. This + * reduces lock contention and CPU usage when we must wait (note that if + * throughput is constrained by the storage, nearly every transaction + * must wait). + * + * Note, in particular, that if a lock is sometimes acquired before + * the tx assigns, and sometimes after (e.g. z_lock), then failing + * to use a non-blocking assign can deadlock the system. The scenario: * * Thread A has grabbed a lock before calling dmu_tx_assign(). * Thread B is in an already-assigned tx, and blocks for this lock. @@ -961,7 +968,6 @@ zfs_write(vnode_t *vp, uio_t *uio, int i while (n > 0) { abuf = NULL; woff = uio->uio_loffset; -again: if (zfs_owner_overquota(zfsvfs, zp, B_FALSE) || zfs_owner_overquota(zfsvfs, zp, B_TRUE)) { if (abuf != NULL) @@ -1013,13 +1019,8 @@ again: dmu_tx_hold_sa(tx, zp->z_sa_hdl, B_FALSE); dmu_tx_hold_write(tx, zp->z_id, woff, MIN(n, max_blksz)); zfs_sa_upgrade_txholds(tx, zp); - error = dmu_tx_assign(tx, TXG_NOWAIT); + error = dmu_tx_assign(tx, TXG_WAIT); if (error) { - if (error == ERESTART) { - dmu_tx_wait(tx); - dmu_tx_abort(tx); - goto again; - } dmu_tx_abort(tx); if (abuf != NULL) dmu_return_arcbuf(abuf); @@ -3406,12 +3407,9 @@ top: zfs_sa_upgrade_txholds(tx, zp); - err = dmu_tx_assign(tx, TXG_NOWAIT); - if (err) { - if (err == ERESTART) - dmu_tx_wait(tx); + err = dmu_tx_assign(tx, TXG_WAIT); + if (err) goto out; - } count = 0; /* @@ -4507,19 +4505,13 @@ zfs_putapage(vnode_t *vp, page_t *pp, u_ err = SET_ERROR(EDQUOT); goto out; } -top: tx = dmu_tx_create(zfsvfs->z_os); dmu_tx_hold_write(tx, zp->z_id, off, len); dmu_tx_hold_sa(tx, zp->z_sa_hdl, B_FALSE); zfs_sa_upgrade_txholds(tx, zp); - err = dmu_tx_assign(tx, TXG_NOWAIT); + err = dmu_tx_assign(tx, TXG_WAIT); if (err != 0) { - if (err == ERESTART) { - dmu_tx_wait(tx); - dmu_tx_abort(tx); - goto top; - } dmu_tx_abort(tx); goto out; } Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Thu Jan 16 16:15:38 2014 (r260776) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Thu Jan 16 16:15:48 2014 (r260777) @@ -1536,7 +1536,6 @@ zfs_extend(znode_t *zp, uint64_t end) zfs_range_unlock(rl); return (0); } -top: tx = dmu_tx_create(zfsvfs->z_os); dmu_tx_hold_sa(tx, zp->z_sa_hdl, B_FALSE); zfs_sa_upgrade_txholds(tx, zp); @@ -1556,13 +1555,8 @@ top: newblksz = 0; } - error = dmu_tx_assign(tx, TXG_NOWAIT); + error = dmu_tx_assign(tx, TXG_WAIT); if (error) { - if (error == ERESTART) { - dmu_tx_wait(tx); - dmu_tx_abort(tx); - goto top; - } dmu_tx_abort(tx); zfs_range_unlock(rl); return (error); @@ -1670,17 +1664,11 @@ zfs_trunc(znode_t *zp, uint64_t end) zfs_range_unlock(rl); return (error); } -top: tx = dmu_tx_create(zfsvfs->z_os); dmu_tx_hold_sa(tx, zp->z_sa_hdl, B_FALSE); zfs_sa_upgrade_txholds(tx, zp); - error = dmu_tx_assign(tx, TXG_NOWAIT); + error = dmu_tx_assign(tx, TXG_WAIT); if (error) { - if (error == ERESTART) { - dmu_tx_wait(tx); - dmu_tx_abort(tx); - goto top; - } dmu_tx_abort(tx); zfs_range_unlock(rl); return (error); @@ -1771,13 +1759,8 @@ log: tx = dmu_tx_create(zfsvfs->z_os); dmu_tx_hold_sa(tx, zp->z_sa_hdl, B_FALSE); zfs_sa_upgrade_txholds(tx, zp); - error = dmu_tx_assign(tx, TXG_NOWAIT); + error = dmu_tx_assign(tx, TXG_WAIT); if (error) { - if (error == ERESTART) { - dmu_tx_wait(tx); - dmu_tx_abort(tx); - goto log; - } dmu_tx_abort(tx); return (error); } From owner-svn-src-stable-9@FreeBSD.ORG Thu Jan 16 18:13:19 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 84CDFBD8; Thu, 16 Jan 2014 18:13:19 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6E03117E9; Thu, 16 Jan 2014 18:13:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0GIDJG2030313; Thu, 16 Jan 2014 18:13:19 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0GIDIWj030305; Thu, 16 Jan 2014 18:13:18 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401161813.s0GIDIWj030305@svn.freebsd.org> From: Andriy Gapon Date: Thu, 16 Jan 2014 18:13:18 +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: r260785 - in stable/9/sys/cddl: compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/fs/zfs/sys 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.17 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: Thu, 16 Jan 2014 18:13:19 -0000 Author: avg Date: Thu Jan 16 18:13:18 2014 New Revision: 260785 URL: http://svnweb.freebsd.org/changeset/base/260785 Log: MFC r258744-258746: zfs: add zfs_freebsd_putpages Added: stable/9/sys/cddl/compat/opensolaris/sys/vm.h (contents, props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Added: stable/9/sys/cddl/compat/opensolaris/sys/vm.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/cddl/compat/opensolaris/sys/vm.h Thu Jan 16 18:13:18 2014 (r260785) @@ -0,0 +1,51 @@ +/*- + * Copyright (c) 2013 EMC Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _OPENSOLARIS_SYS_VM_H_ +#define _OPENSOLARIS_SYS_VM_H_ + +#ifdef _KERNEL + +#include + +static inline caddr_t +zfs_map_page(vm_page_t pp, struct sf_buf **sfp) +{ + *sfp = sf_buf_alloc(pp, 0); + return ((caddr_t)sf_buf_kva(*sfp)); +} + +static inline void +zfs_unmap_page(struct sf_buf *sf) +{ + sf_buf_free(sf); +} + +#endif /* _KERNEL */ + +#endif /* _OPENSOLARIS_SYS_VM_H_ */ Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Thu Jan 16 18:01:57 2014 (r260784) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Thu Jan 16 18:13:18 2014 (r260785) @@ -45,6 +45,7 @@ #include #include #ifdef _KERNEL +#include #include #endif @@ -1184,6 +1185,64 @@ dmu_write_pages(objset_t *os, uint64_t o dmu_buf_rele_array(dbp, numbufs, FTAG); return (err); } + +#else + +int +dmu_write_pages(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, + vm_page_t *ma, dmu_tx_t *tx) +{ + dmu_buf_t **dbp; + struct sf_buf *sf; + int numbufs, i; + int err; + + if (size == 0) + return (0); + + err = dmu_buf_hold_array(os, object, offset, size, + FALSE, FTAG, &numbufs, &dbp); + if (err) + return (err); + + for (i = 0; i < numbufs; i++) { + int tocpy, copied, thiscpy; + int bufoff; + dmu_buf_t *db = dbp[i]; + caddr_t va; + + ASSERT(size > 0); + ASSERT3U(db->db_size, >=, PAGESIZE); + + bufoff = offset - db->db_offset; + tocpy = (int)MIN(db->db_size - bufoff, size); + + ASSERT(i == 0 || i == numbufs-1 || tocpy == db->db_size); + + if (tocpy == db->db_size) + dmu_buf_will_fill(db, tx); + else + dmu_buf_will_dirty(db, tx); + + for (copied = 0; copied < tocpy; copied += PAGESIZE) { + ASSERT3U(ptoa((*ma)->pindex), ==, db->db_offset + bufoff); + thiscpy = MIN(PAGESIZE, tocpy - copied); + va = zfs_map_page(*ma, &sf); + bcopy(va, (char *)db->db_data + bufoff, thiscpy); + zfs_unmap_page(sf); + ma += 1; + bufoff += PAGESIZE; + } + + if (tocpy == db->db_size) + dmu_buf_fill_done(db, tx); + + offset += tocpy; + size -= tocpy; + } + dmu_buf_rele_array(dbp, numbufs, FTAG); + return (err); +} #endif /* sun */ #endif Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Thu Jan 16 18:01:57 2014 (r260784) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Thu Jan 16 18:13:18 2014 (r260785) @@ -606,8 +606,15 @@ int dmu_write_uio(objset_t *os, uint64_t dmu_tx_t *tx); int dmu_write_uio_dbuf(dmu_buf_t *zdb, struct uio *uio, uint64_t size, dmu_tx_t *tx); +#ifdef _KERNEL +#ifdef sun int dmu_write_pages(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, struct page *pp, dmu_tx_t *tx); +#else +int dmu_write_pages(objset_t *os, uint64_t object, uint64_t offset, + uint64_t size, struct vm_page **ppa, dmu_tx_t *tx); +#endif +#endif struct arc_buf *dmu_request_arcbuf(dmu_buf_t *handle, int size); void dmu_return_arcbuf(struct arc_buf *buf); void dmu_assign_arcbuf(dmu_buf_t *handle, uint64_t offset, struct arc_buf *buf, Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Jan 16 18:01:57 2014 (r260784) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Jan 16 18:13:18 2014 (r260785) @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -69,7 +70,6 @@ #include #include #include -#include #include #include #include @@ -443,21 +443,6 @@ page_unhold(vm_page_t pp) vm_page_unlock(pp); } -static caddr_t -zfs_map_page(vm_page_t pp, struct sf_buf **sfp) -{ - - *sfp = sf_buf_alloc(pp, 0); - return ((caddr_t)sf_buf_kva(*sfp)); -} - -static void -zfs_unmap_page(struct sf_buf *sf) -{ - - sf_buf_free(sf); -} - /* * When a file is memory mapped, we must keep the IO data synchronized * between the DMU cache and the memory mapped pages. What this means: @@ -474,6 +459,7 @@ update_pages(vnode_t *vp, int64_t start, caddr_t va; int off; + ASSERT(segflg != UIO_NOCOPY); ASSERT(vp->v_mount != NULL); obj = vp->v_object; ASSERT(obj != NULL); @@ -484,27 +470,7 @@ update_pages(vnode_t *vp, int64_t start, vm_page_t pp; int nbytes = imin(PAGESIZE - off, len); - if (segflg == UIO_NOCOPY) { - pp = vm_page_lookup(obj, OFF_TO_IDX(start)); - KASSERT(pp != NULL, - ("zfs update_pages: NULL page in putpages case")); - KASSERT(off == 0, - ("zfs update_pages: unaligned data in putpages case")); - KASSERT(pp->valid == VM_PAGE_BITS_ALL, - ("zfs update_pages: invalid page in putpages case")); - KASSERT(pp->busy > 0, - ("zfs update_pages: unbusy page in putpages case")); - KASSERT(!pmap_page_is_write_mapped(pp), - ("zfs update_pages: writable page in putpages case")); - VM_OBJECT_UNLOCK(obj); - - va = zfs_map_page(pp, &sf); - (void) dmu_write(os, oid, start, nbytes, va, tx); - zfs_unmap_page(sf); - - VM_OBJECT_LOCK(obj); - vm_page_undirty(pp); - } else if ((pp = page_busy(vp, start, off, nbytes)) != NULL) { + if ((pp = page_busy(vp, start, off, nbytes)) != NULL) { VM_OBJECT_UNLOCK(obj); va = zfs_map_page(pp, &sf); @@ -518,8 +484,7 @@ update_pages(vnode_t *vp, int64_t start, len -= nbytes; off = 0; } - if (segflg != UIO_NOCOPY) - vm_object_pip_wakeupn(obj, 0); + vm_object_pip_wakeupn(obj, 0); VM_OBJECT_UNLOCK(obj); } @@ -5797,6 +5762,169 @@ zfs_freebsd_getpages(ap) } static int +zfs_putpages(struct vnode *vp, vm_page_t *ma, size_t len, int flags, + int *rtvals) +{ + znode_t *zp = VTOZ(vp); + zfsvfs_t *zfsvfs = zp->z_zfsvfs; + rl_t *rl; + dmu_tx_t *tx; + struct sf_buf *sf; + vm_object_t object; + vm_page_t m; + caddr_t va; + size_t tocopy; + size_t lo_len; + vm_ooffset_t lo_off; + vm_ooffset_t off; + uint_t blksz; + int ncount; + int pcount; + int err; + int i; + + ZFS_ENTER(zfsvfs); + ZFS_VERIFY_ZP(zp); + + object = vp->v_object; + pcount = btoc(len); + ncount = pcount; + + KASSERT(ma[0]->object == object, ("mismatching object")); + KASSERT(len > 0 && (len & PAGE_MASK) == 0, ("unexpected length")); + + for (i = 0; i < pcount; i++) + rtvals[i] = VM_PAGER_ERROR; + + off = IDX_TO_OFF(ma[0]->pindex); + blksz = zp->z_blksz; + lo_off = rounddown(off, blksz); + lo_len = roundup(len + (off - lo_off), blksz); + rl = zfs_range_lock(zp, lo_off, lo_len, RL_WRITER); + + VM_OBJECT_LOCK(object); + if (len + off > object->un_pager.vnp.vnp_size) { + if (object->un_pager.vnp.vnp_size > off) { + int pgoff; + + len = object->un_pager.vnp.vnp_size - off; + ncount = btoc(len); + if ((pgoff = (int)len & PAGE_MASK) != 0) { + /* + * If the object is locked and the following + * conditions hold, then the page's dirty + * field cannot be concurrently changed by a + * pmap operation. + */ + m = ma[ncount - 1]; + KASSERT(m->busy > 0, + ("zfs_putpages: page %p is not busy", m)); + KASSERT(!pmap_page_is_write_mapped(m), + ("zfs_putpages: page %p is not read-only", m)); + vm_page_clear_dirty(m, pgoff, PAGE_SIZE - + pgoff); + } + } else { + len = 0; + ncount = 0; + } + if (ncount < pcount) { + for (i = ncount; i < pcount; i++) { + rtvals[i] = VM_PAGER_BAD; + } + } + } + VM_OBJECT_UNLOCK(object); + + if (ncount == 0) + goto out; + + if (zfs_owner_overquota(zfsvfs, zp, B_FALSE) || + zfs_owner_overquota(zfsvfs, zp, B_TRUE)) { + goto out; + } + +top: + tx = dmu_tx_create(zfsvfs->z_os); + dmu_tx_hold_write(tx, zp->z_id, off, len); + + dmu_tx_hold_sa(tx, zp->z_sa_hdl, B_FALSE); + zfs_sa_upgrade_txholds(tx, zp); + err = dmu_tx_assign(tx, TXG_NOWAIT); + if (err != 0) { + if (err == ERESTART) { + dmu_tx_wait(tx); + dmu_tx_abort(tx); + goto top; + } + dmu_tx_abort(tx); + goto out; + } + + if (zp->z_blksz < PAGE_SIZE) { + i = 0; + for (i = 0; len > 0; off += tocopy, len -= tocopy, i++) { + tocopy = len > PAGE_SIZE ? PAGE_SIZE : len; + va = zfs_map_page(ma[i], &sf); + dmu_write(zfsvfs->z_os, zp->z_id, off, tocopy, va, tx); + zfs_unmap_page(sf); + } + } else { + err = dmu_write_pages(zfsvfs->z_os, zp->z_id, off, len, ma, tx); + } + + if (err == 0) { + uint64_t mtime[2], ctime[2]; + sa_bulk_attr_t bulk[3]; + int count = 0; + + SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_MTIME(zfsvfs), NULL, + &mtime, 16); + SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_CTIME(zfsvfs), NULL, + &ctime, 16); + SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_FLAGS(zfsvfs), NULL, + &zp->z_pflags, 8); + zfs_tstamp_update_setup(zp, CONTENT_MODIFIED, mtime, ctime, + B_TRUE); + zfs_log_write(zfsvfs->z_log, tx, TX_WRITE, zp, off, len, 0); + + VM_OBJECT_LOCK(object); + for (i = 0; i < ncount; i++) { + rtvals[i] = VM_PAGER_OK; + vm_page_undirty(ma[i]); + } + VM_OBJECT_UNLOCK(object); + PCPU_INC(cnt.v_vnodeout); + PCPU_ADD(cnt.v_vnodepgsout, ncount); + } + dmu_tx_commit(tx); + +out: + zfs_range_unlock(rl); + if ((flags & (VM_PAGER_PUT_SYNC | VM_PAGER_PUT_INVAL)) != 0 || + zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS) + zil_commit(zfsvfs->z_log, zp->z_id); + ZFS_EXIT(zfsvfs); + return (rtvals[0]); +} + +int +zfs_freebsd_putpages(ap) + struct vop_putpages_args /* { + struct vnode *a_vp; + vm_page_t *a_m; + int a_count; + int a_sync; + int *a_rtvals; + vm_ooffset_t a_offset; + } */ *ap; +{ + + return (zfs_putpages(ap->a_vp, ap->a_m, ap->a_count, ap->a_sync, + ap->a_rtvals)); +} + +static int zfs_freebsd_bmap(ap) struct vop_bmap_args /* { struct vnode *a_vp; @@ -6885,6 +7013,7 @@ struct vop_vector zfs_vnodeops = { .vop_setacl = zfs_freebsd_setacl, .vop_aclcheck = zfs_freebsd_aclcheck, .vop_getpages = zfs_freebsd_getpages, + .vop_putpages = zfs_freebsd_putpages, }; struct vop_vector zfs_fifoops = { From owner-svn-src-stable-9@FreeBSD.ORG Fri Jan 17 10:50:47 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D99BF9C2; Fri, 17 Jan 2014 10:50:46 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C4E9C15D1; Fri, 17 Jan 2014 10:50:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0HAokE0028284; Fri, 17 Jan 2014 10:50:46 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0HAokPv028282; Fri, 17 Jan 2014 10:50:46 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401171050.s0HAokPv028282@svn.freebsd.org> From: Andriy Gapon Date: Fri, 17 Jan 2014 10:50:46 +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: r260816 - in stable/9/sys: kern modules/dtrace/dtio modules/dtrace/dtraceall 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.17 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: Fri, 17 Jan 2014 10:50:47 -0000 Author: avg Date: Fri Jan 17 10:50:46 2014 New Revision: 260816 URL: http://svnweb.freebsd.org/changeset/base/260816 Log: MFC r257037: Redefine the io provider using the SDT(9) macros MFC slacker: markj Deleted: stable/9/sys/kern/dtio_kdtrace.c stable/9/sys/modules/dtrace/dtio/ Modified: stable/9/sys/kern/subr_devstat.c stable/9/sys/modules/dtrace/dtraceall/dtraceall.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/kern/subr_devstat.c ============================================================================== --- stable/9/sys/kern/subr_devstat.c Fri Jan 17 10:48:44 2014 (r260815) +++ stable/9/sys/kern/subr_devstat.c Fri Jan 17 10:50:46 2014 (r260816) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -46,57 +47,21 @@ __FBSDID("$FreeBSD$"); #include -#ifdef KDTRACE_HOOKS -#include +SDT_PROVIDER_DEFINE(io); -dtrace_io_start_probe_func_t dtrace_io_start_probe; -dtrace_io_done_probe_func_t dtrace_io_done_probe; -dtrace_io_wait_start_probe_func_t dtrace_io_wait_start_probe; -dtrace_io_wait_done_probe_func_t dtrace_io_wait_done_probe; - -uint32_t dtio_start_id; -uint32_t dtio_done_id; -uint32_t dtio_wait_start_id; -uint32_t dtio_wait_done_id; - -#define DTRACE_DEVSTAT_START() \ - if (dtrace_io_start_probe != NULL) \ - (*dtrace_io_start_probe)(dtio_start_id, NULL, ds); - -#define DTRACE_DEVSTAT_BIO_START() \ - if (dtrace_io_start_probe != NULL) \ - (*dtrace_io_start_probe)(dtio_start_id, bp, ds); - -#define DTRACE_DEVSTAT_DONE() \ - if (dtrace_io_done_probe != NULL) \ - (*dtrace_io_done_probe)(dtio_done_id, NULL, ds); - -#define DTRACE_DEVSTAT_BIO_DONE() \ - if (dtrace_io_done_probe != NULL) \ - (*dtrace_io_done_probe)(dtio_done_id, bp, ds); - -#define DTRACE_DEVSTAT_WAIT_START() \ - if (dtrace_io_wait_start_probe != NULL) \ - (*dtrace_io_wait_start_probe)(dtio_wait_start_id, NULL, ds); - -#define DTRACE_DEVSTAT_WAIT_DONE() \ - if (dtrace_io_wait_done_probe != NULL) \ - (*dtrace_io_wait_done_probe)(dtio_wait_done_id, NULL, ds); - -#else /* ! KDTRACE_HOOKS */ - -#define DTRACE_DEVSTAT_START() - -#define DTRACE_DEVSTAT_BIO_START() - -#define DTRACE_DEVSTAT_DONE() - -#define DTRACE_DEVSTAT_BIO_DONE() - -#define DTRACE_DEVSTAT_WAIT_START() - -#define DTRACE_DEVSTAT_WAIT_DONE() -#endif /* KDTRACE_HOOKS */ +SDT_PROBE_DEFINE2(io, , , start, start, "struct bio *", "struct devstat *"); +SDT_PROBE_DEFINE2(io, , , done, done, "struct bio *", "struct devstat *"); +SDT_PROBE_DEFINE2(io, , , wait_start, wait-start, "struct bio *", + "struct devstat *"); +SDT_PROBE_DEFINE2(io, , , wait_done, wait-done, "struct bio *", + "struct devstat *"); + +#define DTRACE_DEVSTAT_START() SDT_PROBE2(io, , , start, NULL, ds) +#define DTRACE_DEVSTAT_BIO_START() SDT_PROBE2(io, , , start, bp, ds) +#define DTRACE_DEVSTAT_DONE() SDT_PROBE2(io, , , done, NULL, ds) +#define DTRACE_DEVSTAT_BIO_DONE() SDT_PROBE2(io, , , done, bp, ds) +#define DTRACE_DEVSTAT_WAIT_START() SDT_PROBE2(io, , , wait_start, NULL, ds) +#define DTRACE_DEVSTAT_WAIT_DONE() SDT_PROBE2(io, , , wait_done, NULL, ds) static int devstat_num_devs; static long devstat_generation = 1; Modified: stable/9/sys/modules/dtrace/dtraceall/dtraceall.c ============================================================================== --- stable/9/sys/modules/dtrace/dtraceall/dtraceall.c Fri Jan 17 10:48:44 2014 (r260815) +++ stable/9/sys/modules/dtrace/dtraceall/dtraceall.c Fri Jan 17 10:50:46 2014 (r260816) @@ -65,7 +65,6 @@ MODULE_VERSION(dtraceall, 1); MODULE_DEPEND(dtraceall, cyclic, 1, 1, 1); MODULE_DEPEND(dtraceall, opensolaris, 1, 1, 1); MODULE_DEPEND(dtraceall, dtrace, 1, 1, 1); -MODULE_DEPEND(dtraceall, dtio, 1, 1, 1); MODULE_DEPEND(dtraceall, dtmalloc, 1, 1, 1); MODULE_DEPEND(dtraceall, dtnfscl, 1, 1, 1); MODULE_DEPEND(dtraceall, dtnfsclient, 1, 1, 1); From owner-svn-src-stable-9@FreeBSD.ORG Fri Jan 17 11:05:00 2014 Return-Path: Delivered-To: svn-src-stable-9@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 2D06EEF0; Fri, 17 Jan 2014 11:05:00 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1966116F0; Fri, 17 Jan 2014 11:05:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0HB4xdw033587; Fri, 17 Jan 2014 11:04:59 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0HB4xWS033586; Fri, 17 Jan 2014 11:04:59 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401171104.s0HB4xWS033586@svn.freebsd.org> From: Andriy Gapon Date: Fri, 17 Jan 2014 11:04:59 +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: r260818 - stable/9/sys/kern 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.17 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: Fri, 17 Jan 2014 11:05:00 -0000 Author: avg Date: Fri Jan 17 11:04:59 2014 New Revision: 260818 URL: http://svnweb.freebsd.org/changeset/base/260818 Log: MFC r250817: Use SDT_PROBE1() instead of SDT_PROBE() MFC slacker: pjd Modified: stable/9/sys/kern/kern_priv.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_priv.c ============================================================================== --- stable/9/sys/kern/kern_priv.c Fri Jan 17 10:58:59 2014 (r260817) +++ stable/9/sys/kern/kern_priv.c Fri Jan 17 11:04:59 2014 (r260818) @@ -159,13 +159,10 @@ priv_check_cred(struct ucred *cred, int */ error = EPERM; out: - if (error) { - SDT_PROBE(priv, kernel, priv_check, priv_err, priv, 0, 0, 0, - 0); - } else { - SDT_PROBE(priv, kernel, priv_check, priv_ok, priv, 0, 0, 0, - 0); - } + if (error) + SDT_PROBE1(priv, kernel, priv_check, priv_err, priv); + else + SDT_PROBE1(priv, kernel, priv_check, priv_ok, priv); return (error); } From owner-svn-src-stable-9@FreeBSD.ORG Fri Jan 17 11:13:46 2014 Return-Path: Delivered-To: svn-src-stable-9@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 6D64330F; Fri, 17 Jan 2014 11:13:46 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 579601791; Fri, 17 Jan 2014 11:13:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0HBDk87037725; Fri, 17 Jan 2014 11:13:46 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0HBDj3Y037719; Fri, 17 Jan 2014 11:13:45 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401171113.s0HBDj3Y037719@svn.freebsd.org> From: Andriy Gapon Date: Fri, 17 Jan 2014 11:13:45 +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: r260820 - in stable/9: cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sdt sys/cddl/dev/dtrace sys/modules/dtrace/dtrace_test 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.17 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: Fri, 17 Jan 2014 11:13:46 -0000 Author: avg Date: Fri Jan 17 11:13:45 2014 New Revision: 260820 URL: http://svnweb.freebsd.org/changeset/base/260820 Log: MFC r251237: Port the SDT test Modified: stable/9/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.c stable/9/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.d stable/9/sys/cddl/dev/dtrace/dtrace_test.c stable/9/sys/modules/dtrace/dtrace_test/Makefile Directory Properties: stable/9/cddl/contrib/opensolaris/ (props changed) stable/9/sys/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.c Fri Jan 17 11:09:05 2014 (r260819) +++ stable/9/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.c Fri Jan 17 11:13:45 2014 (r260820) @@ -26,26 +26,24 @@ #pragma ident "%Z%%M% %I% %E% SMI" +#include +#include + +#include #include -#ifndef __FreeBSD__ -#include -#endif int main(int argc, char **argv) { -#ifdef __FreeBSD__ - return (1); -#else + int val = 1; + while (1) { - if (uadmin(A_SDTTEST, 0, 0) < 0) { - perror("uadmin"); - return (1); - } + if (sysctlbyname("debug.dtracetest.sdttest", NULL, NULL, &val, + sizeof(val))) + err(1, "sysctlbyname"); sleep(1); } return (0); -#endif } Modified: stable/9/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.d ============================================================================== --- stable/9/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.d Fri Jan 17 11:09:05 2014 (r260819) +++ stable/9/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.d Fri Jan 17 11:13:45 2014 (r260820) @@ -43,7 +43,7 @@ ERROR exit(1); } -sdt:::test +test:::sdttest /arg0 != 1 || arg1 != 2 || arg2 != 3 || arg3 != 4 || arg4 != 5 || arg5 != 6 || arg6 != 7/ { @@ -54,7 +54,7 @@ sdt:::test exit(1); } -sdt:::test +test:::sdttest { exit(0); } Modified: stable/9/sys/cddl/dev/dtrace/dtrace_test.c ============================================================================== --- stable/9/sys/cddl/dev/dtrace/dtrace_test.c Fri Jan 17 11:09:05 2014 (r260819) +++ stable/9/sys/cddl/dev/dtrace/dtrace_test.c Fri Jan 17 11:13:45 2014 (r260820) @@ -25,15 +25,25 @@ * $FreeBSD$ * */ +#include "opt_kdtrace.h" #include #include #include +#include + #include #include #include +#include +#include #include +SDT_PROVIDER_DEFINE(test); + +SDT_PROBE_DEFINE7(test, , , sdttest, sdttest, "int", "int", "int", "int", "int", + "int", "int"); + /* * These are variables that the DTrace test suite references in the * Solaris kernel. We define them here so that the tests function @@ -45,6 +55,33 @@ typedef struct vnode vnode_t; vnode_t dummy; vnode_t *rootvp = &dummy; +/* + * Test SDT probes with more than 5 arguments. On amd64, such probes require + * special handling since only the first 5 arguments will be passed to + * dtrace_probe() in registers; the rest must be fetched off the stack. + */ +static int +dtrace_test_sdttest(SYSCTL_HANDLER_ARGS) +{ + int val, error; + + val = 0; + error = sysctl_handle_int(oidp, &val, 0, req); + if (error || req->newptr == NULL) + return (error); + else if (val == 0) + return (0); + + SDT_PROBE7(test, , , sdttest, 1, 2, 3, 4, 5, 6, 7); + + return (error); +} + +static SYSCTL_NODE(_debug, OID_AUTO, dtracetest, CTLFLAG_RD, 0, ""); + +SYSCTL_PROC(_debug_dtracetest, OID_AUTO, sdttest, CTLTYPE_INT | CTLFLAG_RW, + NULL, 0, dtrace_test_sdttest, "I", "Trigger the SDT test probe"); + static int dtrace_test_modevent(module_t mod, int type, void *data) { Modified: stable/9/sys/modules/dtrace/dtrace_test/Makefile ============================================================================== --- stable/9/sys/modules/dtrace/dtrace_test/Makefile Fri Jan 17 11:09:05 2014 (r260819) +++ stable/9/sys/modules/dtrace/dtrace_test/Makefile Fri Jan 17 11:13:45 2014 (r260820) @@ -5,8 +5,9 @@ KMOD= dtrace_test SRCS= dtrace_test.c +SRCS+= opt_kdtrace.h SRCS+= vnode_if.h - + CFLAGS+= -I${.CURDIR}/../../.. CFLAGS+= -D_KERNEL From owner-svn-src-stable-9@FreeBSD.ORG Fri Jan 17 11:20:23 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B960F795; Fri, 17 Jan 2014 11:20:23 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A60CE1833; Fri, 17 Jan 2014 11:20:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0HBKN6R039245; Fri, 17 Jan 2014 11:20:23 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0HBKN82039244; Fri, 17 Jan 2014 11:20:23 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401171120.s0HBKN82039244@svn.freebsd.org> From: Andriy Gapon Date: Fri, 17 Jan 2014 11:20:23 +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: r260823 - stable/9/sys/sys 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.17 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: Fri, 17 Jan 2014 11:20:23 -0000 Author: avg Date: Fri Jan 17 11:20:23 2014 New Revision: 260823 URL: http://svnweb.freebsd.org/changeset/base/260823 Log: MFC r227294: SDT's struct sdt_argtype can be marked static everywhere MFC slacker: ed Modified: stable/9/sys/sys/sdt.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/9/sys/sys/sdt.h ============================================================================== --- stable/9/sys/sys/sdt.h Fri Jan 17 11:18:39 2014 (r260822) +++ stable/9/sys/sys/sdt.h Fri Jan 17 11:20:23 2014 (r260823) @@ -143,7 +143,7 @@ SET_DECLARE(sdt_argtypes_set, struct sdt (uintptr_t) arg3, (uintptr_t) arg4) #define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type) \ - struct sdt_argtype sdt_##prov##_##mod##_##func##_##name##num[1] \ + static struct sdt_argtype sdt_##prov##_##mod##_##func##_##name##num[1] \ = { { num, type, { NULL, NULL }, \ sdt_##prov##_##mod##_##func##_##name } \ }; \ From owner-svn-src-stable-9@FreeBSD.ORG Fri Jan 17 15:01:50 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D9D4031A; Fri, 17 Jan 2014 15:01:50 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C4FEE1B27; Fri, 17 Jan 2014 15:01:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0HF1o1t029517; Fri, 17 Jan 2014 15:01:50 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0HF1oRY029516; Fri, 17 Jan 2014 15:01:50 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201401171501.s0HF1oRY029516@svn.freebsd.org> From: Andriy Gapon Date: Fri, 17 Jan 2014 15:01:50 +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: r260826 - stable/9/sys/modules/dtrace 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.17 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: Fri, 17 Jan 2014 15:01:50 -0000 Author: avg Date: Fri Jan 17 15:01:50 2014 New Revision: 260826 URL: http://svnweb.freebsd.org/changeset/base/260826 Log: followup to r260816, MFC of r257037: remove dtio from dtrace Makefile svn merge ran without any complains or errors, but this Makefile somehow was not updated. This is a direct commit. Reported by: Jukka Ukkonen Modified: stable/9/sys/modules/dtrace/Makefile Modified: stable/9/sys/modules/dtrace/Makefile ============================================================================== --- stable/9/sys/modules/dtrace/Makefile Fri Jan 17 11:31:41 2014 (r260825) +++ stable/9/sys/modules/dtrace/Makefile Fri Jan 17 15:01:50 2014 (r260826) @@ -11,7 +11,6 @@ SUBDIR= dtmalloc \ dtrace_test \ lockstat \ profile \ - dtio \ prototype \ sdt \ systrace From owner-svn-src-stable-9@FreeBSD.ORG Fri Jan 17 16:29:58 2014 Return-Path: Delivered-To: svn-src-stable-9@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 28483533; Fri, 17 Jan 2014 16:29:58 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id ED97E1316; Fri, 17 Jan 2014 16:29:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0HGTveZ065525; Fri, 17 Jan 2014 16:29:57 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0HGTv0r065524; Fri, 17 Jan 2014 16:29:57 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201401171629.s0HGTv0r065524@svn.freebsd.org> From: Kirk McKusick Date: Fri, 17 Jan 2014 16:29:57 +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: r260829 - stable/9/sys/ufs/ffs 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.17 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: Fri, 17 Jan 2014 16:29:58 -0000 Author: mckusick Date: Fri Jan 17 16:29:57 2014 New Revision: 260829 URL: http://svnweb.freebsd.org/changeset/base/260829 Log: MFC of 260088: Fine tune filesystem block allocations under low free-space conditions (-r254995) based on further operational experience. Submitted by: Dmitry Sivachenko Fix Tested by: Dmitry Sivachenko Modified: stable/9/sys/ufs/ffs/ffs_alloc.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- stable/9/sys/ufs/ffs/ffs_alloc.c Fri Jan 17 16:22:10 2014 (r260828) +++ stable/9/sys/ufs/ffs/ffs_alloc.c Fri Jan 17 16:29:57 2014 (r260829) @@ -517,12 +517,12 @@ ffs_reallocblks_ufs1(ap) fs = ip->i_fs; ump = ip->i_ump; /* - * If we are not tracking block clusters or if we have less than 2% + * If we are not tracking block clusters or if we have less than 4% * free blocks left, then do not attempt to cluster. Running with * less than 5% free block reserve is not recommended and those that * choose to do so do not expect to have good file layout. */ - if (fs->fs_contigsumsize <= 0 || freespace(fs, 2) < 0) + if (fs->fs_contigsumsize <= 0 || freespace(fs, 4) < 0) return (ENOSPC); buflist = ap->a_buflist; len = buflist->bs_nchildren; @@ -743,12 +743,12 @@ ffs_reallocblks_ufs2(ap) fs = ip->i_fs; ump = ip->i_ump; /* - * If we are not tracking block clusters or if we have less than 2% + * If we are not tracking block clusters or if we have less than 4% * free blocks left, then do not attempt to cluster. Running with * less than 5% free block reserve is not recommended and those that * choose to do so do not expect to have good file layout. */ - if (fs->fs_contigsumsize <= 0 || freespace(fs, 2) < 0) + if (fs->fs_contigsumsize <= 0 || freespace(fs, 4) < 0) return (ENOSPC); buflist = ap->a_buflist; len = buflist->bs_nchildren; From owner-svn-src-stable-9@FreeBSD.ORG Fri Jan 17 18:53:08 2014 Return-Path: Delivered-To: svn-src-stable-9@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 49A6079F for ; Fri, 17 Jan 2014 18:53:08 +0000 (UTC) Received: from mail-pb0-x242.google.com (mail-pb0-x242.google.com [IPv6:2607:f8b0:400e:c01::242]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 224871FC9 for ; Fri, 17 Jan 2014 18:53:08 +0000 (UTC) Received: by mail-pb0-f66.google.com with SMTP id ma3so3121160pbc.9 for ; Fri, 17 Jan 2014 10:53:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=message-id:from:to:reply-to:subject:date; bh=Iyk2K6fvYNLbDPkOF2p5SQgAED667GVP56ua58RI4bE=; b=vNYlxuJ7tQOkEyWkXRd+DrmrnDvnLP4k9SMtJzRUaywcQ4cJ5mNGi6Mwt/ZCpXElPQ QYZ5T56sof17PQhSQnUE9rP3NvI3Xqsv+GNxe0qFKA319JaO7aK4wPYAbnIAnCds548E TuLS4WXT/PWymhNE1n25S2fUkQTsDAU78G8eiF8vGmwLIQJcx0qywguOF/dvJ4L2K37F BUpITUSPvX8KStCL4EtBUHvvjZunAYEHFY4FPMfX18vTL04X9lXZXcU9POJ0Oq8vqNNu m/cpGjFKGnrCoWylc3UxDlIP0Y3Gv5V7vkL0FLyEfvFuejnh55Vm8SHK7lsWNqAeIzrj b+Kw== X-Received: by 10.66.232.40 with SMTP id tl8mr3777554pac.137.1389984787828; Fri, 17 Jan 2014 10:53:07 -0800 (PST) Received: from localhost.localdomain ([124.253.47.249]) by mx.google.com with ESMTPSA id nw11sm33113848pab.13.2014.01.17.10.53.05 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 17 Jan 2014 10:53:07 -0800 (PST) Message-ID: <52d97c13.8b81420a.69f1.642f@mx.google.com> From: brigitte85842@googlemail.com To: svn-src-stable-9@freebsd.org Subject: RE: LOCAL MAP OPTIMIZATION FOR : mail-archive.com (Less Than $99/Month) Date: Sat, 18 Jan 2014 00:23:13 +0530 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list Reply-To: JUDY18088@gmail.com 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: Fri, 17 Jan 2014 18:53:08 -0000 Good Morning Sir / Mam Is your business ranking in local maps shown on PAGE 1 of google ? With new google policies they have specifically asked local business owners to optimize their website for local maps rather than JUST organics. Do you know the reason why you are not ranked well on google MAPs or why there is drop in your website rankings? Prime reason for bad rankings for a busniess is lack of local presence and local citations ie getting your business listed on directories like YELP, MANTA & Many more. These websites not just give your business a push but also help you Maintain a good Online Reputation. Why you need to optimize your website for local MAP Listings ? - MAP listings get 10 times more clicks than organic listings - Increased conversions because of real reviews posted on your Google Plus Page - Every year there is 30% increase in searches for local keywords - Increases legitimacy of a Business We will help you get your website ranked well on google for the related keywords in your niche. We specialize in LOCAL SEARCH ENGINE OPTIMIZATION increasing visibility for small businesses by ranking them for geographically-related keywords. Say for eg-: you want to search a plumber in your city, You will be typing in keywords like Plumbers + City Or Plumbers + IN + City. We make sure your website comes in google MAP listings shown on page 1 for each such keyword. Now Google believes in - BE ORIGINAL, HAVE ORIGINAL AND GIVE ORIGINAL which means that google wants to end up that frustrating experience of users who are searching for Service Or Product and seeing the results that are not even close to what they are looking for. Google only wants to give their user original and relevant results. This makes it even more important that we showcase our business in the best possible way and make sure our website in valued high by google. We at TheLOCALIST will make google feel the importance of your business by following their guidelines thus ranking your website higher in serach results. We are presently offering LOCAL OPTIMIZATION to more than 400 websites and they all rank page 1 for all possible keywords !!! Each month your website is submitted to more than 50 citations and social presence is controlled by posting videos and blogs all over the web. Email us back with your website & phone number so we can discuss this further with you. Our Packages start from as low as 99$/month. Thanks For Taking Time To Read Our Email Polly Martin Local SEO Manager ( THE Localist ) Address : 24 ST Suite 32 Downtown Provo Utah ------------------- NOT INTERESTED ? REPLY WITH NOT INTERESTED IN THE SUBJECT LINE From owner-svn-src-stable-9@FreeBSD.ORG Sat Jan 18 03:35:11 2014 Return-Path: Delivered-To: svn-src-stable-9@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 082328DD; Sat, 18 Jan 2014 03:35:11 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E824916C4; Sat, 18 Jan 2014 03:35:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0I3ZAf4042128; Sat, 18 Jan 2014 03:35:10 GMT (envelope-from bryanv@svn.freebsd.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0I3ZAc1042127; Sat, 18 Jan 2014 03:35:10 GMT (envelope-from bryanv@svn.freebsd.org) Message-Id: <201401180335.s0I3ZAc1042127@svn.freebsd.org> From: Bryan Venteicher Date: Sat, 18 Jan 2014 03:35:10 +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: r260838 - stable/9/sys/dev/virtio/scsi 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.17 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, 18 Jan 2014 03:35:11 -0000 Author: bryanv Date: Sat Jan 18 03:35:10 2014 New Revision: 260838 URL: http://svnweb.freebsd.org/changeset/base/260838 Log: MFC r260566: Remove incorrect bit shift when assigning the LUN request field Modified: stable/9/sys/dev/virtio/scsi/virtio_scsi.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/virtio/scsi/virtio_scsi.c ============================================================================== --- stable/9/sys/dev/virtio/scsi/virtio_scsi.c Sat Jan 18 03:33:01 2014 (r260837) +++ stable/9/sys/dev/virtio/scsi/virtio_scsi.c Sat Jan 18 03:35:10 2014 (r260838) @@ -1539,7 +1539,7 @@ vtscsi_set_request_lun(struct ccb_hdr *c lun[0] = 1; lun[1] = ccbh->target_id; lun[2] = 0x40 | ((ccbh->target_lun >> 8) & 0x3F); - lun[3] = (ccbh->target_lun >> 8) & 0xFF; + lun[3] = ccbh->target_lun & 0xFF; } static void From owner-svn-src-stable-9@FreeBSD.ORG Sat Jan 18 21:21:45 2014 Return-Path: Delivered-To: svn-src-stable-9@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 57EB1649; Sat, 18 Jan 2014 21:21:45 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4264F1249; Sat, 18 Jan 2014 21:21:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0ILLjh2048121; Sat, 18 Jan 2014 21:21:45 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0ILLjkW048120; Sat, 18 Jan 2014 21:21:45 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201401182121.s0ILLjkW048120@svn.freebsd.org> From: Sergey Kandaurov Date: Sat, 18 Jan 2014 21:21:45 +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: r260862 - stable/9/sys/sys 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.17 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, 18 Jan 2014 21:21:45 -0000 Author: pluknet Date: Sat Jan 18 21:21:44 2014 New Revision: 260862 URL: http://svnweb.freebsd.org/changeset/base/260862 Log: MFC r250816: Protect SDT_PROBE() with do { } while (0) loop. Modified: stable/9/sys/sys/sdt.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/9/sys/sys/sdt.h ============================================================================== --- stable/9/sys/sys/sdt.h Sat Jan 18 20:54:55 2014 (r260861) +++ stable/9/sys/sys/sdt.h Sat Jan 18 21:21:44 2014 (r260862) @@ -136,11 +136,12 @@ SET_DECLARE(sdt_argtypes_set, struct sdt #define SDT_PROBE_DECLARE(prov, mod, func, name) \ extern struct sdt_probe sdt_##prov##_##mod##_##func##_##name[1] -#define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) \ +#define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) do { \ if (sdt_##prov##_##mod##_##func##_##name->id) \ (*sdt_probe_func)(sdt_##prov##_##mod##_##func##_##name->id, \ (uintptr_t) arg0, (uintptr_t) arg1, (uintptr_t) arg2, \ - (uintptr_t) arg3, (uintptr_t) arg4) + (uintptr_t) arg3, (uintptr_t) arg4); \ +} while (0) #define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type) \ static struct sdt_argtype sdt_##prov##_##mod##_##func##_##name##num[1] \ From owner-svn-src-stable-9@FreeBSD.ORG Sat Jan 18 22:52:44 2014 Return-Path: Delivered-To: svn-src-stable-9@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 E58982B2; Sat, 18 Jan 2014 22:52:43 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C5ACD17F7; Sat, 18 Jan 2014 22:52:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0IMqhHX082530; Sat, 18 Jan 2014 22:52:43 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0IMqhwh082529; Sat, 18 Jan 2014 22:52:43 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401182252.s0IMqhwh082529@svn.freebsd.org> From: Alexander Motin Date: Sat, 18 Jan 2014 22:52:43 +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: r260868 - stable/9/sys/boot/i386/libi386 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.17 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, 18 Jan 2014 22:52:44 -0000 Author: mav Date: Sat Jan 18 22:52:43 2014 New Revision: 260868 URL: http://svnweb.freebsd.org/changeset/base/260868 Log: MFC r245848 (by jhb): Always update the hw.uart.console hint anytime a change is made to the comconsole setup. Previously the hint would be set when if you set a custom port, but it would not be updated if you later set a custom speed. Also, leave the hw.uart.console hint mutable so it can be overridden or unset by the user if needed. Modified: stable/9/sys/boot/i386/libi386/comconsole.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/boot/ (props changed) Modified: stable/9/sys/boot/i386/libi386/comconsole.c ============================================================================== --- stable/9/sys/boot/i386/libi386/comconsole.c Sat Jan 18 22:47:25 2014 (r260867) +++ stable/9/sys/boot/i386/libi386/comconsole.c Sat Jan 18 22:52:43 2014 (r260868) @@ -50,7 +50,6 @@ static int comc_init(int arg); static void comc_putchar(int c); static int comc_getchar(void); static int comc_getspeed(void); -static void set_hw_console_hint(void); static int comc_ischar(void); static int comc_parseint(const char *string); static uint32_t comc_parse_pcidev(const char *string); @@ -202,27 +201,14 @@ comc_port_set(struct env_var *ev, int fl } if ((comconsole.c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) != 0 && - comc_port != port) { + comc_port != port) comc_setup(comc_curspeed, port); - set_hw_console_hint(); - } env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); return (CMD_OK); } -static void -set_hw_console_hint(void) -{ - char intbuf[64]; - - unsetenv("hw.uart.console"); - sprintf(intbuf, "io:%d,br:%d", comc_port, comc_curspeed); - env_setenv("hw.uart.console", EV_VOLATILE, intbuf, - env_noset, env_nounset); -} - /* * Input: bus:dev:func[:bar]. If bar is not specified, it is 0x10. * Output: bar[24:16] bus[15:8] dev[7:3] func[2:0] @@ -288,7 +274,6 @@ comc_pcidev_handle(uint32_t locator) comc_port_set, env_nounset); comc_setup(comc_curspeed, port); - set_hw_console_hint(); comc_locator = locator; return (CMD_OK); @@ -318,8 +303,10 @@ static void comc_setup(int speed, int port) { static int TRY_COUNT = 1000000; + char intbuf[64]; int tries; + unsetenv("hw.uart.console"); comc_curspeed = speed; comc_port = port; @@ -334,9 +321,11 @@ comc_setup(int speed, int port) inb(comc_port + com_data); while (inb(comc_port + com_lsr) & LSR_RXRDY && ++tries < TRY_COUNT); - if (tries < TRY_COUNT) + if (tries < TRY_COUNT) { comconsole.c_flags |= (C_PRESENTIN | C_PRESENTOUT); - else + sprintf(intbuf, "io:%d,br:%d", comc_port, comc_curspeed); + env_setenv("hw.uart.console", EV_VOLATILE, intbuf, NULL, NULL); + } else comconsole.c_flags &= ~(C_PRESENTIN | C_PRESENTOUT); } From owner-svn-src-stable-9@FreeBSD.ORG Sat Jan 18 22:59:11 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 01BAF845; Sat, 18 Jan 2014 22:59:11 +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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C7F241836; Sat, 18 Jan 2014 22:59:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0IMxAeC083570; Sat, 18 Jan 2014 22:59:10 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0IMxA1F083569; Sat, 18 Jan 2014 22:59:10 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401182259.s0IMxA1F083569@svn.freebsd.org> From: Alexander Motin Date: Sat, 18 Jan 2014 22:59:10 +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: r260869 - stable/9/sys/boot/pc98/libpc98 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.17 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, 18 Jan 2014 22:59:11 -0000 Author: mav Date: Sat Jan 18 22:59:10 2014 New Revision: 260869 URL: http://svnweb.freebsd.org/changeset/base/260869 Log: MFC r251223 (by nyan): Always update the hw.uart.console hint. Modified: stable/9/sys/boot/pc98/libpc98/comconsole.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/boot/ (props changed) Modified: stable/9/sys/boot/pc98/libpc98/comconsole.c ============================================================================== --- stable/9/sys/boot/pc98/libpc98/comconsole.c Sat Jan 18 22:52:43 2014 (r260868) +++ stable/9/sys/boot/pc98/libpc98/comconsole.c Sat Jan 18 22:59:10 2014 (r260869) @@ -50,7 +50,6 @@ static int comc_init(int arg); static void comc_putchar(int c); static int comc_getchar(void); static int comc_getspeed(void); -static void set_hw_console_hint(void); static int comc_ischar(void); static int comc_parseint(const char *string); static uint32_t comc_parse_pcidev(const char *string); @@ -202,27 +201,14 @@ comc_port_set(struct env_var *ev, int fl } if ((comconsole.c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) != 0 && - comc_port != port) { + comc_port != port) comc_setup(comc_curspeed, port); - set_hw_console_hint(); - } env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); return (CMD_OK); } -static void -set_hw_console_hint(void) -{ - char intbuf[64]; - - unsetenv("hw.uart.console"); - sprintf(intbuf, "io:%d,br:%d", comc_port, comc_curspeed); - env_setenv("hw.uart.console", EV_VOLATILE, intbuf, - env_noset, env_nounset); -} - /* * Input: bus:dev:func[:bar]. If bar is not specified, it is 0x10. * Output: bar[24:16] bus[15:8] dev[7:3] func[2:0] @@ -288,7 +274,6 @@ comc_pcidev_handle(uint32_t locator) comc_port_set, env_nounset); comc_setup(comc_curspeed, port); - set_hw_console_hint(); comc_locator = locator; return (CMD_OK); @@ -318,8 +303,10 @@ static void comc_setup(int speed, int port) { static int TRY_COUNT = 1000000; + char intbuf[64]; int tries; + unsetenv("hw.uart.console"); comc_curspeed = speed; comc_port = port; @@ -334,9 +321,11 @@ comc_setup(int speed, int port) inb(comc_port + com_data); while (inb(comc_port + com_lsr) & LSR_RXRDY && ++tries < TRY_COUNT); - if (tries < TRY_COUNT) + if (tries < TRY_COUNT) { comconsole.c_flags |= (C_PRESENTIN | C_PRESENTOUT); - else + sprintf(intbuf, "io:%d,br:%d", comc_port, comc_curspeed); + env_setenv("hw.uart.console", EV_VOLATILE, intbuf, NULL, NULL); + } else comconsole.c_flags &= ~(C_PRESENTIN | C_PRESENTOUT); }