Skip to content

Commit

Permalink
Update inode size when entering an item into an existing block.
Browse files Browse the repository at this point in the history
  • Loading branch information
dthain committed Dec 18, 2023
1 parent 24cbd6a commit 08be8c6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions kernel/diskfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,16 @@ static int diskfs_dirent_add( struct fs_dirent *d, const char *name, int type, i
r->inumber = inumber;
r->name_length = strlen(name);
memcpy(r->name,name,r->name_length);

/* Save the modified data block. */
diskfs_inode_write(d,b,i);

/* If this increased the logical size, update that too. */
uint32_t newsize = (i*DISKFS_BLOCK_SIZE) + (j+1)*sizeof(struct diskfs_item);
if(newsize>d->size) {
diskfs_dirent_resize(d,newsize);
diskfs_inode_save(d->volume,d->inumber,&d->disk);
}
page_free(b);
return 0;
}
Expand Down

0 comments on commit 08be8c6

Please sign in to comment.