~wb-munzinger/+junk/ocfs2-tools

« back to all changes in this revision

Viewing changes to libocfs2/truncate.c

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2009-07-06 07:26:30 UTC
  • mfrom: (1.1.7 upstream) (0.1.5 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090706072630-59335sl51k3rvu74
Tags: 1.4.2-1
* New upstream release (Closes: #535471).
* Drop patch for limits.h, included upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
#include <unistd.h>
31
31
#endif
32
32
 
33
 
#include "ocfs2.h"
 
33
#include "ocfs2/ocfs2.h"
34
34
 
35
35
struct truncate_ctxt {
36
36
        uint64_t new_size_in_clusters;
167
167
        if (ret)
168
168
                goto out;
169
169
 
170
 
        ret = io_read_block(fs->fs_io, p_blkno, count, buf);
 
170
        ret = ocfs2_read_blocks(fs, p_blkno, count, buf);
171
171
        if (ret)
172
172
                goto out;
173
173
 
261
261
        return ret;
262
262
}
263
263
 
 
264
errcode_t ocfs2_xattr_value_truncate(ocfs2_filesys *fs,
 
265
                                     struct ocfs2_xattr_value_root *xv)
 
266
{
 
267
        struct truncate_ctxt ctxt;
 
268
        int changed;
 
269
        struct ocfs2_extent_list *el = &xv->xr_list;
 
270
 
 
271
        ctxt.new_i_clusters = xv->xr_clusters;
 
272
        ctxt.new_size_in_clusters = 0;
 
273
 
 
274
        return ocfs2_extent_iterate_xattr(fs, el, xv->xr_last_eb_blk,
 
275
                                        OCFS2_EXTENT_FLAG_DEPTH_TRAVERSE,
 
276
                                        truncate_iterate,
 
277
                                        &ctxt, &changed);
 
278
}
 
279
 
 
280
errcode_t ocfs2_xattr_tree_truncate(ocfs2_filesys *fs,
 
281
                                    struct ocfs2_xattr_tree_root *xt)
 
282
{
 
283
        struct truncate_ctxt ctxt;
 
284
        int changed;
 
285
        struct ocfs2_extent_list *el = &xt->xt_list;
 
286
 
 
287
        ctxt.new_i_clusters = xt->xt_clusters;
 
288
        ctxt.new_size_in_clusters = 0;
 
289
 
 
290
        return ocfs2_extent_iterate_xattr(fs, el, xt->xt_last_eb_blk,
 
291
                                        OCFS2_EXTENT_FLAG_DEPTH_TRAVERSE,
 
292
                                        truncate_iterate,
 
293
                                        &ctxt, &changed);
 
294
}
 
295
 
264
296
#ifdef DEBUG_EXE
265
297
#include <stdlib.h>
266
298
#include <getopt.h>