The branch stable/13 has been updated by mckusick:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=5c6b3e4b5dfa554e7e6eb246481e654402de1ca0

commit 5c6b3e4b5dfa554e7e6eb246481e654402de1ca0
Author:     Kirk McKusick <[email protected]>
AuthorDate: 2021-09-18 23:51:07 +0000
Commit:     Kirk McKusick <[email protected]>
CommitDate: 2021-09-28 03:13:38 +0000

    Eliminate snaplk / bufwait LOR when creating UFS snapshots
    
    (cherry picked from commit d7770a5495b19a987dddc77cabcdeadf18413b4d)
---
 sys/ufs/ffs/ffs_snapshot.c | 42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c
index 6da84fb46bb0..baad50cab2ba 100644
--- a/sys/ufs/ffs/ffs_snapshot.c
+++ b/sys/ufs/ffs/ffs_snapshot.c
@@ -650,6 +650,27 @@ loop:
                            BLK_NOCOPY, 0);
                vput(xvp);
        }
+       /*
+        * Preallocate all the direct blocks in the snapshot inode so
+        * that we never have to write the inode itself to commit an
+        * update to the contents of the snapshot. Note that once
+        * created, the size of the snapshot will never change, so
+        * there will never be a need to write the inode except to
+        * update the non-integrity-critical time fields and
+        * allocated-block count.
+        */
+       for (blockno = 0; blockno < UFS_NDADDR; blockno++) {
+               if (DIP(ip, i_db[blockno]) != 0)
+                       continue;
+               error = UFS_BALLOC(vp, lblktosize(fs, blockno),
+                   fs->fs_bsize, KERNCRED, BA_CLRBUF, &bp);
+               if (error)
+                       goto resumefs;
+               error = readblock(vp, bp, blockno);
+               bawrite(bp);
+               if (error != 0)
+                       goto resumefs;
+       }
        /*
         * Acquire a lock on the snapdata structure, creating it if necessary.
         */
@@ -691,27 +712,6 @@ loop:
                sn->sn_listsize = blkp - snapblklist;
                VI_UNLOCK(devvp);
        }
-       /*
-        * Preallocate all the direct blocks in the snapshot inode so
-        * that we never have to write the inode itself to commit an
-        * update to the contents of the snapshot. Note that once
-        * created, the size of the snapshot will never change, so
-        * there will never be a need to write the inode except to
-        * update the non-integrity-critical time fields and
-        * allocated-block count.
-        */
-       for (blockno = 0; blockno < UFS_NDADDR; blockno++) {
-               if (DIP(ip, i_db[blockno]) != 0)
-                       continue;
-               error = UFS_BALLOC(vp, lblktosize(fs, blockno),
-                   fs->fs_bsize, KERNCRED, BA_CLRBUF, &bp);
-               if (error)
-                       goto resumefs;
-               error = readblock(vp, bp, blockno);
-               bawrite(bp);
-               if (error != 0)
-                       goto resumefs;
-       }
        /*
         * Record snapshot inode. Since this is the newest snapshot,
         * it must be placed at the end of the list.
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to