can't get_block(NO_DEV) any more
. 'anonymous' cache blocks (retrieved with NO_DEV as dev parameter) were used to implement read()s from holes in inodes that should return zeroes . this is an awkward special case in the cache code though and there's a more direct way to implement the same functionality: instead of copying from a new, anonymous, zero block, to the user target buffer, simply sys_safememset the user target buffer directly. as this was the only use of this feature, this is all that's needed to simplify the cache code a little.
This commit is contained in:
@@ -237,8 +237,12 @@ int *completed; /* number of bytes copied */
|
||||
if (!block_spec && b == NO_BLOCK) {
|
||||
if (rw_flag == READING) {
|
||||
/* Reading from a nonexistent block. Must read as all zeros.*/
|
||||
bp = get_block(NO_DEV, NO_BLOCK, NORMAL); /* get a buffer */
|
||||
zero_block(bp);
|
||||
r = sys_safememset(VFS_PROC_NR, gid, (vir_bytes) buf_off,
|
||||
0, (size_t) chunk);
|
||||
if(r != OK) {
|
||||
printf("ext2fs: sys_safememset failed\n");
|
||||
}
|
||||
return r;
|
||||
} else {
|
||||
/* Writing to a nonexistent block. Create and enter in inode.*/
|
||||
if ((bp = new_block(rip, (off_t) ex64lo(position))) == NULL)
|
||||
|
||||
@@ -246,8 +246,12 @@ int *completed; /* number of bytes copied */
|
||||
if (!block_spec && b == NO_BLOCK) {
|
||||
if (rw_flag == READING) {
|
||||
/* Reading from a nonexistent block. Must read as all zeros.*/
|
||||
bp = get_block(NO_DEV, NO_BLOCK, NORMAL); /* get a buffer */
|
||||
zero_block(bp);
|
||||
r = sys_safememset(VFS_PROC_NR, gid, (vir_bytes) buf_off,
|
||||
0, (size_t) chunk);
|
||||
if(r != OK) {
|
||||
printf("MFS: sys_safememset failed\n");
|
||||
}
|
||||
return r;
|
||||
} else {
|
||||
/* Writing to a nonexistent block. Create and enter in inode.*/
|
||||
if ((bp = new_block(rip, (off_t) ex64lo(position))) == NULL)
|
||||
|
||||
Reference in New Issue
Block a user