[BACK]Return to ufs_dirhash.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / ufs / ufs

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/ufs/ufs/ufs_dirhash.c between version 1.18.2.1 and 1.19.6.1

version 1.18.2.1, 2007/08/15 13:51:17 version 1.19.6.1, 2007/11/06 23:35:23
Line 216  ufsdirhash_build(struct inode *ip)
Line 216  ufsdirhash_build(struct inode *ip)
                 /* If necessary, get the next directory block. */                  /* If necessary, get the next directory block. */
                 if ((pos & bmask) == 0) {                  if ((pos & bmask) == 0) {
                         if (bp != NULL)                          if (bp != NULL)
                                 brelse(bp);                                  brelse(bp, 0);
                         if (ufs_blkatoff(vp, (off_t)pos, NULL, &bp) != 0)                          if (ufs_blkatoff(vp, (off_t)pos, NULL, &bp) != 0)
                                 goto fail;                                  goto fail;
                 }                  }
Line 226  ufsdirhash_build(struct inode *ip)
Line 226  ufsdirhash_build(struct inode *ip)
                 if (ep->d_reclen == 0 || ep->d_reclen >                  if (ep->d_reclen == 0 || ep->d_reclen >
                     dirblksiz - (pos & (dirblksiz - 1))) {                      dirblksiz - (pos & (dirblksiz - 1))) {
                         /* Corrupted directory. */                          /* Corrupted directory. */
                         brelse(bp);                          brelse(bp, 0);
                         goto fail;                          goto fail;
                 }                  }
                 if (ep->d_ino != 0) {                  if (ep->d_ino != 0) {
Line 243  ufsdirhash_build(struct inode *ip)
Line 243  ufsdirhash_build(struct inode *ip)
         }          }
   
         if (bp != NULL)          if (bp != NULL)
                 brelse(bp);                  brelse(bp, 0);
         DIRHASHLIST_LOCK();          DIRHASHLIST_LOCK();
         TAILQ_INSERT_TAIL(&ufsdirhash_list, dh, dh_list);          TAILQ_INSERT_TAIL(&ufsdirhash_list, dh, dh_list);
         dh->dh_onlist = 1;          dh->dh_onlist = 1;
Line 412  restart:
Line 412  restart:
                         panic("ufsdirhash_lookup: bad offset in hash array");                          panic("ufsdirhash_lookup: bad offset in hash array");
                 if ((offset & ~bmask) != blkoff) {                  if ((offset & ~bmask) != blkoff) {
                         if (bp != NULL)                          if (bp != NULL)
                                 brelse(bp);                                  brelse(bp, 0);
                         blkoff = offset & ~bmask;                          blkoff = offset & ~bmask;
                         if (ufs_blkatoff(vp, (off_t)blkoff, NULL, &bp) != 0)                          if (ufs_blkatoff(vp, (off_t)blkoff, NULL, &bp) != 0)
                                 return (EJUSTRETURN);                                  return (EJUSTRETURN);
Line 421  restart:
Line 421  restart:
                 if (dp->d_reclen == 0 || dp->d_reclen >                  if (dp->d_reclen == 0 || dp->d_reclen >
                     dirblksiz - (offset & (dirblksiz - 1))) {                      dirblksiz - (offset & (dirblksiz - 1))) {
                         /* Corrupted directory. */                          /* Corrupted directory. */
                         brelse(bp);                          brelse(bp, 0);
                         return (EJUSTRETURN);                          return (EJUSTRETURN);
                 }                  }
                 if (dp->d_namlen == namelen &&                  if (dp->d_namlen == namelen &&
Line 432  restart:
Line 432  restart:
                                         prevoff = ufsdirhash_getprev(dp,                                          prevoff = ufsdirhash_getprev(dp,
                                             offset, dirblksiz);                                              offset, dirblksiz);
                                         if (prevoff == -1) {                                          if (prevoff == -1) {
                                                 brelse(bp);                                                  brelse(bp, 0);
                                                 return (EJUSTRETURN);                                                  return (EJUSTRETURN);
                                         }                                          }
                                 } else                                  } else
Line 454  restart:
Line 454  restart:
                 if (dh->dh_hash == NULL) {                  if (dh->dh_hash == NULL) {
                         DIRHASH_UNLOCK(dh);                          DIRHASH_UNLOCK(dh);
                         if (bp != NULL)                          if (bp != NULL)
                                 brelse(bp);                                  brelse(bp, 0);
                         ufsdirhash_free(ip);                          ufsdirhash_free(ip);
                         return (EJUSTRETURN);                          return (EJUSTRETURN);
                 }                  }
Line 469  restart:
Line 469  restart:
         }          }
         DIRHASH_UNLOCK(dh);          DIRHASH_UNLOCK(dh);
         if (bp != NULL)          if (bp != NULL)
                 brelse(bp);                  brelse(bp, 0);
         return (ENOENT);          return (ENOENT);
 }  }
   
Line 529  ufsdirhash_findfree(struct inode *ip, in
Line 529  ufsdirhash_findfree(struct inode *ip, in
         /* Find the first entry with free space. */          /* Find the first entry with free space. */
         for (i = 0; i < dirblksiz; ) {          for (i = 0; i < dirblksiz; ) {
                 if (dp->d_reclen == 0) {                  if (dp->d_reclen == 0) {
                         brelse(bp);                          brelse(bp, 0);
                         return (-1);                          return (-1);
                 }                  }
                 if (dp->d_ino == 0 || dp->d_reclen > DIRSIZ(0, dp, needswap))                  if (dp->d_ino == 0 || dp->d_reclen > DIRSIZ(0, dp, needswap))
Line 538  ufsdirhash_findfree(struct inode *ip, in
Line 538  ufsdirhash_findfree(struct inode *ip, in
                 dp = (struct direct *)((char *)dp + dp->d_reclen);                  dp = (struct direct *)((char *)dp + dp->d_reclen);
         }          }
         if (i > dirblksiz) {          if (i > dirblksiz) {
                 brelse(bp);                  brelse(bp, 0);
                 return (-1);                  return (-1);
         }          }
         slotstart = pos + i;          slotstart = pos + i;
Line 550  ufsdirhash_findfree(struct inode *ip, in
Line 550  ufsdirhash_findfree(struct inode *ip, in
                 if (dp->d_ino != 0)                  if (dp->d_ino != 0)
                         freebytes -= DIRSIZ(0, dp, needswap);                          freebytes -= DIRSIZ(0, dp, needswap);
                 if (dp->d_reclen == 0) {                  if (dp->d_reclen == 0) {
                         brelse(bp);                          brelse(bp, 0);
                         return (-1);                          return (-1);
                 }                  }
                 i += dp->d_reclen;                  i += dp->d_reclen;
                 dp = (struct direct *)((char *)dp + dp->d_reclen);                  dp = (struct direct *)((char *)dp + dp->d_reclen);
         }          }
         if (i > dirblksiz) {          if (i > dirblksiz) {
                 brelse(bp);                  brelse(bp, 0);
                 return (-1);                  return (-1);
         }          }
         if (freebytes < slotneeded)          if (freebytes < slotneeded)
                 panic("ufsdirhash_findfree: free mismatch");                  panic("ufsdirhash_findfree: free mismatch");
         brelse(bp);          brelse(bp, 0);
         *slotsize = pos + i - slotstart;          *slotsize = pos + i - slotstart;
         return (slotstart);          return (slotstart);
 }  }

Legend:
Removed from v.1.18.2.1  
changed lines
  Added in v.1.19.6.1

CVSweb <webmaster@jp.NetBSD.org>