mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
bcache: add invalidate_bytes function
This commit is contained in:
parent
29db9c6325
commit
56a295f78c
@ -79,6 +79,21 @@ bool bcache_read_bytes(struct bcache *cache, int fd, uint64_t start, size_t len,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool bcache_invalidate_bytes(struct bcache *cache, int fd, uint64_t start, size_t len)
|
||||||
|
{
|
||||||
|
block_address bb, be;
|
||||||
|
bool result = true;
|
||||||
|
|
||||||
|
byte_range_to_block_range(cache, start, len, &bb, &be);
|
||||||
|
|
||||||
|
for (; bb != be; bb++) {
|
||||||
|
if (!bcache_invalidate(cache, fd, bb))
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
|
|
||||||
// Writing bytes and zeroing bytes are very similar, so we factor out
|
// Writing bytes and zeroing bytes are very similar, so we factor out
|
||||||
|
@ -163,6 +163,7 @@ bool bcache_read_bytes(struct bcache *cache, int fd, uint64_t start, size_t len,
|
|||||||
bool bcache_write_bytes(struct bcache *cache, int fd, uint64_t start, size_t len, void *data);
|
bool bcache_write_bytes(struct bcache *cache, int fd, uint64_t start, size_t len, void *data);
|
||||||
bool bcache_zero_bytes(struct bcache *cache, int fd, uint64_t start, size_t len);
|
bool bcache_zero_bytes(struct bcache *cache, int fd, uint64_t start, size_t len);
|
||||||
bool bcache_set_bytes(struct bcache *cache, int fd, uint64_t start, size_t len, uint8_t val);
|
bool bcache_set_bytes(struct bcache *cache, int fd, uint64_t start, size_t len, uint8_t val);
|
||||||
|
bool bcache_invalidate_bytes(struct bcache *cache, int fd, uint64_t start, size_t len);
|
||||||
|
|
||||||
void bcache_set_last_byte(struct bcache *cache, int fd, uint64_t offset, int sector_size);
|
void bcache_set_last_byte(struct bcache *cache, int fd, uint64_t offset, int sector_size);
|
||||||
void bcache_unset_last_byte(struct bcache *cache, int fd);
|
void bcache_unset_last_byte(struct bcache *cache, int fd);
|
||||||
|
@ -1464,6 +1464,11 @@ bool dev_write_bytes(struct device *dev, uint64_t start, size_t len, void *data)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool dev_invalidate_bytes(struct device *dev, uint64_t start, size_t len)
|
||||||
|
{
|
||||||
|
return bcache_invalidate_bytes(scan_bcache, dev->bcache_fd, start, len);
|
||||||
|
}
|
||||||
|
|
||||||
bool dev_write_zeros(struct device *dev, uint64_t start, size_t len)
|
bool dev_write_zeros(struct device *dev, uint64_t start, size_t len)
|
||||||
{
|
{
|
||||||
if (test_mode())
|
if (test_mode())
|
||||||
|
@ -126,6 +126,7 @@ bool dev_read_bytes(struct device *dev, uint64_t start, size_t len, void *data);
|
|||||||
bool dev_write_bytes(struct device *dev, uint64_t start, size_t len, void *data);
|
bool dev_write_bytes(struct device *dev, uint64_t start, size_t len, void *data);
|
||||||
bool dev_write_zeros(struct device *dev, uint64_t start, size_t len);
|
bool dev_write_zeros(struct device *dev, uint64_t start, size_t len);
|
||||||
bool dev_set_bytes(struct device *dev, uint64_t start, size_t len, uint8_t val);
|
bool dev_set_bytes(struct device *dev, uint64_t start, size_t len, uint8_t val);
|
||||||
|
bool dev_invalidate_bytes(struct device *dev, uint64_t start, size_t len);
|
||||||
void dev_set_last_byte(struct device *dev, uint64_t offset);
|
void dev_set_last_byte(struct device *dev, uint64_t offset);
|
||||||
void dev_unset_last_byte(struct device *dev);
|
void dev_unset_last_byte(struct device *dev);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user