diff mbox series

[2/3] btrfs-progs: constify the buffer pointer for write functions

Message ID f05b0b3a04ae5f2a5e7ffc86d9fb7b5baf85e419.1683632614.git.wqu@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: write_and_map_eb() cleanup | expand

Commit Message

Qu Wenruo May 9, 2023, 11:48 a.m. UTC
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>
---
 common/device-utils.h     | 6 +++---
 kernel-shared/extent_io.c | 2 +-
 kernel-shared/extent_io.h | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/common/device-utils.h b/common/device-utils.h
index 6390a72951eb..21955c2835f2 100644
--- a/common/device-utils.h
+++ b/common/device-utils.h
@@ -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);
diff --git a/kernel-shared/extent_io.c b/kernel-shared/extent_io.c
index 172ba66a1cfa..7f6d592ab641 100644
--- a/kernel-shared/extent_io.c
+++ b/kernel-shared/extent_io.c
@@ -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;
diff --git a/kernel-shared/extent_io.h b/kernel-shared/extent_io.h
index a1cda3a53351..b6c30eef67c2 100644
--- a/kernel-shared/extent_io.h
+++ b/kernel-shared/extent_io.h
@@ -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);