Changeset 38b7233 in mainline


Ignore:
Timestamp:
2011-06-26T10:08:18Z (14 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a5bad72
Parents:
d8af1bd
Message:

Fix bug in the inode_shrink() function, zones_to_free was not correctly computed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/minixfs/mfs_inode.c

    rd8af1bd r38b7233  
    317317
    318318        /*Compute the number of zones to free*/
    319         unsigned zones_to_free = 0;
    320         if (new_size == 0)
    321                 ++zones_to_free;
    322 
    323         zones_to_free += (old_size / bs) - (new_size / bs);
    324 
    325         mfsdebug("zones to free = %u\n", zones_to_free);
     319        unsigned zones_to_free;
     320
     321        size_t diff = old_size - new_size;
     322        zones_to_free = diff / bs;
     323
     324        if (diff % bs != 0)
     325                zones_to_free++;
    326326
    327327        uint32_t pos = old_size - 1;
     
    374374        start_zone += (old_size % bs) != 0;
    375375
    376         mfsdebug("zones to add = %u\n", zones_to_add);
    377 
    378376        int r;
    379377        for (i = 0; i < zones_to_add; ++i) {
     
    384382                on_error(r, return r);
    385383
    386                 mfsdebug("write_map = %d\n", (int) ((start_zone + i) * bs));
    387 
    388384                block_t *b;
    389385                r = block_get(&b, mnode->instance->handle, new_zone,
Note: See TracChangeset for help on using the changeset viewer.