Author: mckusick
Date: Wed Jun 15 18:05:08 2011
New Revision: 223114
URL: http://svn.freebsd.org/changeset/base/223114

Log:
  With the restructuring of the block reclaimation code, the notification
  messages for a filesystem being out of space need to be moved so that
  they do not print out until after a failed cleanup attempt.
  
  Suggested by: Jeff Roberson

Modified:
  head/sys/ufs/ffs/ffs_alloc.c
  head/sys/ufs/ffs/ffs_balloc.c
  head/sys/ufs/ffs/ffs_extern.h

Modified: head/sys/ufs/ffs/ffs_alloc.c
==============================================================================
--- head/sys/ufs/ffs/ffs_alloc.c        Wed Jun 15 15:24:21 2011        
(r223113)
+++ head/sys/ufs/ffs/ffs_alloc.c        Wed Jun 15 18:05:08 2011        
(r223114)
@@ -116,7 +116,6 @@ static ufs2_daddr_t ffs_clusteralloc(str
 static ino_t   ffs_dirpref(struct inode *);
 static ufs2_daddr_t ffs_fragextend(struct inode *, u_int, ufs2_daddr_t,
                    int, int);
-static void    ffs_fserr(struct fs *, ino_t, char *);
 static ufs2_daddr_t    ffs_hashalloc
                (struct inode *, u_int, ufs2_daddr_t, int, int, allocfcn_t *);
 static ufs2_daddr_t ffs_nodealloccg(struct inode *, u_int, ufs2_daddr_t, int,
@@ -223,7 +222,7 @@ nospace:
                goto retry;
        }
        UFS_UNLOCK(ump);
-       if (ppsratecheck(&lastfail, &curfail, 1)) {
+       if (reclaimed > 0 && ppsratecheck(&lastfail, &curfail, 1)) {
                ffs_fserr(fs, ip->i_number, "filesystem full");
                uprintf("\n%s: write failed, filesystem is full\n",
                    fs->fs_fsmnt);
@@ -432,7 +431,7 @@ nospace:
        UFS_UNLOCK(ump);
        if (bp)
                brelse(bp);
-       if (ppsratecheck(&lastfail, &curfail, 1)) {
+       if (reclaimed > 0 && ppsratecheck(&lastfail, &curfail, 1)) {
                ffs_fserr(fs, ip->i_number, "filesystem full");
                uprintf("\n%s: write failed, filesystem is full\n",
                    fs->fs_fsmnt);
@@ -2335,7 +2334,7 @@ ffs_mapsearch(fs, cgp, bpref, allocsiz)
  * The form of the error message is:
  *     fs: error message
  */
-static void
+void
 ffs_fserr(fs, inum, cp)
        struct fs *fs;
        ino_t inum;

Modified: head/sys/ufs/ffs/ffs_balloc.c
==============================================================================
--- head/sys/ufs/ffs/ffs_balloc.c       Wed Jun 15 15:24:21 2011        
(r223113)
+++ head/sys/ufs/ffs/ffs_balloc.c       Wed Jun 15 18:05:08 2011        
(r223114)
@@ -105,6 +105,8 @@ ffs_balloc_ufs1(struct vnode *vp, off_t 
        ufs2_daddr_t *lbns_remfree, lbns[NIADDR + 1];
        int unwindidx = -1;
        int saved_inbdflush;
+       static struct timeval lastfail;
+       static int curfail;
        int reclaimed;
 
        ip = VTOI(vp);
@@ -308,6 +310,11 @@ retry:
                                UFS_UNLOCK(ump);
                                goto retry;
                        }
+                       if (ppsratecheck(&lastfail, &curfail, 1)) {
+                               ffs_fserr(fs, ip->i_number, "filesystem full");
+                               uprintf("\n%s: write failed, filesystem "
+                                   "is full\n", fs->fs_fsmnt);
+                       }
                        goto fail;
                }
                nb = newb;
@@ -370,6 +377,11 @@ retry:
                                UFS_UNLOCK(ump);
                                goto retry;
                        }
+                       if (ppsratecheck(&lastfail, &curfail, 1)) {
+                               ffs_fserr(fs, ip->i_number, "filesystem full");
+                               uprintf("\n%s: write failed, filesystem "
+                                   "is full\n", fs->fs_fsmnt);
+                       }
                        goto fail;
                }
                nb = newb;
@@ -523,6 +535,8 @@ ffs_balloc_ufs2(struct vnode *vp, off_t 
        int deallocated, osize, nsize, num, i, error;
        int unwindidx = -1;
        int saved_inbdflush;
+       static struct timeval lastfail;
+       static int curfail;
        int reclaimed;
 
        ip = VTOI(vp);
@@ -836,6 +850,11 @@ retry:
                                UFS_UNLOCK(ump);
                                goto retry;
                        }
+                       if (ppsratecheck(&lastfail, &curfail, 1)) {
+                               ffs_fserr(fs, ip->i_number, "filesystem full");
+                               uprintf("\n%s: write failed, filesystem "
+                                   "is full\n", fs->fs_fsmnt);
+                       }
                        goto fail;
                }
                nb = newb;
@@ -898,6 +917,11 @@ retry:
                                UFS_UNLOCK(ump);
                                goto retry;
                        }
+                       if (ppsratecheck(&lastfail, &curfail, 1)) {
+                               ffs_fserr(fs, ip->i_number, "filesystem full");
+                               uprintf("\n%s: write failed, filesystem "
+                                   "is full\n", fs->fs_fsmnt);
+                       }
                        goto fail;
                }
                nb = newb;

Modified: head/sys/ufs/ffs/ffs_extern.h
==============================================================================
--- head/sys/ufs/ffs/ffs_extern.h       Wed Jun 15 15:24:21 2011        
(r223113)
+++ head/sys/ufs/ffs/ffs_extern.h       Wed Jun 15 18:05:08 2011        
(r223114)
@@ -69,6 +69,7 @@ int   ffs_flushfiles(struct mount *, int, 
 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_isblock(struct fs *, u_char *, ufs1_daddr_t);
 int    ffs_isfreeblock(struct fs *, u_char *, ufs1_daddr_t);
 void   ffs_load_inode(struct buf *, struct inode *, struct fs *, ino_t);
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to