From owner-svn-src-all@freebsd.org Fri Oct 4 05:28:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7DDF2FBD52; Fri, 4 Oct 2019 05:28:38 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46kz1f2QXWz3yxH; Fri, 4 Oct 2019 05:28:38 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 31ECC1F8FF; Fri, 4 Oct 2019 05:28:38 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x945SbIV083584; Fri, 4 Oct 2019 05:28:37 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x945SbaL083579; Fri, 4 Oct 2019 05:28:37 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201910040528.x945SbaL083579@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Fri, 4 Oct 2019 05:28:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353099 - in head/sys/ufs: ffs ufs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: in head/sys/ufs: ffs ufs X-SVN-Commit-Revision: 353099 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Oct 2019 05:28:38 -0000 Author: mckusick Date: Fri Oct 4 05:28:36 2019 New Revision: 353099 URL: https://svnweb.freebsd.org/changeset/base/353099 Log: Update ffs_getcg() function to accept a flags parameter to be passed to breadn_flags() in preparation for later need when doing forcible unmount when disk dies or is removed. No functional change. Sponsored by: Netflix Modified: head/sys/ufs/ffs/ffs_alloc.c head/sys/ufs/ffs/ffs_extern.h head/sys/ufs/ffs/ffs_snapshot.c head/sys/ufs/ffs/ffs_vfsops.c head/sys/ufs/ufs/ufs_gjournal.c Modified: head/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- head/sys/ufs/ffs/ffs_alloc.c Fri Oct 4 05:02:39 2019 (r353098) +++ head/sys/ufs/ffs/ffs_alloc.c Fri Oct 4 05:28:36 2019 (r353099) @@ -1689,7 +1689,7 @@ ffs_fragextend(ip, cg, bprev, osize, nsize) return (0); } UFS_UNLOCK(ump); - if ((error = ffs_getcg(fs, ump->um_devvp, cg, &bp, &cgp)) != 0) + if ((error = ffs_getcg(fs, ump->um_devvp, cg, 0, &bp, &cgp)) != 0) goto fail; bno = dtogd(fs, bprev); blksfree = cg_blksfree(cgp); @@ -1760,7 +1760,7 @@ ffs_alloccg(ip, cg, bpref, size, rsize) if (fs->fs_cs(fs, cg).cs_nbfree == 0 && size == fs->fs_bsize) return (0); UFS_UNLOCK(ump); - if ((error = ffs_getcg(fs, ump->um_devvp, cg, &bp, &cgp)) != 0 || + if ((error = ffs_getcg(fs, ump->um_devvp, cg, 0, &bp, &cgp)) != 0 || (cgp->cg_cs.cs_nbfree == 0 && size == fs->fs_bsize)) goto fail; if (size == fs->fs_bsize) { @@ -1940,7 +1940,7 @@ ffs_clusteralloc(ip, cg, bpref, len) if (fs->fs_maxcluster[cg] < len) return (0); UFS_UNLOCK(ump); - if ((error = ffs_getcg(fs, ump->um_devvp, cg, &bp, &cgp)) != 0) { + if ((error = ffs_getcg(fs, ump->um_devvp, cg, 0, &bp, &cgp)) != 0) { UFS_LOCK(ump); return (0); } @@ -2082,7 +2082,7 @@ check_nifree: if (fs->fs_cs(fs, cg).cs_nifree == 0) return (0); UFS_UNLOCK(ump); - if ((error = ffs_getcg(fs, ump->um_devvp, cg, &bp, &cgp)) != 0) { + if ((error = ffs_getcg(fs, ump->um_devvp, cg, 0, &bp, &cgp)) != 0) { UFS_LOCK(ump); return (0); } @@ -2179,7 +2179,7 @@ gotit: * to it, then leave it unchanged as the other thread * has already set it correctly. */ - error = ffs_getcg(fs, ump->um_devvp, cg, &bp, &cgp); + error = ffs_getcg(fs, ump->um_devvp, cg, 0, &bp, &cgp); UFS_LOCK(ump); ACTIVECLEAR(fs, cg); UFS_UNLOCK(ump); @@ -2261,7 +2261,7 @@ ffs_blkfree_cg(ump, fs, devvp, bno, size, inum, dephd) ffs_fserr(fs, inum, "bad block"); return; } - if ((error = ffs_getcg(fs, devvp, cg, &bp, &cgp)) != 0) + if ((error = ffs_getcg(fs, devvp, cg, 0, &bp, &cgp)) != 0) return; cgbno = dtogd(fs, bno); blksfree = cg_blksfree(cgp); @@ -2728,7 +2728,7 @@ ffs_checkblk(ip, bno, size) } if ((u_int)bno >= fs->fs_size) panic("ffs_checkblk: bad block %jd", (intmax_t)bno); - error = ffs_getcg(fs, ITODEVVP(ip), dtog(fs, bno), &bp, &cgp); + error = ffs_getcg(fs, ITODEVVP(ip), dtog(fs, bno), 0, &bp, &cgp); if (error) panic("ffs_checkblk: cylinder group read failed"); blksfree = cg_blksfree(cgp); @@ -2802,7 +2802,7 @@ ffs_freefile(ump, fs, devvp, ino, mode, wkhd) if (ino >= fs->fs_ipg * fs->fs_ncg) panic("ffs_freefile: range: dev = %s, ino = %ju, fs = %s", devtoname(dev), (uintmax_t)ino, fs->fs_fsmnt); - if ((error = ffs_getcg(fs, devvp, cg, &bp, &cgp)) != 0) + if ((error = ffs_getcg(fs, devvp, cg, 0, &bp, &cgp)) != 0) return (error); inosused = cg_inosused(cgp); ino %= fs->fs_ipg; @@ -2855,7 +2855,7 @@ ffs_checkfreefile(fs, devvp, ino) return (1); if (ino >= fs->fs_ipg * fs->fs_ncg) return (1); - if ((error = ffs_getcg(fs, devvp, cg, &bp, &cgp)) != 0) + if ((error = ffs_getcg(fs, devvp, cg, 0, &bp, &cgp)) != 0) return (1); inosused = cg_inosused(cgp); ino %= fs->fs_ipg; @@ -2944,21 +2944,21 @@ ffs_getmntstat(struct vnode *devvp) * Fetch and verify a cylinder group. */ int -ffs_getcg(fs, devvp, cg, bpp, cgpp) +ffs_getcg(fs, devvp, cg, flags, bpp, cgpp) struct fs *fs; struct vnode *devvp; u_int cg; + int flags; struct buf **bpp; struct cg **cgpp; { struct buf *bp; struct cg *cgp; const struct statfs *sfs; - int flags, error; + int error; *bpp = NULL; *cgpp = NULL; - flags = 0; if ((fs->fs_metackhash & CK_CYLGRP) != 0) flags |= GB_CKHASH; error = breadn_flags(devvp, devvp->v_type == VREG ? Modified: head/sys/ufs/ffs/ffs_extern.h ============================================================================== --- head/sys/ufs/ffs/ffs_extern.h Fri Oct 4 05:02:39 2019 (r353098) +++ head/sys/ufs/ffs/ffs_extern.h Fri Oct 4 05:28:36 2019 (r353099) @@ -80,7 +80,7 @@ void ffs_fragacct(struct fs *, int, int32_t [], int); int ffs_freefile(struct ufsmount *, struct fs *, struct vnode *, ino_t, int, struct workhead *); void ffs_fserr(struct fs *, ino_t, char *); -int ffs_getcg(struct fs *, struct vnode *, u_int, struct buf **, +int ffs_getcg(struct fs *, struct vnode *, u_int, int, struct buf **, struct cg **); int ffs_isblock(struct fs *, u_char *, ufs1_daddr_t); int ffs_isfreeblock(struct fs *, u_char *, ufs1_daddr_t); Modified: head/sys/ufs/ffs/ffs_snapshot.c ============================================================================== --- head/sys/ufs/ffs/ffs_snapshot.c Fri Oct 4 05:02:39 2019 (r353098) +++ head/sys/ufs/ffs/ffs_snapshot.c Fri Oct 4 05:28:36 2019 (r353099) @@ -899,7 +899,7 @@ cgaccount(cg, vp, nbp, passno) ip = VTOI(vp); fs = ITOFS(ip); - if ((error = ffs_getcg(fs, ITODEVVP(ip), cg, &bp, &cgp)) != 0) + if ((error = ffs_getcg(fs, ITODEVVP(ip), cg, 0, &bp, &cgp)) != 0) return (error); UFS_LOCK(ITOUMP(ip)); ACTIVESET(fs, cg); Modified: head/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vfsops.c Fri Oct 4 05:02:39 2019 (r353098) +++ head/sys/ufs/ffs/ffs_vfsops.c Fri Oct 4 05:28:36 2019 (r353099) @@ -1880,7 +1880,7 @@ ffs_fhtovp(mp, fhp, flags, vpp) if (fs->fs_magic != FS_UFS2_MAGIC) return (ufs_fhtovp(mp, ufhp, flags, vpp)); cg = ino_to_cg(fs, ino); - if ((error = ffs_getcg(fs, ump->um_devvp, cg, &bp, &cgp)) != 0) + if ((error = ffs_getcg(fs, ump->um_devvp, cg, 0, &bp, &cgp)) != 0) return (error); if (ino >= cg * fs->fs_ipg + cgp->cg_initediblk) { brelse(bp); Modified: head/sys/ufs/ufs/ufs_gjournal.c ============================================================================== --- head/sys/ufs/ufs/ufs_gjournal.c Fri Oct 4 05:02:39 2019 (r353098) +++ head/sys/ufs/ufs/ufs_gjournal.c Fri Oct 4 05:28:36 2019 (r353099) @@ -85,7 +85,7 @@ ufs_gjournal_modref(struct vnode *vp, int count) if ((u_int)ino >= fs->fs_ipg * fs->fs_ncg) panic("ufs_gjournal_modref: range: dev = %s, ino = %lu, fs = %s", devtoname(dev), (u_long)ino, fs->fs_fsmnt); - if ((error = ffs_getcg(fs, devvp, cg, &bp, &cgp)) != 0) + if ((error = ffs_getcg(fs, devvp, cg, 0, &bp, &cgp)) != 0) return (error); cgp->cg_unrefs += count; UFS_LOCK(ump);