~ubuntu-branches/ubuntu/intrepid/xfsdump/intrepid

« back to all changes in this revision

Viewing changes to dump/content.c

  • Committer: Bazaar Package Importer
  • Author(s): Anibal Monsalve Salazar
  • Date: 2008-04-23 22:06:34 UTC
  • mfrom: (0.1.1 upstream) (3.1.1 gutsy)
  • Revision ID: james.westby@ubuntu.com-20080423220634-7m8953nknbpz1nsv
Tags: 2.2.48-1
* New upstream release
* xfsdump depends on ${misc:Depends}
* Add debian/watch
* Add homepage control header
* Fix the following lintian issues:
  W: xfsdump source: package-uses-deprecated-debhelper-compat-version 1
  W: xfsdump source: ancient-standards-version 3.5.9 (current is 3.7.3)

Show diffs side-by-side

added added

removed removed

Lines of Context:
260
260
 */
261
261
static rv_t dump_dirs( ix_t strmix,
262
262
                       xfs_bstat_t *bstatbufp,
263
 
                       size_t bstatbuflen );
 
263
                       size_t bstatbuflen,
 
264
                       void *inomap_contextp );
264
265
#ifdef SYNCDIR
265
266
static rv_t dump_dirs_rendezvous( void );
266
267
#endif /* SYNCDIR */
598
599
                        if ( ! optarg || optarg[ 0 ] == '-' ) {
599
600
                                mlog( MLOG_NORMAL | MLOG_ERROR, _(
600
601
                                      "-%c argument missing\n"),
601
 
                                      optopt );
 
602
                                      c );
602
603
                                usage( );
603
604
                                return BOOL_FALSE;
604
605
                        }
607
608
                                mlog( MLOG_NORMAL | MLOG_ERROR, _(
608
609
                                      "-%c argument must be "
609
610
                                      "between 0 and %d\n"),
610
 
                                      optopt,
 
611
                                      c,
611
612
                                      LEVEL_MAX );
612
613
                                usage( );
613
614
                                return BOOL_FALSE;
617
618
                        if ( ! optarg || optarg[ 0 ] == '-' ) {
618
619
                                mlog( MLOG_NORMAL | MLOG_ERROR, _(
619
620
                                      "-%c argument missing\n"),
620
 
                                      optopt );
 
621
                                      c );
621
622
                                usage( );
622
623
                                return BOOL_FALSE;
623
624
                        }
625
626
                                mlog( MLOG_NORMAL | MLOG_ERROR, _(
626
627
                                      "-%c argument (subtree) "
627
628
                                      "must be a relative pathname\n"),
628
 
                                      optopt );
 
629
                                      c );
629
630
                                usage( );
630
631
                                return BOOL_FALSE;
631
632
                        }
635
636
                        if ( ! optarg || optarg [ 0 ] == '-' ) {
636
637
                                mlog( MLOG_NORMAL | MLOG_ERROR, _(
637
638
                                      "-%c argument missing\n"),
638
 
                                      optopt );
 
639
                                      c );
639
640
                                usage( );
640
641
                                return BOOL_FALSE;
641
642
                        }
645
646
                             ( maxdumpfilesize == ULONGLONG_MAX && errno == ERANGE ) ) {
646
647
                                mlog( MLOG_NORMAL | MLOG_ERROR, _(
647
648
                                      "-%c argument is not a valid file size\n"),
648
 
                                      optopt );
 
649
                                      c );
649
650
                                usage( );
650
651
                                return BOOL_FALSE;
651
652
                        }
667
668
                        if ( ! optarg || optarg[ 0 ] == '-' ) {
668
669
                                mlog( MLOG_NORMAL | MLOG_ERROR, _(
669
670
                                        "-%c argument missing\n"),
670
 
                                    optopt );
 
671
                                    c );
671
672
                                usage( );
672
673
                                return BOOL_FALSE;
673
674
                        }
684
685
                        if ( ! optarg || optarg[ 0 ] == '-' ) {
685
686
                                mlog( MLOG_NORMAL | MLOG_ERROR, _(
686
687
                                      "-%c argument missing\n"),
687
 
                                      optopt );
 
688
                                      c );
688
689
                                usage( );
689
690
                                return BOOL_FALSE;
690
691
                        }
694
695
                                mlog( MLOG_NORMAL | MLOG_ERROR, _(
695
696
                                      "-%c argument not a valid "
696
697
                                      "dump session id\n"),
697
 
                                      optopt );
 
698
                                      c );
698
699
                                usage( );
699
700
                                return BOOL_FALSE;
700
701
                        }
1662
1663
                                        mlog( MLOG_NORMAL, _(
1663
1664
                                              "more -%c arguments "
1664
1665
                                              "than number of drives\n"),
1665
 
                                              optopt );
 
1666
                                              c );
1666
1667
                                        usage( );
1667
1668
                                        return BOOL_FALSE;
1668
1669
                                }
1669
1670
                                if ( ! optarg || optarg[ 0 ] == '-' ) {
1670
1671
                                        mlog( MLOG_NORMAL, _(
1671
1672
                                              "-%c argument missing\n"),
1672
 
                                              optopt );
 
1673
                                              c );
1673
1674
                                        usage( );
1674
1675
                                        return BOOL_FALSE;
1675
1676
                                }
2137
2138
        content_hdr_t *cwhdrp = ( content_hdr_t * )mwhdrp->mh_upper;
2138
2139
        content_inode_hdr_t *scwhdrp = ( content_inode_hdr_t * )
2139
2140
                                       cwhdrp->ch_specific;
 
2141
        void *inomap_contextp;
2140
2142
        bool_t all_nondirs_committed;
2141
2143
        bool_t empty_mediafile;
2142
2144
        time_t elapsed;
2156
2158
                                             sizeof( xfs_bstat_t ));
2157
2159
        ASSERT( bstatbufp );
2158
2160
 
 
2161
        /* allocate an inomap context */
 
2162
        inomap_contextp = inomap_alloc_context();
 
2163
        ASSERT( inomap_contextp );
 
2164
 
2159
2165
        /* determine if stream terminators will be used and are expected.
2160
2166
         * this will be revised each time a new media file is begun.
2161
2167
         */
2346
2352
                 * for each directory in the bitmap.
2347
2353
                 */
2348
2354
                sc_stat_pds[ strmix ].pds_dirdone = 0;
2349
 
                rv = dump_dirs( strmix, bstatbufp, bstatbuflen );
 
2355
                rv = dump_dirs( strmix,
 
2356
                                bstatbufp,
 
2357
                                bstatbuflen,
 
2358
                                inomap_contextp );
2350
2359
                if ( rv == RV_INTR ) {
2351
2360
                        stop_requested = BOOL_TRUE;
2352
2361
                        goto decision_more;
2385
2394
                              "dumping non-directory files\n") );
2386
2395
                        sc_stat_pds[ strmix ].pds_phase = PDS_NONDIR;
2387
2396
                        rv = RV_OK;
 
2397
                        inomap_reset_context(inomap_contextp);
2388
2398
                        rval = bigstat_iter( sc_fshandlep,
2389
2399
                                             sc_fsfd,
2390
2400
                                             BIGSTAT_ITER_NONDIR,
2391
2401
                                             scwhdrp->cih_startpt.sp_ino,
2392
 
        ( intgen_t ( * )( void *, jdm_fshandle_t *, intgen_t, xfs_bstat_t * ))
2393
 
                                             dump_file,
 
2402
                                             ( bstat_cbfp_t )dump_file,
2394
2403
                                             ( void * )strmix,
 
2404
                                             inomap_next_nondir,
 
2405
                                             inomap_contextp,
2395
2406
                                             ( intgen_t * )&rv,
2396
2407
                                             ( miniroot || pipeline ) ?
2397
2408
                                               (bool_t (*)(int))preemptchk : 0,
2827
2838
}
2828
2839
 
2829
2840
static rv_t
2830
 
dump_dirs( ix_t strmix, xfs_bstat_t *bstatbufp, size_t bstatbuflen )
 
2841
dump_dirs( ix_t strmix,
 
2842
           xfs_bstat_t *bstatbufp,
 
2843
           size_t bstatbuflen,
 
2844
           void *inomap_contextp )
2831
2845
{
2832
2846
        xfs_ino_t lastino;
2833
2847
        size_t bulkstatcallcnt;
2834
2848
        xfs_fsop_bulkreq_t bulkreq;
2835
2849
 
 
2850
        inomap_reset_context(inomap_contextp);
 
2851
 
2836
2852
        /* begin iteration at ino zero
2837
2853
         */
2838
2854
        lastino = 0;
2943
2959
                                return rv;
2944
2960
                        }
2945
2961
                }
 
2962
 
 
2963
                lastino = inomap_next_dir(inomap_contextp, lastino);
 
2964
                if (lastino == INO64MAX) {
 
2965
                        mlog( MLOG_DEBUG, "bulkstat seeked to EOS\n" );
 
2966
                        return 0;
 
2967
                }
 
2968
 
 
2969
                mlog( MLOG_DEBUG, "bulkstat seeked to %llu\n", lastino );
 
2970
 
 
2971
                lastino = (lastino > 0) ? lastino - 1 : 0;
2946
2972
        }
2947
2973
        /* NOTREACHED */
2948
2974
}
3933
3959
        case S_IFREG:
3934
3960
                /* ordinary file
3935
3961
                 */
 
3962
 
 
3963
                /* filter out any files that have grown beyond the
 
3964
                 * max file size since the initial scan.
 
3965
                 */
 
3966
                if (maxdumpfilesize) {
 
3967
                        off64_t estimated_size = statp->bs_blocks *
 
3968
                                                 ( off64_t )statp->bs_blksize;
 
3969
 
 
3970
                        if (hsm_fs_ctxtp) {
 
3971
                                HsmEstimateFileSpace(hsm_fs_ctxtp,
 
3972
                                                     contextp->cc_hsm_f_ctxtp,
 
3973
                                                     statp,
 
3974
                                                     &estimated_size,
 
3975
                                                     1);
 
3976
                        }
 
3977
 
 
3978
                        if (estimated_size > maxdumpfilesize) {
 
3979
                                mlog( MLOG_DEBUG | MLOG_NOTE,
 
3980
                                      "ino %llu increased beyond maximum size: "
 
3981
                                      "NOT dumping\n",
 
3982
                                      statp->bs_ino);
 
3983
                                return RV_OK;
 
3984
                        }
 
3985
                }
3936
3986
                rv = dump_file_reg( drivep,
3937
3987
                                    contextp,
3938
3988
                                    scwhdrp,