Print this page
*** NO COMMENTS ***


 588                 if (is_var_sz && var_size > 1) {
 589                         if (P2ROUNDUP(hdrsize + sizeof (uint16_t), 8) +
 590                             *total < full_space) {
 591                                 hdrsize += sizeof (uint16_t);
 592                         } else {
 593                                 done = B_TRUE;
 594                                 *index = i;
 595                                 if (buftype == SA_BONUS)
 596                                         *will_spill = B_TRUE;
 597                                 continue;
 598                         }
 599                 }
 600 
 601                 /*
 602                  * find index of where spill *could* occur.
 603                  * Then continue to count of remainder attribute
 604                  * space.  The sum is used later for sizing bonus
 605                  * and spill buffer.
 606                  */
 607                 if (buftype == SA_BONUS && *index == -1 &&
 608                     P2ROUNDUP(*total + hdrsize, 8) >
 609                     (full_space - sizeof (blkptr_t))) {
 610                         *index = i;
 611                         done = B_TRUE;
 612                 }
 613 
 614 next:
 615                 if (P2ROUNDUP(*total + hdrsize, 8) > full_space &&
 616                     buftype == SA_BONUS)
 617                         *will_spill = B_TRUE;
 618         }
 619 
 620         hdrsize = P2ROUNDUP(hdrsize, 8);
 621         return (hdrsize);
 622 }
 623 
 624 #define BUF_SPACE_NEEDED(total, header) (total + header)
 625 
 626 /*
 627  * Find layout that corresponds to ordering of attributes
 628  * If not found a new layout number is created and added to
 629  * persistent layout tables.
 630  */
 631 static int
 632 sa_build_layouts(sa_handle_t *hdl, sa_bulk_attr_t *attr_desc, int attr_count,
 633     dmu_tx_t *tx)
 634 {
 635         sa_os_t *sa = hdl->sa_os->os_sa;




 588                 if (is_var_sz && var_size > 1) {
 589                         if (P2ROUNDUP(hdrsize + sizeof (uint16_t), 8) +
 590                             *total < full_space) {
 591                                 hdrsize += sizeof (uint16_t);
 592                         } else {
 593                                 done = B_TRUE;
 594                                 *index = i;
 595                                 if (buftype == SA_BONUS)
 596                                         *will_spill = B_TRUE;
 597                                 continue;
 598                         }
 599                 }
 600 
 601                 /*
 602                  * find index of where spill *could* occur.
 603                  * Then continue to count of remainder attribute
 604                  * space.  The sum is used later for sizing bonus
 605                  * and spill buffer.
 606                  */
 607                 if (buftype == SA_BONUS && *index == -1 &&
 608                     *total + P2ROUNDUP(hdrsize, 8) >
 609                     (full_space - sizeof (blkptr_t))) {
 610                         *index = i;
 611                         done = B_TRUE;
 612                 }
 613 
 614 next:
 615                 if (*total + P2ROUNDUP(hdrsize, 8) > full_space &&
 616                     buftype == SA_BONUS)
 617                         *will_spill = B_TRUE;
 618         }
 619 
 620         hdrsize = P2ROUNDUP(hdrsize, 8);
 621         return (hdrsize);
 622 }
 623 
 624 #define BUF_SPACE_NEEDED(total, header) (total + header)
 625 
 626 /*
 627  * Find layout that corresponds to ordering of attributes
 628  * If not found a new layout number is created and added to
 629  * persistent layout tables.
 630  */
 631 static int
 632 sa_build_layouts(sa_handle_t *hdl, sa_bulk_attr_t *attr_desc, int attr_count,
 633     dmu_tx_t *tx)
 634 {
 635         sa_os_t *sa = hdl->sa_os->os_sa;