NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/47937: mount -o discard,log is broken



The following reply was made to PR kern/47937; it has been noted by GNATS.

From: Jeff Rizzo <riz%NetBSD.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: kern/47937: mount -o discard,log is broken
Date: Sun, 16 Jun 2013 16:19:53 -0700

 This is a multi-part message in MIME format.
 --------------000306020501040407070609
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 Content-Transfer-Encoding: 7bit
 
 With some help from riastradh@, this actually seems to make it work:
 
 Index: ufs/ffs/ffs_alloc.c
 ===================================================================
 RCS file: /cvsroot/src/sys/ufs/ffs/ffs_alloc.c,v
 retrieving revision 1.133
 diff -u -r1.133 ffs_alloc.c
 --- ufs/ffs/ffs_alloc.c        22 Jan 2013 09:39:15 -0000      1.133
 +++ ufs/ffs/ffs_alloc.c        16 Jun 2013 23:16:47 -0000
 @@ -1572,6 +1572,7 @@
        dev = devvp->v_rdev;
        ump = VFSTOUFS(devvp->v_specmountpoint);
        KASSERT(fs == ump->um_fs);
 +      UFS_WAPBL_JLOCK_ASSERT(ump->um_mountp);
        cgblkno = fsbtodb(fs, cgtod(fs, cg));
   
        error = bread(devvp, cgblkno, (int)fs->fs_cgsize,
 @@ -1613,11 +1614,18 @@
   ffs_blkfree_td(struct fs *fs, struct discardopdata *td)
   {
        long todo;
 +      int err;
 +      struct ufsmount *ump;
 +
 +      ump = VFSTOUFS(td->devvp->v_specmountpoint);
   
        while (td->size) {
                todo = min(td->size,
                  lfragtosize(fs, (fs->fs_frag - fragnum(fs, td->bno))));
 +              err = UFS_WAPBL_BEGIN(ump->um_mountp);
                ffs_blkfree_cg(fs, td->devvp, td->bno, todo);
 +              if ( err == 0 )
 +                  UFS_WAPBL_END(ump->um_mountp);
                td->bno += numfrags(fs, todo);
                td->size -= todo;
        }
 
 
 
 
 
 --------------000306020501040407070609
 Content-Type: text/html; charset=ISO-8859-1
 Content-Transfer-Encoding: 7bit
 
 <html>
   <head>
     <meta content="text/html; charset=ISO-8859-1"
       http-equiv="Content-Type">
   </head>
   <body bgcolor="#FFFFFF" text="#000000">
     With some help from riastradh@, this actually seems to make it work:<br>
     <br>
     <meta charset="utf-8">
     <pre style="color: rgb(0, 0, 0); font-style: normal; font-variant: normal; 
font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 
auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; 
word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; 
white-space: pre-wrap;">Index: ufs/ffs/ffs_alloc.c
 ===================================================================
 RCS file: /cvsroot/src/sys/ufs/ffs/ffs_alloc.c,v
 retrieving revision 1.133
 diff -u -r1.133 ffs_alloc.c
 --- ufs/ffs/ffs_alloc.c        22 Jan 2013 09:39:15 -0000      1.133
 +++ ufs/ffs/ffs_alloc.c        16 Jun 2013 23:16:47 -0000
 @@ -1572,6 +1572,7 @@
        dev = devvp-&gt;v_rdev;
        ump = VFSTOUFS(devvp-&gt;v_specmountpoint);
        KASSERT(fs == ump-&gt;um_fs);
 +      UFS_WAPBL_JLOCK_ASSERT(ump-&gt;um_mountp);
        cgblkno = fsbtodb(fs, cgtod(fs, cg));
  
        error = bread(devvp, cgblkno, (int)fs-&gt;fs_cgsize,
 @@ -1613,11 +1614,18 @@
  ffs_blkfree_td(struct fs *fs, struct discardopdata *td)
  {
        long todo;
 +      int err;
 +      struct ufsmount *ump;
 +
 +      ump = VFSTOUFS(td-&gt;devvp-&gt;v_specmountpoint);
  
        while (td-&gt;size) {
                todo = min(td-&gt;size,
                  lfragtosize(fs, (fs-&gt;fs_frag - fragnum(fs, td-&gt;bno))));
 +              err = UFS_WAPBL_BEGIN(ump-&gt;um_mountp);
                ffs_blkfree_cg(fs, td-&gt;devvp, td-&gt;bno, todo);
 +              if ( err == 0 )
 +                  UFS_WAPBL_END(ump-&gt;um_mountp);
                td-&gt;bno += numfrags(fs, todo);
                td-&gt;size -= todo;
        }
 
 
 
 </pre>
     <br>
   </body>
 </html>
 
 --------------000306020501040407070609--
 


Home | Main Index | Thread Index | Old Index