Changeset e5cebc9 in mainline for uspace/srv/fs/minixfs/mfs_inode.c


Ignore:
Timestamp:
2011-04-19T20:59:51Z (13 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bfbe16f
Parents:
1494e52
Message:

Fixes to inode_grow():

  • The number of zones to add to the inode was not correct.
  • The new zone content should be set at zero.
File:
1 edited

Legend:

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

    r1494e52 re5cebc9  
    323323        /*Compute the number of zones to add to the inode*/
    324324        unsigned zones_to_add = 0;
    325         if ((old_size % (bs - 1)) == 0)
    326                 zones_to_add++;
    327 
    328         zones_to_add += (new_size - old_size) / bs;
     325        if (old_size == 0)
     326                ++zones_to_add;
     327
     328        zones_to_add += (new_size / bs) - (old_size / bs);
    329329
    330330        /*Compute the start zone*/
     
    333333
    334334        mfsdebug("zones to add = %u\n", zones_to_add);
    335 
    336         if (zones_to_add == 0) {
    337                 /*Set the new inode size and exit*/
    338                 ino_i->i_size = new_size;
    339                 ino_i->dirty = true;
    340                 return EOK;
    341         }
    342335
    343336        int r;
     
    350343                        return r;
    351344
    352                 r = write_map(mnode, (start_zone + i) * sbi->block_size,
     345                mfsdebug("write_map = %d\n", (int) ((start_zone + i) * bs));
     346
     347                block_t *b;
     348                r = block_get(&b, mnode->instance->handle, new_zone,
     349                                                BLOCK_FLAGS_NOREAD);
     350                if (r != EOK)
     351                        return r;
     352
     353                memset(b->data, 0, bs);
     354                b->dirty = true;
     355                block_put(b);
     356
     357                r = write_map(mnode, (start_zone + i) * bs,
    353358                                new_zone, &dummy);
    354359                if (r != EOK)
     
    358363                ino_i->dirty = true;
    359364        }
     365
     366        ino_i->i_size = new_size;
     367        ino_i->dirty = true;
     368
    360369        return EOK;
    361370}
Note: See TracChangeset for help on using the changeset viewer.