btrfs-progs: constify the buffer pointer for write functions

The following functions accept a buffer for write, which can be marked
as const:

- btrfs_pwrite()
- write_data_to_disk()

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Qu Wenruo 2023-05-09 19:48:39 +08:00 committed by David Sterba
parent 2b51d006cd
commit 3ce08b2ff6
3 changed files with 5 additions and 5 deletions

View File

@ -54,7 +54,7 @@ ssize_t btrfs_direct_pread(int fd, void *buf, size_t count, off_t offset);
ssize_t btrfs_direct_pwrite(int fd, const void *buf, size_t count, off_t offset);
#ifdef BTRFS_ZONED
static inline ssize_t btrfs_pwrite(int fd, void *buf, size_t count,
static inline ssize_t btrfs_pwrite(int fd, const void *buf, size_t count,
off_t offset, bool direct)
{
if (!direct)
@ -62,8 +62,8 @@ static inline ssize_t btrfs_pwrite(int fd, void *buf, size_t count,
return btrfs_direct_pwrite(fd, buf, count, offset);
}
static inline ssize_t btrfs_pread(int fd, void *buf, size_t count, off_t offset,
bool direct)
static inline ssize_t btrfs_pread(int fd, void *buf, size_t count,
off_t offset, bool direct)
{
if (!direct)
return pread(fd, buf, count, offset);

View File

@ -477,7 +477,7 @@ int read_data_from_disk(struct btrfs_fs_info *info, void *buf, u64 logical,
* Such data will be written to all mirrors and RAID56 P/Q will also be
* properly handled.
*/
int write_data_to_disk(struct btrfs_fs_info *info, void *buf, u64 offset,
int write_data_to_disk(struct btrfs_fs_info *info, const void *buf, u64 offset,
u64 bytes)
{
struct btrfs_multi_bio *multi = NULL;

View File

@ -128,7 +128,7 @@ int set_extent_buffer_dirty(struct extent_buffer *eb);
int btrfs_clear_buffer_dirty(struct extent_buffer *eb);
int read_data_from_disk(struct btrfs_fs_info *info, void *buf, u64 logical,
u64 *len, int mirror);
int write_data_to_disk(struct btrfs_fs_info *info, void *buf, u64 offset,
int write_data_to_disk(struct btrfs_fs_info *info, const void *buf, u64 offset,
u64 bytes);
void extent_buffer_bitmap_clear(struct extent_buffer *eb, unsigned long start,
unsigned long pos, unsigned long len);