Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Sep 2019 08:07:12 +0000 (UTC)
From:      Conrad Meyer <cem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r351926 - head/sys/fs/ext2fs
Message-ID:  <201909060807.x8687CDH050796@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cem
Date: Fri Sep  6 08:07:12 2019
New Revision: 351926
URL: https://svnweb.freebsd.org/changeset/base/351926

Log:
  ext2fs: Remove redundant brelse() after r294954
  
  Coccinelle:
  
  @ rule1 @
   identifier __error;
  @@
   ...
   int __error;
   ...
  
  @ rule2 depends on rule1 @
   identifier rule1.__error;
   identifier __bp;
  @@
  
   __error =
  (
   bread
  |
   bread_gb
  |
   breadn
  |
   breadn_flags
  )
   (..., &__bp);
   if (
  (
   __error
  |
   __error != 0
  )
   ) {
   ...
  - brelse(__bp);
   ...
   }
  
  No functional change.

Modified:
  head/sys/fs/ext2fs/ext2_alloc.c
  head/sys/fs/ext2fs/ext2_balloc.c
  head/sys/fs/ext2fs/ext2_extattr.c
  head/sys/fs/ext2fs/ext2_extents.c
  head/sys/fs/ext2fs/ext2_vfsops.c

Modified: head/sys/fs/ext2fs/ext2_alloc.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_alloc.c	Fri Sep  6 05:34:31 2019	(r351925)
+++ head/sys/fs/ext2fs/ext2_alloc.c	Fri Sep  6 08:07:12 2019	(r351926)
@@ -1313,7 +1313,6 @@ ext2_nodealloccg(struct inode *ip, int cg, daddr_t ipr
 	    e2fs_gd_get_i_bitmap(&fs->e2fs_gd[cg])),
 	    (int)fs->e2fs_bsize, NOCRED, &bp);
 	if (error) {
-		brelse(bp);
 		EXT2_LOCK(ump);
 		return (0);
 	}
@@ -1417,7 +1416,6 @@ ext2_blkfree(struct inode *ip, e4fs_daddr_t bno, long 
 	    fsbtodb(fs, e2fs_gd_get_b_bitmap(&fs->e2fs_gd[cg])),
 	    (int)fs->e2fs_bsize, NOCRED, &bp);
 	if (error) {
-		brelse(bp);
 		return;
 	}
 	bbp = (char *)bp->b_data;
@@ -1464,7 +1462,6 @@ ext2_vfree(struct vnode *pvp, ino_t ino, int mode)
 	    fsbtodb(fs, e2fs_gd_get_i_bitmap(&fs->e2fs_gd[cg])),
 	    (int)fs->e2fs_bsize, NOCRED, &bp);
 	if (error) {
-		brelse(bp);
 		return (0);
 	}
 	ibp = (char *)bp->b_data;

Modified: head/sys/fs/ext2fs/ext2_balloc.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_balloc.c	Fri Sep  6 05:34:31 2019	(r351925)
+++ head/sys/fs/ext2fs/ext2_balloc.c	Fri Sep  6 08:07:12 2019	(r351926)
@@ -78,7 +78,6 @@ ext2_ext_balloc(struct inode *ip, uint32_t lbn, int si
 	} else {
 		error = bread(vp, lbn, fs->e2fs_bsize, NOCRED, &bp);
 		if (error) {
-			brelse(bp);
 			return (error);
 		}
 	}
@@ -142,7 +141,6 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t lbn, int size
 		if (nb != 0) {
 			error = bread(vp, lbn, fs->e2fs_bsize, NOCRED, &bp);
 			if (error) {
-				brelse(bp);
 				return (error);
 			}
 			bp->b_blkno = fsbtodb(fs, nb);
@@ -219,7 +217,6 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t lbn, int size
 		error = bread(vp,
 		    indirs[i].in_lbn, (int)fs->e2fs_bsize, NOCRED, &bp);
 		if (error) {
-			brelse(bp);
 			return (error);
 		}
 		bap = (e2fs_daddr_t *)bp->b_data;

Modified: head/sys/fs/ext2fs/ext2_extattr.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_extattr.c	Fri Sep  6 05:34:31 2019	(r351925)
+++ head/sys/fs/ext2fs/ext2_extattr.c	Fri Sep  6 08:07:12 2019	(r351926)
@@ -280,7 +280,6 @@ ext2_extattr_block_list(struct inode *ip, int attrname
 	error = bread(ip->i_devvp, fsbtodb(fs, ip->i_facl),
 	    fs->e2fs_bsize, NOCRED, &bp);
 	if (error) {
-		brelse(bp);
 		return (error);
 	}
 
@@ -421,7 +420,6 @@ ext2_extattr_block_get(struct inode *ip, int attrnames
 	error = bread(ip->i_devvp, fsbtodb(fs, ip->i_facl),
 	    fs->e2fs_bsize, NOCRED, &bp);
 	if (error) {
-		brelse(bp);
 		return (error);
 	}
 
@@ -681,7 +679,6 @@ ext2_extattr_block_delete(struct inode *ip, int attrna
 	error = bread(ip->i_devvp, fsbtodb(fs, ip->i_facl),
 	    fs->e2fs_bsize, NOCRED, &bp);
 	if (error) {
-		brelse(bp);
 		return (error);
 	}
 
@@ -1074,7 +1071,6 @@ ext2_extattr_block_set(struct inode *ip, int attrnames
 		error = bread(ip->i_devvp, fsbtodb(fs, ip->i_facl),
 		    fs->e2fs_bsize, NOCRED, &bp);
 		if (error) {
-			brelse(bp);
 			return (error);
 		}
 
@@ -1221,7 +1217,6 @@ int ext2_extattr_free(struct inode *ip)
 	error = bread(ip->i_devvp, fsbtodb(fs, ip->i_facl),
 	    fs->e2fs_bsize, NOCRED, &bp);
 	if (error) {
-		brelse(bp);
 		return (error);
 	}
 

Modified: head/sys/fs/ext2fs/ext2_extents.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_extents.c	Fri Sep  6 05:34:31 2019	(r351925)
+++ head/sys/fs/ext2fs/ext2_extents.c	Fri Sep  6 08:07:12 2019	(r351926)
@@ -415,7 +415,6 @@ ext4_ext_find_extent(struct inode *ip, daddr_t block,
 		error = bread(ip->i_devvp, fsbtodb(ip->i_e2fs, blk),
 		    ip->i_e2fs->e2fs_bsize, NOCRED, &bp);
 		if (error) {
-			brelse(bp);
 			goto error;
 		}
 
@@ -824,7 +823,6 @@ ext4_ext_split(struct inode *ip, struct ext4_extent_pa
 		error = bread(ip->i_devvp, fsbtodb(fs, newblk),
 		    (int)fs->e2fs_bsize, NOCRED, &bp);
 		if (error) {
-			brelse(bp);
 			goto cleanup;
 		}
 
@@ -1452,7 +1450,6 @@ ext4_read_extent_tree_block(struct inode *ip, e4fs_dad
 	error = bread(ip->i_devvp, fsbtodb(fs, pblk),
 	    fs->e2fs_bsize, NOCRED, &bp);
 	if (error) {
-		brelse(bp);
 		return (NULL);
 	}
 

Modified: head/sys/fs/ext2fs/ext2_vfsops.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_vfsops.c	Fri Sep  6 05:34:31 2019	(r351925)
+++ head/sys/fs/ext2fs/ext2_vfsops.c	Fri Sep  6 08:07:12 2019	(r351926)
@@ -651,7 +651,6 @@ ext2_compute_sb_data(struct vnode *devvp, struct ext2f
 			 * because this function could be called from
 			 * MNT_UPDATE path.
 			 */
-			brelse(bp);
 			return (error);
 		}
 		if (EXT2_HAS_INCOMPAT_FEATURE(fs, EXT2F_INCOMPAT_64BIT)) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909060807.x8687CDH050796>