kernel: Drop base, length parameters from block_cache...etc methods.
They were ignored and unused; and in fact can't be made to work properly since the block_cache always operates on exactly block-sized buffers, and doesn't have contiguous buffers of multiple blocks to hand out at all. No functional change intended.
This commit is contained in:
@@ -67,13 +67,13 @@ extern void block_cache_discard(void *cache, off_t blockNumber,
|
|||||||
extern status_t block_cache_make_writable(void *cache, off_t blockNumber,
|
extern status_t block_cache_make_writable(void *cache, off_t blockNumber,
|
||||||
int32 transaction);
|
int32 transaction);
|
||||||
extern status_t block_cache_get_writable_etc(void *cache, off_t blockNumber,
|
extern status_t block_cache_get_writable_etc(void *cache, off_t blockNumber,
|
||||||
off_t base, off_t length, int32 transaction, void** _block);
|
int32 transaction, void** _block);
|
||||||
extern void *block_cache_get_writable(void *cache, off_t blockNumber,
|
extern void *block_cache_get_writable(void *cache, off_t blockNumber,
|
||||||
int32 transaction);
|
int32 transaction);
|
||||||
extern void *block_cache_get_empty(void *cache, off_t blockNumber,
|
extern void *block_cache_get_empty(void *cache, off_t blockNumber,
|
||||||
int32 transaction);
|
int32 transaction);
|
||||||
extern status_t block_cache_get_etc(void *cache, off_t blockNumber,
|
extern status_t block_cache_get_etc(void *cache, off_t blockNumber,
|
||||||
off_t base, off_t length, const void** _block);
|
const void** _block);
|
||||||
extern const void *block_cache_get(void *cache, off_t blockNumber);
|
extern const void *block_cache_get(void *cache, off_t blockNumber);
|
||||||
extern status_t block_cache_set_dirty(void *cache, off_t blockNumber,
|
extern status_t block_cache_set_dirty(void *cache, off_t blockNumber,
|
||||||
bool isDirty, int32 transaction);
|
bool isDirty, int32 transaction);
|
||||||
|
|||||||
@@ -30,12 +30,8 @@ public:
|
|||||||
inline void Keep();
|
inline void Keep();
|
||||||
inline void Unset();
|
inline void Unset();
|
||||||
|
|
||||||
inline status_t SetTo(off_t block, off_t base, size_t length);
|
|
||||||
inline status_t SetTo(off_t block);
|
inline status_t SetTo(off_t block);
|
||||||
inline status_t SetTo(block_run run);
|
inline status_t SetTo(block_run run);
|
||||||
inline status_t SetToWritable(Transaction& transaction,
|
|
||||||
off_t block, off_t base, size_t length,
|
|
||||||
bool empty = false);
|
|
||||||
inline status_t SetToWritable(Transaction& transaction,
|
inline status_t SetToWritable(Transaction& transaction,
|
||||||
off_t block, bool empty = false);
|
off_t block, bool empty = false);
|
||||||
inline status_t SetToWritable(Transaction& transaction,
|
inline status_t SetToWritable(Transaction& transaction,
|
||||||
@@ -111,19 +107,11 @@ CachedBlock::Unset()
|
|||||||
|
|
||||||
|
|
||||||
inline status_t
|
inline status_t
|
||||||
CachedBlock::SetTo(off_t block, off_t base, size_t length)
|
CachedBlock::SetTo(off_t block)
|
||||||
{
|
{
|
||||||
Unset();
|
Unset();
|
||||||
fBlockNumber = block;
|
fBlockNumber = block;
|
||||||
return block_cache_get_etc(fVolume->BlockCache(), block, base, length,
|
return block_cache_get_etc(fVolume->BlockCache(), block, (const void**)&fBlock);
|
||||||
(const void**)&fBlock);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline status_t
|
|
||||||
CachedBlock::SetTo(off_t block)
|
|
||||||
{
|
|
||||||
return SetTo(block, block, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -135,8 +123,7 @@ CachedBlock::SetTo(block_run run)
|
|||||||
|
|
||||||
|
|
||||||
inline status_t
|
inline status_t
|
||||||
CachedBlock::SetToWritable(Transaction& transaction, off_t block, off_t base,
|
CachedBlock::SetToWritable(Transaction& transaction, off_t block, bool empty)
|
||||||
size_t length, bool empty)
|
|
||||||
{
|
{
|
||||||
Unset();
|
Unset();
|
||||||
fBlockNumber = block;
|
fBlockNumber = block;
|
||||||
@@ -148,14 +135,7 @@ CachedBlock::SetToWritable(Transaction& transaction, off_t block, off_t base,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return block_cache_get_writable_etc(fVolume->BlockCache(),
|
return block_cache_get_writable_etc(fVolume->BlockCache(),
|
||||||
block, base, length, transaction.ID(), (void**)&fBlock);
|
block, transaction.ID(), (void**)&fBlock);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline status_t
|
|
||||||
CachedBlock::SetToWritable(Transaction& transaction, off_t block, bool empty)
|
|
||||||
{
|
|
||||||
return SetToWritable(transaction, block, block, 1, empty);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -549,7 +549,7 @@ dosfs_write_fs_stat(fs_volume* volume, const struct fs_info* info, uint32 mask)
|
|||||||
void* blockCache = bsdVolume->mnt_cache;
|
void* blockCache = bsdVolume->mnt_cache;
|
||||||
u_char* buffer;
|
u_char* buffer;
|
||||||
status
|
status
|
||||||
= block_cache_get_writable_etc(blockCache, 0, 0, 1, -1, reinterpret_cast<void**>(&buffer));
|
= block_cache_get_writable_etc(blockCache, 0, -1, reinterpret_cast<void**>(&buffer));
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
return status;
|
return status;
|
||||||
// check for the extended boot signature
|
// check for the extended boot signature
|
||||||
@@ -580,7 +580,7 @@ dosfs_write_fs_stat(fs_volume* volume, const struct fs_info* info, uint32 mask)
|
|||||||
daddr_t dirOffset = bsdVolume->mnt_volentry * sizeof(direntry);
|
daddr_t dirOffset = bsdVolume->mnt_volentry * sizeof(direntry);
|
||||||
rootDirBlock += dirOffset / DEV_BSIZE;
|
rootDirBlock += dirOffset / DEV_BSIZE;
|
||||||
|
|
||||||
status = block_cache_get_writable_etc(blockCache, rootDirBlock, 0, 1, -1,
|
status = block_cache_get_writable_etc(blockCache, rootDirBlock, -1,
|
||||||
reinterpret_cast<void**>(&rootDirBuffer));
|
reinterpret_cast<void**>(&rootDirBuffer));
|
||||||
if (status == B_OK) {
|
if (status == B_OK) {
|
||||||
direntry* label_direntry = reinterpret_cast<direntry*>(rootDirBuffer + dirOffset);
|
direntry* label_direntry = reinterpret_cast<direntry*>(rootDirBuffer + dirOffset);
|
||||||
|
|||||||
@@ -554,7 +554,7 @@ read_fsinfo(msdosfsmount* volume, const vnode* devNode)
|
|||||||
const uint8* buffer;
|
const uint8* buffer;
|
||||||
const struct fsinfo* fsInfo;
|
const struct fsinfo* fsInfo;
|
||||||
|
|
||||||
status = block_cache_get_etc(volume->pm_mountp->mnt_cache, volume->pm_fsinfo, 0, 1,
|
status = block_cache_get_etc(volume->pm_mountp->mnt_cache, volume->pm_fsinfo,
|
||||||
reinterpret_cast<const void**>(&buffer));
|
reinterpret_cast<const void**>(&buffer));
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
RETURN_ERROR(status);
|
RETURN_ERROR(status);
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ public:
|
|||||||
inline void Unset();
|
inline void Unset();
|
||||||
|
|
||||||
inline status_t SetTo(off_t block);
|
inline status_t SetTo(off_t block);
|
||||||
inline status_t SetTo(off_t block, off_t base, size_t length);
|
|
||||||
inline status_t SetTo(long_address address);
|
inline status_t SetTo(long_address address);
|
||||||
template <class Accessor, class Descriptor>
|
template <class Accessor, class Descriptor>
|
||||||
inline status_t SetTo(Accessor &accessor,
|
inline status_t SetTo(Accessor &accessor,
|
||||||
@@ -96,17 +95,10 @@ CachedBlock::Unset()
|
|||||||
|
|
||||||
inline status_t
|
inline status_t
|
||||||
CachedBlock::SetTo(off_t block)
|
CachedBlock::SetTo(off_t block)
|
||||||
{
|
|
||||||
return SetTo(block, block, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline status_t
|
|
||||||
CachedBlock::SetTo(off_t block, off_t base, size_t length)
|
|
||||||
{
|
{
|
||||||
Unset();
|
Unset();
|
||||||
fBlockNumber = block;
|
fBlockNumber = block;
|
||||||
return block_cache_get_etc(fVolume->BlockCache(), block, base, length,
|
return block_cache_get_etc(fVolume->BlockCache(), block,
|
||||||
(const void**)&fBlock);
|
(const void**)&fBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,7 +108,7 @@ CachedBlock::SetTo(long_address address)
|
|||||||
{
|
{
|
||||||
off_t block;
|
off_t block;
|
||||||
if (fVolume->MapBlock(address, &block) == B_OK)
|
if (fVolume->MapBlock(address, &block) == B_OK)
|
||||||
return SetTo(block, block, 1);
|
return SetTo(block);
|
||||||
|
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -453,7 +453,7 @@ Icb::_Read(DescriptorList &list, off_t pos, void *_buffer, size_t *length, uint3
|
|||||||
" block_cache_get_etc()\n", readLength, diskBlock));
|
" block_cache_get_etc()\n", readLength, diskBlock));
|
||||||
const uint8 *data;
|
const uint8 *data;
|
||||||
status = block_cache_get_etc(volume->BlockCache(),
|
status = block_cache_get_etc(volume->BlockCache(),
|
||||||
diskBlock, 0, readLength, (const void**)&data);
|
diskBlock, (const void**)&data);
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
break;
|
break;
|
||||||
memcpy(buffer, data + blockOffset, readLength);
|
memcpy(buffer, data + blockOffset, readLength);
|
||||||
|
|||||||
+10
-12
@@ -1999,8 +1999,8 @@ retry:
|
|||||||
sure that the previous block contents are preserved in that case.
|
sure that the previous block contents are preserved in that case.
|
||||||
*/
|
*/
|
||||||
static status_t
|
static status_t
|
||||||
get_writable_cached_block(block_cache* cache, off_t blockNumber, off_t base,
|
get_writable_cached_block(block_cache* cache, off_t blockNumber,
|
||||||
off_t length, int32 transactionID, bool cleared, void** _block)
|
int32 transactionID, bool cleared, void** _block)
|
||||||
{
|
{
|
||||||
TRACE(("get_writable_cached_block(blockNumber = %" B_PRIdOFF ", transaction = %" B_PRId32 ")\n",
|
TRACE(("get_writable_cached_block(blockNumber = %" B_PRIdOFF ", transaction = %" B_PRId32 ")\n",
|
||||||
blockNumber, transactionID));
|
blockNumber, transactionID));
|
||||||
@@ -3617,7 +3617,7 @@ block_cache_make_writable(void* _cache, off_t blockNumber, int32 transaction)
|
|||||||
// TODO: this can be done better!
|
// TODO: this can be done better!
|
||||||
void* block;
|
void* block;
|
||||||
status_t status = get_writable_cached_block(cache, blockNumber,
|
status_t status = get_writable_cached_block(cache, blockNumber,
|
||||||
blockNumber, 1, transaction, false, &block);
|
transaction, false, &block);
|
||||||
if (status == B_OK) {
|
if (status == B_OK) {
|
||||||
put_cached_block((block_cache*)_cache, blockNumber);
|
put_cached_block((block_cache*)_cache, blockNumber);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -3628,8 +3628,8 @@ block_cache_make_writable(void* _cache, off_t blockNumber, int32 transaction)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
block_cache_get_writable_etc(void* _cache, off_t blockNumber, off_t base,
|
block_cache_get_writable_etc(void* _cache, off_t blockNumber,
|
||||||
off_t length, int32 transaction, void** _block)
|
int32 transaction, void** _block)
|
||||||
{
|
{
|
||||||
block_cache* cache = (block_cache*)_cache;
|
block_cache* cache = (block_cache*)_cache;
|
||||||
MutexLocker locker(&cache->lock);
|
MutexLocker locker(&cache->lock);
|
||||||
@@ -3639,7 +3639,7 @@ block_cache_get_writable_etc(void* _cache, off_t blockNumber, off_t base,
|
|||||||
if (cache->read_only)
|
if (cache->read_only)
|
||||||
panic("tried to get writable block on a read-only cache!");
|
panic("tried to get writable block on a read-only cache!");
|
||||||
|
|
||||||
return get_writable_cached_block(cache, blockNumber, base, length,
|
return get_writable_cached_block(cache, blockNumber,
|
||||||
transaction, false, _block);
|
transaction, false, _block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3649,7 +3649,7 @@ block_cache_get_writable(void* _cache, off_t blockNumber, int32 transaction)
|
|||||||
{
|
{
|
||||||
void* block;
|
void* block;
|
||||||
if (block_cache_get_writable_etc(_cache, blockNumber,
|
if (block_cache_get_writable_etc(_cache, blockNumber,
|
||||||
blockNumber, 1, transaction, &block) == B_OK)
|
transaction, &block) == B_OK)
|
||||||
return block;
|
return block;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -3669,7 +3669,7 @@ block_cache_get_empty(void* _cache, off_t blockNumber, int32 transaction)
|
|||||||
|
|
||||||
void* block;
|
void* block;
|
||||||
if (get_writable_cached_block((block_cache*)_cache, blockNumber,
|
if (get_writable_cached_block((block_cache*)_cache, blockNumber,
|
||||||
blockNumber, 1, transaction, true, &block) == B_OK)
|
transaction, true, &block) == B_OK)
|
||||||
return block;
|
return block;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -3677,8 +3677,7 @@ block_cache_get_empty(void* _cache, off_t blockNumber, int32 transaction)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
block_cache_get_etc(void* _cache, off_t blockNumber, off_t base, off_t length,
|
block_cache_get_etc(void* _cache, off_t blockNumber, const void** _block)
|
||||||
const void** _block)
|
|
||||||
{
|
{
|
||||||
block_cache* cache = (block_cache*)_cache;
|
block_cache* cache = (block_cache*)_cache;
|
||||||
MutexLocker locker(&cache->lock);
|
MutexLocker locker(&cache->lock);
|
||||||
@@ -3707,8 +3706,7 @@ const void*
|
|||||||
block_cache_get(void* _cache, off_t blockNumber)
|
block_cache_get(void* _cache, off_t blockNumber)
|
||||||
{
|
{
|
||||||
const void* block;
|
const void* block;
|
||||||
if (block_cache_get_etc(_cache, blockNumber, blockNumber, 1, &block)
|
if (block_cache_get_etc(_cache, blockNumber, &block) == B_OK)
|
||||||
== B_OK)
|
|
||||||
return block;
|
return block;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user