Diff for /xfs-linux/xfs_bmap.c between versions 1.370 and 1.371

version 1.370, 2007/06/28 06:08:33 version 1.371, 2007/07/09 06:12:03
Line 52 Line 52
 #include "xfs_quota.h"  #include "xfs_quota.h"
 #include "xfs_trans_space.h"  #include "xfs_trans_space.h"
 #include "xfs_buf_item.h"  #include "xfs_buf_item.h"
   #include "xfs_filestream.h"
   
   
 #ifdef DEBUG  #ifdef DEBUG
Line 2725  xfs_bmap_btalloc( Line 2726  xfs_bmap_btalloc(
         }          }
         nullfb = ap->firstblock == NULLFSBLOCK;          nullfb = ap->firstblock == NULLFSBLOCK;
         fb_agno = nullfb ? NULLAGNUMBER : XFS_FSB_TO_AGNO(mp, ap->firstblock);          fb_agno = nullfb ? NULLAGNUMBER : XFS_FSB_TO_AGNO(mp, ap->firstblock);
         if (nullfb)          if (nullfb) {
                 ap->rval = XFS_INO_TO_FSB(mp, ap->ip->i_ino);                  if (ap->userdata && xfs_inode_is_filestream(ap->ip)) {
         else                          ag = xfs_filestream_lookup_ag(ap->ip);
                           ag = (ag != NULLAGNUMBER) ? ag : 0;
                           ap->rval = XFS_AGB_TO_FSB(mp, ag, 0);
                   } else {
                           ap->rval = XFS_INO_TO_FSB(mp, ap->ip->i_ino);
                   }
           } else
                 ap->rval = ap->firstblock;                  ap->rval = ap->firstblock;
   
         xfs_bmap_adjacent(ap);          xfs_bmap_adjacent(ap);
Line 2751  xfs_bmap_btalloc( Line 2758  xfs_bmap_btalloc(
         args.firstblock = ap->firstblock;          args.firstblock = ap->firstblock;
         blen = 0;          blen = 0;
         if (nullfb) {          if (nullfb) {
                 args.type = XFS_ALLOCTYPE_START_BNO;                  if (ap->userdata && xfs_inode_is_filestream(ap->ip))
                           args.type = XFS_ALLOCTYPE_NEAR_BNO;
                   else
                           args.type = XFS_ALLOCTYPE_START_BNO;
                 args.total = ap->total;                  args.total = ap->total;
   
                 /*                  /*
                  * Find the longest available space.                   * Search for an allocation group with a single extent
                  * We're going to try for the whole allocation at once.                   * large enough for the request.
                    *
                    * If one isn't found, then adjust the minimum allocation
                    * size to the largest space found.
                  */                   */
                 startag = ag = XFS_FSB_TO_AGNO(mp, args.fsbno);                  startag = ag = XFS_FSB_TO_AGNO(mp, args.fsbno);
                   if (startag == NULLAGNUMBER)
                           startag = ag = 0;
                 notinit = 0;                  notinit = 0;
                 down_read(&mp->m_peraglock);                  down_read(&mp->m_peraglock);
                 while (blen < ap->alen) {                  while (blen < ap->alen) {
Line 2783  xfs_bmap_btalloc( Line 2799  xfs_bmap_btalloc(
                                         blen = longest;                                          blen = longest;
                         } else                          } else
                                 notinit = 1;                                  notinit = 1;
   
                           if (xfs_inode_is_filestream(ap->ip)) {
                                   if (blen >= ap->alen)
                                           break;
   
                                   if (ap->userdata) {
                                           /*
                                            * If startag is an invalid AG, we've
                                            * come here once before and
                                            * xfs_filestream_new_ag picked the
                                            * best currently available.
                                            *
                                            * Don't continue looping, since we
                                            * could loop forever.
                                            */
                                           if (startag == NULLAGNUMBER)
                                                   break;
   
                                           error = xfs_filestream_new_ag(ap, &ag);
                                           if (error) {
                                                   up_read(&mp->m_peraglock);
                                                   return error;
                                           }
   
                                           /* loop again to set 'blen'*/
                                           startag = NULLAGNUMBER;
                                           continue;
                                   }
                           }
                         if (++ag == mp->m_sb.sb_agcount)                          if (++ag == mp->m_sb.sb_agcount)
                                 ag = 0;                                  ag = 0;
                         if (ag == startag)                          if (ag == startag)
Line 2807  xfs_bmap_btalloc( Line 2852  xfs_bmap_btalloc(
                  */                   */
                 else                  else
                         args.minlen = ap->alen;                          args.minlen = ap->alen;
   
                   /*
                    * set the failure fallback case to look in the selected
                    * AG as the stream may have moved.
                    */
                   if (xfs_inode_is_filestream(ap->ip))
                           ap->rval = args.fsbno = XFS_AGB_TO_FSB(mp, ag, 0);
         } else if (ap->low) {          } else if (ap->low) {
                 args.type = XFS_ALLOCTYPE_START_BNO;                  if (xfs_inode_is_filestream(ap->ip))
                           args.type = XFS_ALLOCTYPE_FIRST_AG;
                   else
                           args.type = XFS_ALLOCTYPE_START_BNO;
                 args.total = args.minlen = ap->minlen;                  args.total = args.minlen = ap->minlen;
         } else {          } else {
                 args.type = XFS_ALLOCTYPE_NEAR_BNO;                  args.type = XFS_ALLOCTYPE_NEAR_BNO;

Removed from v.1.370  
changed lines
  Added in v.1.371


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>