Whamcloud - gitweb
libext2fs: don't hang in ext2fs_new_block2() on a full bigalloc file system
[tools/e2fsprogs.git] / lib / ext2fs / block.c
1 /*
2  * block.c --- iterate over all blocks in an inode
3  *
4  * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
5  *
6  * %Begin-Header%
7  * This file may be redistributed under the terms of the GNU Library
8  * General Public License, version 2.
9  * %End-Header%
10  */
11
12 #include <stdio.h>
13 #include <string.h>
14 #if HAVE_UNISTD_H
15 #include <unistd.h>
16 #endif
17
18 #include "ext2_fs.h"
19 #include "ext2fs.h"
20
21 struct block_context {
22         ext2_filsys     fs;
23         int (*func)(ext2_filsys fs,
24                     blk64_t     *blocknr,
25                     e2_blkcnt_t bcount,
26                     blk64_t     ref_blk,
27                     int         ref_offset,
28                     void        *priv_data);
29         e2_blkcnt_t     bcount;
30         int             bsize;
31         int             flags;
32         errcode_t       errcode;
33         char    *ind_buf;
34         char    *dind_buf;
35         char    *tind_buf;
36         void    *priv_data;
37 };
38
39 #define check_for_ro_violation_return(ctx, ret)                         \
40         do {                                                            \
41                 if (((ctx)->flags & BLOCK_FLAG_READ_ONLY) &&            \
42                     ((ret) & BLOCK_CHANGED)) {                          \
43                         (ctx)->errcode = EXT2_ET_RO_BLOCK_ITERATE;      \
44                         ret |= BLOCK_ABORT | BLOCK_ERROR;               \
45                         return ret;                                     \
46                 }                                                       \
47         } while (0)
48
49 #define check_for_ro_violation_goto(ctx, ret, label)                    \
50         do {                                                            \
51                 if (((ctx)->flags & BLOCK_FLAG_READ_ONLY) &&            \
52                     ((ret) & BLOCK_CHANGED)) {                          \
53                         (ctx)->errcode = EXT2_ET_RO_BLOCK_ITERATE;      \
54                         ret |= BLOCK_ABORT | BLOCK_ERROR;               \
55                         goto label;                                     \
56                 }                                                       \
57         } while (0)
58
59 static int block_iterate_ind(blk_t *ind_block, blk_t ref_block,
60                              int ref_offset, struct block_context *ctx)
61 {
62         int     ret = 0, changed = 0;
63         int     i, flags, limit, offset;
64         blk_t   *block_nr;
65         blk64_t blk64;
66
67         limit = ctx->fs->blocksize >> 2;
68         if (!(ctx->flags & BLOCK_FLAG_DEPTH_TRAVERSE) &&
69             !(ctx->flags & BLOCK_FLAG_DATA_ONLY)) {
70                 blk64 = *ind_block;
71                 ret = (*ctx->func)(ctx->fs, &blk64,
72                                    BLOCK_COUNT_IND, ref_block,
73                                    ref_offset, ctx->priv_data);
74                 *ind_block = blk64;
75         }
76         check_for_ro_violation_return(ctx, ret);
77         if (!*ind_block || (ret & BLOCK_ABORT)) {
78                 ctx->bcount += limit;
79                 return ret;
80         }
81         if (*ind_block >= ext2fs_blocks_count(ctx->fs->super) ||
82             *ind_block < ctx->fs->super->s_first_data_block) {
83                 ctx->errcode = EXT2_ET_BAD_IND_BLOCK;
84                 ret |= BLOCK_ERROR;
85                 return ret;
86         }
87         ctx->errcode = ext2fs_read_ind_block(ctx->fs, *ind_block,
88                                              ctx->ind_buf);
89         if (ctx->errcode) {
90                 ret |= BLOCK_ERROR;
91                 return ret;
92         }
93
94         block_nr = (blk_t *) ctx->ind_buf;
95         offset = 0;
96         if (ctx->flags & BLOCK_FLAG_APPEND) {
97                 for (i = 0; i < limit; i++, ctx->bcount++, block_nr++) {
98                         blk64 = *block_nr;
99                         flags = (*ctx->func)(ctx->fs, &blk64, ctx->bcount,
100                                              *ind_block, offset,
101                                              ctx->priv_data);
102                         *block_nr = blk64;
103                         changed |= flags;
104                         if (flags & BLOCK_ABORT) {
105                                 ret |= BLOCK_ABORT;
106                                 break;
107                         }
108                         offset += sizeof(blk_t);
109                 }
110         } else {
111                 for (i = 0; i < limit; i++, ctx->bcount++, block_nr++) {
112                         if (*block_nr == 0)
113                                 goto skip_sparse;
114                         blk64 = *block_nr;
115                         flags = (*ctx->func)(ctx->fs, &blk64, ctx->bcount,
116                                              *ind_block, offset,
117                                              ctx->priv_data);
118                         *block_nr = blk64;
119                         changed |= flags;
120                         if (flags & BLOCK_ABORT) {
121                                 ret |= BLOCK_ABORT;
122                                 break;
123                         }
124                 skip_sparse:
125                         offset += sizeof(blk_t);
126                 }
127         }
128         check_for_ro_violation_return(ctx, changed);
129         if (changed & BLOCK_CHANGED) {
130                 ctx->errcode = ext2fs_write_ind_block(ctx->fs, *ind_block,
131                                                       ctx->ind_buf);
132                 if (ctx->errcode)
133                         ret |= BLOCK_ERROR | BLOCK_ABORT;
134         }
135         if ((ctx->flags & BLOCK_FLAG_DEPTH_TRAVERSE) &&
136             !(ctx->flags & BLOCK_FLAG_DATA_ONLY) &&
137             !(ret & BLOCK_ABORT)) {
138                 blk64 = *ind_block;
139                 ret |= (*ctx->func)(ctx->fs, &blk64,
140                                     BLOCK_COUNT_IND, ref_block,
141                                     ref_offset, ctx->priv_data);
142                 *ind_block = blk64;
143         }
144         check_for_ro_violation_return(ctx, ret);
145         return ret;
146 }
147
148 static int block_iterate_dind(blk_t *dind_block, blk_t ref_block,
149                               int ref_offset, struct block_context *ctx)
150 {
151         int     ret = 0, changed = 0;
152         int     i, flags, limit, offset;
153         blk_t   *block_nr;
154         blk64_t blk64;
155
156         limit = ctx->fs->blocksize >> 2;
157         if (!(ctx->flags & (BLOCK_FLAG_DEPTH_TRAVERSE |
158                             BLOCK_FLAG_DATA_ONLY))) {
159                 blk64 = *dind_block;
160                 ret = (*ctx->func)(ctx->fs, &blk64,
161                                    BLOCK_COUNT_DIND, ref_block,
162                                    ref_offset, ctx->priv_data);
163                 *dind_block = blk64;
164         }
165         check_for_ro_violation_return(ctx, ret);
166         if (!*dind_block || (ret & BLOCK_ABORT)) {
167                 ctx->bcount += limit*limit;
168                 return ret;
169         }
170         if (*dind_block >= ext2fs_blocks_count(ctx->fs->super) ||
171             *dind_block < ctx->fs->super->s_first_data_block) {
172                 ctx->errcode = EXT2_ET_BAD_DIND_BLOCK;
173                 ret |= BLOCK_ERROR;
174                 return ret;
175         }
176         ctx->errcode = ext2fs_read_ind_block(ctx->fs, *dind_block,
177                                              ctx->dind_buf);
178         if (ctx->errcode) {
179                 ret |= BLOCK_ERROR;
180                 return ret;
181         }
182
183         block_nr = (blk_t *) ctx->dind_buf;
184         offset = 0;
185         if (ctx->flags & BLOCK_FLAG_APPEND) {
186                 for (i = 0; i < limit; i++, block_nr++) {
187                         flags = block_iterate_ind(block_nr,
188                                                   *dind_block, offset,
189                                                   ctx);
190                         changed |= flags;
191                         if (flags & (BLOCK_ABORT | BLOCK_ERROR)) {
192                                 ret |= flags & (BLOCK_ABORT | BLOCK_ERROR);
193                                 break;
194                         }
195                         offset += sizeof(blk_t);
196                 }
197         } else {
198                 for (i = 0; i < limit; i++, block_nr++) {
199                         if (*block_nr == 0) {
200                                 ctx->bcount += limit;
201                                 continue;
202                         }
203                         flags = block_iterate_ind(block_nr,
204                                                   *dind_block, offset,
205                                                   ctx);
206                         changed |= flags;
207                         if (flags & (BLOCK_ABORT | BLOCK_ERROR)) {
208                                 ret |= flags & (BLOCK_ABORT | BLOCK_ERROR);
209                                 break;
210                         }
211                         offset += sizeof(blk_t);
212                 }
213         }
214         check_for_ro_violation_return(ctx, changed);
215         if (changed & BLOCK_CHANGED) {
216                 ctx->errcode = ext2fs_write_ind_block(ctx->fs, *dind_block,
217                                                       ctx->dind_buf);
218                 if (ctx->errcode)
219                         ret |= BLOCK_ERROR | BLOCK_ABORT;
220         }
221         if ((ctx->flags & BLOCK_FLAG_DEPTH_TRAVERSE) &&
222             !(ctx->flags & BLOCK_FLAG_DATA_ONLY) &&
223             !(ret & BLOCK_ABORT)) {
224                 blk64 = *dind_block;
225                 ret |= (*ctx->func)(ctx->fs, &blk64,
226                                     BLOCK_COUNT_DIND, ref_block,
227                                     ref_offset, ctx->priv_data);
228                 *dind_block = blk64;
229         }
230         check_for_ro_violation_return(ctx, ret);
231         return ret;
232 }
233
234 static int block_iterate_tind(blk_t *tind_block, blk_t ref_block,
235                               int ref_offset, struct block_context *ctx)
236 {
237         int     ret = 0, changed = 0;
238         int     i, flags, limit, offset;
239         blk_t   *block_nr;
240         blk64_t blk64;
241
242         limit = ctx->fs->blocksize >> 2;
243         if (!(ctx->flags & (BLOCK_FLAG_DEPTH_TRAVERSE |
244                             BLOCK_FLAG_DATA_ONLY))) {
245                 blk64 = *tind_block;
246                 ret = (*ctx->func)(ctx->fs, &blk64,
247                                    BLOCK_COUNT_TIND, ref_block,
248                                    ref_offset, ctx->priv_data);
249                 *tind_block = blk64;
250         }
251         check_for_ro_violation_return(ctx, ret);
252         if (!*tind_block || (ret & BLOCK_ABORT)) {
253                 ctx->bcount += limit*limit*limit;
254                 return ret;
255         }
256         if (*tind_block >= ext2fs_blocks_count(ctx->fs->super) ||
257             *tind_block < ctx->fs->super->s_first_data_block) {
258                 ctx->errcode = EXT2_ET_BAD_TIND_BLOCK;
259                 ret |= BLOCK_ERROR;
260                 return ret;
261         }
262         ctx->errcode = ext2fs_read_ind_block(ctx->fs, *tind_block,
263                                              ctx->tind_buf);
264         if (ctx->errcode) {
265                 ret |= BLOCK_ERROR;
266                 return ret;
267         }
268
269         block_nr = (blk_t *) ctx->tind_buf;
270         offset = 0;
271         if (ctx->flags & BLOCK_FLAG_APPEND) {
272                 for (i = 0; i < limit; i++, block_nr++) {
273                         flags = block_iterate_dind(block_nr,
274                                                    *tind_block,
275                                                    offset, ctx);
276                         changed |= flags;
277                         if (flags & (BLOCK_ABORT | BLOCK_ERROR)) {
278                                 ret |= flags & (BLOCK_ABORT | BLOCK_ERROR);
279                                 break;
280                         }
281                         offset += sizeof(blk_t);
282                 }
283         } else {
284                 for (i = 0; i < limit; i++, block_nr++) {
285                         if (*block_nr == 0) {
286                                 ctx->bcount += limit*limit;
287                                 continue;
288                         }
289                         flags = block_iterate_dind(block_nr,
290                                                    *tind_block,
291                                                    offset, ctx);
292                         changed |= flags;
293                         if (flags & (BLOCK_ABORT | BLOCK_ERROR)) {
294                                 ret |= flags & (BLOCK_ABORT | BLOCK_ERROR);
295                                 break;
296                         }
297                         offset += sizeof(blk_t);
298                 }
299         }
300         check_for_ro_violation_return(ctx, changed);
301         if (changed & BLOCK_CHANGED) {
302                 ctx->errcode = ext2fs_write_ind_block(ctx->fs, *tind_block,
303                                                       ctx->tind_buf);
304                 if (ctx->errcode)
305                         ret |= BLOCK_ERROR | BLOCK_ABORT;
306         }
307         if ((ctx->flags & BLOCK_FLAG_DEPTH_TRAVERSE) &&
308             !(ctx->flags & BLOCK_FLAG_DATA_ONLY) &&
309             !(ret & BLOCK_ABORT)) {
310                 blk64 = *tind_block;
311                 ret |= (*ctx->func)(ctx->fs, &blk64,
312                                     BLOCK_COUNT_TIND, ref_block,
313                                     ref_offset, ctx->priv_data);
314                 *tind_block = blk64;
315         }
316         check_for_ro_violation_return(ctx, ret);
317         return ret;
318 }
319
320 errcode_t ext2fs_block_iterate3(ext2_filsys fs,
321                                 ext2_ino_t ino,
322                                 int     flags,
323                                 char *block_buf,
324                                 int (*func)(ext2_filsys fs,
325                                             blk64_t     *blocknr,
326                                             e2_blkcnt_t blockcnt,
327                                             blk64_t     ref_blk,
328                                             int         ref_offset,
329                                             void        *priv_data),
330                                 void *priv_data)
331 {
332         int     i;
333         int     r, ret = 0;
334         struct ext2_inode inode;
335         errcode_t       retval;
336         struct block_context ctx;
337         int     limit;
338         blk64_t blk64;
339
340         EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
341
342         ctx.errcode = ext2fs_read_inode(fs, ino, &inode);
343         if (ctx.errcode)
344                 return ctx.errcode;
345
346         /*
347          * Check to see if we need to limit large files
348          */
349         if (flags & BLOCK_FLAG_NO_LARGE) {
350                 if (!LINUX_S_ISDIR(inode.i_mode) &&
351                     (inode.i_size_high != 0))
352                         return EXT2_ET_FILE_TOO_BIG;
353         }
354
355         limit = fs->blocksize >> 2;
356
357         ctx.fs = fs;
358         ctx.func = func;
359         ctx.priv_data = priv_data;
360         ctx.flags = flags;
361         ctx.bcount = 0;
362         if (block_buf) {
363                 ctx.ind_buf = block_buf;
364         } else {
365                 retval = ext2fs_get_array(3, fs->blocksize, &ctx.ind_buf);
366                 if (retval)
367                         return retval;
368         }
369         ctx.dind_buf = ctx.ind_buf + fs->blocksize;
370         ctx.tind_buf = ctx.dind_buf + fs->blocksize;
371
372         /*
373          * Iterate over the HURD translator block (if present)
374          */
375         if ((fs->super->s_creator_os == EXT2_OS_HURD) &&
376             !(flags & BLOCK_FLAG_DATA_ONLY)) {
377                 if (inode.osd1.hurd1.h_i_translator) {
378                         blk64 = inode.osd1.hurd1.h_i_translator;
379                         ret |= (*ctx.func)(fs, &blk64,
380                                            BLOCK_COUNT_TRANSLATOR,
381                                            0, 0, priv_data);
382                         inode.osd1.hurd1.h_i_translator = (blk_t) blk64;
383                         if (ret & BLOCK_ABORT)
384                                 goto abort_exit;
385                         check_for_ro_violation_goto(&ctx, ret, abort_exit);
386                 }
387         }
388
389         if (inode.i_flags & EXT4_EXTENTS_FL) {
390                 ext2_extent_handle_t    handle;
391                 struct ext2fs_extent    extent;
392                 e2_blkcnt_t             blockcnt = 0;
393                 blk64_t                 blk, new_blk;
394                 int                     op = EXT2_EXTENT_ROOT;
395                 int                     uninit;
396                 unsigned int            j;
397
398                 ctx.errcode = ext2fs_extent_open2(fs, ino, &inode, &handle);
399                 if (ctx.errcode)
400                         goto abort_exit;
401
402                 while (1) {
403                         ctx.errcode = ext2fs_extent_get(handle, op, &extent);
404                         if (ctx.errcode) {
405                                 if (ctx.errcode != EXT2_ET_EXTENT_NO_NEXT)
406                                         break;
407                                 ctx.errcode = 0;
408                                 if (!(flags & BLOCK_FLAG_APPEND))
409                                         break;
410                         next_block_set:
411                                 blk = 0;
412                                 r = (*ctx.func)(fs, &blk, blockcnt,
413                                                 0, 0, priv_data);
414                                 ret |= r;
415                                 check_for_ro_violation_goto(&ctx, ret,
416                                                             extent_errout);
417                                 if (r & BLOCK_CHANGED) {
418                                         ctx.errcode =
419                                                 ext2fs_extent_set_bmap(handle,
420                                                        (blk64_t) blockcnt++,
421                                                        (blk64_t) blk, 0);
422                                         if (ctx.errcode || (ret & BLOCK_ABORT))
423                                                 break;
424                                         if (blk)
425                                                 goto next_block_set;
426                                 }
427                                 break;
428                         }
429
430                         op = EXT2_EXTENT_NEXT;
431                         blk = extent.e_pblk;
432                         if (!(extent.e_flags & EXT2_EXTENT_FLAGS_LEAF)) {
433                                 if (ctx.flags & BLOCK_FLAG_DATA_ONLY)
434                                         continue;
435                                 if ((!(extent.e_flags &
436                                        EXT2_EXTENT_FLAGS_SECOND_VISIT) &&
437                                      !(ctx.flags & BLOCK_FLAG_DEPTH_TRAVERSE)) ||
438                                     ((extent.e_flags &
439                                       EXT2_EXTENT_FLAGS_SECOND_VISIT) &&
440                                      (ctx.flags & BLOCK_FLAG_DEPTH_TRAVERSE))) {
441                                         ret |= (*ctx.func)(fs, &blk,
442                                                            -1, 0, 0, priv_data);
443                                         if (ret & BLOCK_CHANGED) {
444                                                 extent.e_pblk = blk;
445                                                 ctx.errcode =
446                                 ext2fs_extent_replace(handle, 0, &extent);
447                                                 if (ctx.errcode)
448                                                         break;
449                                         }
450                                 }
451                                 continue;
452                         }
453                         uninit = 0;
454                         if (extent.e_flags & EXT2_EXTENT_FLAGS_UNINIT)
455                                 uninit = EXT2_EXTENT_SET_BMAP_UNINIT;
456                         for (blockcnt = extent.e_lblk, j = 0;
457                              j < extent.e_len;
458                              blk++, blockcnt++, j++) {
459                                 new_blk = blk;
460                                 r = (*ctx.func)(fs, &new_blk, blockcnt,
461                                                 0, 0, priv_data);
462                                 ret |= r;
463                                 check_for_ro_violation_goto(&ctx, ret,
464                                                             extent_errout);
465                                 if (r & BLOCK_CHANGED) {
466                                         ctx.errcode =
467                                                 ext2fs_extent_set_bmap(handle,
468                                                        (blk64_t) blockcnt,
469                                                        new_blk, uninit);
470                                         if (ctx.errcode)
471                                                 goto extent_errout;
472                                 }
473                                 if (ret & BLOCK_ABORT)
474                                         break;
475                         }
476                 }
477
478         extent_errout:
479                 ext2fs_extent_free(handle);
480                 ret |= BLOCK_ERROR | BLOCK_ABORT;
481                 goto errout;
482         }
483
484         /*
485          * Iterate over normal data blocks
486          */
487         for (i = 0; i < EXT2_NDIR_BLOCKS ; i++, ctx.bcount++) {
488                 if (inode.i_block[i] || (flags & BLOCK_FLAG_APPEND)) {
489                         blk64 = inode.i_block[i];
490                         ret |= (*ctx.func)(fs, &blk64, ctx.bcount, 0, i, 
491                                            priv_data);
492                         inode.i_block[i] = (blk_t) blk64;
493                         if (ret & BLOCK_ABORT)
494                                 goto abort_exit;
495                 }
496         }
497         check_for_ro_violation_goto(&ctx, ret, abort_exit);
498         if (inode.i_block[EXT2_IND_BLOCK] || (flags & BLOCK_FLAG_APPEND)) {
499                 ret |= block_iterate_ind(&inode.i_block[EXT2_IND_BLOCK], 
500                                          0, EXT2_IND_BLOCK, &ctx);
501                 if (ret & BLOCK_ABORT)
502                         goto abort_exit;
503         } else
504                 ctx.bcount += limit;
505         if (inode.i_block[EXT2_DIND_BLOCK] || (flags & BLOCK_FLAG_APPEND)) {
506                 ret |= block_iterate_dind(&inode.i_block[EXT2_DIND_BLOCK],
507                                           0, EXT2_DIND_BLOCK, &ctx);
508                 if (ret & BLOCK_ABORT)
509                         goto abort_exit;
510         } else
511                 ctx.bcount += limit * limit;
512         if (inode.i_block[EXT2_TIND_BLOCK] || (flags & BLOCK_FLAG_APPEND)) {
513                 ret |= block_iterate_tind(&inode.i_block[EXT2_TIND_BLOCK],
514                                           0, EXT2_TIND_BLOCK, &ctx);
515                 if (ret & BLOCK_ABORT)
516                         goto abort_exit;
517         }
518
519 abort_exit:
520         if (ret & BLOCK_CHANGED) {
521                 retval = ext2fs_write_inode(fs, ino, &inode);
522                 if (retval) {
523                         ret |= BLOCK_ERROR;
524                         ctx.errcode = retval;
525                 }
526         }
527 errout:
528         if (!block_buf)
529                 ext2fs_free_mem(&ctx.ind_buf);
530
531         return (ret & BLOCK_ERROR) ? ctx.errcode : 0;
532 }
533
534 /*
535  * Emulate the old ext2fs_block_iterate function!
536  */
537
538 struct xlate64 {
539         int (*func)(ext2_filsys fs,
540                     blk_t       *blocknr,
541                     e2_blkcnt_t blockcnt,
542                     blk_t       ref_blk,
543                     int         ref_offset,
544                     void        *priv_data);
545         void *real_private;
546 };
547
548 static int xlate64_func(ext2_filsys fs, blk64_t *blocknr,
549                         e2_blkcnt_t blockcnt, blk64_t ref_blk,
550                         int ref_offset, void *priv_data)
551 {
552         struct xlate64 *xl = (struct xlate64 *) priv_data;
553         int             ret;
554         blk_t           block32 = *blocknr;
555         
556         ret = (*xl->func)(fs, &block32, blockcnt, (blk_t) ref_blk, ref_offset,
557                              xl->real_private);
558         *blocknr = block32;
559         return ret;
560 }
561
562 errcode_t ext2fs_block_iterate2(ext2_filsys fs,
563                                 ext2_ino_t ino,
564                                 int     flags,
565                                 char *block_buf,
566                                 int (*func)(ext2_filsys fs,
567                                             blk_t       *blocknr,
568                                             e2_blkcnt_t blockcnt,
569                                             blk_t       ref_blk,
570                                             int         ref_offset,
571                                             void        *priv_data),
572                                 void *priv_data)
573 {
574         struct xlate64 xl;
575
576         xl.real_private = priv_data;
577         xl.func = func;
578
579         return ext2fs_block_iterate3(fs, ino, flags, block_buf, 
580                                      xlate64_func, &xl);
581 }
582
583
584 struct xlate {
585         int (*func)(ext2_filsys fs,
586                     blk_t       *blocknr,
587                     int         bcount,
588                     void        *priv_data);
589         void *real_private;
590 };
591
592 #ifdef __TURBOC__
593  #pragma argsused
594 #endif
595 static int xlate_func(ext2_filsys fs, blk_t *blocknr, e2_blkcnt_t blockcnt,
596                       blk_t ref_block EXT2FS_ATTR((unused)),
597                       int ref_offset EXT2FS_ATTR((unused)),
598                       void *priv_data)
599 {
600         struct xlate *xl = (struct xlate *) priv_data;
601
602         return (*xl->func)(fs, blocknr, (int) blockcnt, xl->real_private);
603 }
604
605 errcode_t ext2fs_block_iterate(ext2_filsys fs,
606                                ext2_ino_t ino,
607                                int      flags,
608                                char *block_buf,
609                                int (*func)(ext2_filsys fs,
610                                            blk_t        *blocknr,
611                                            int  blockcnt,
612                                            void *priv_data),
613                                void *priv_data)
614 {
615         struct xlate xl;
616
617         xl.real_private = priv_data;
618         xl.func = func;
619
620         return ext2fs_block_iterate2(fs, ino, BLOCK_FLAG_NO_LARGE | flags,
621                                      block_buf, xlate_func, &xl);
622 }
623