aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaegeuk Kim2020-11-24 16:55:47 -0600
committerJaegeuk Kim2020-12-21 15:33:15 -0600
commit1c870991f58ef0620112e6510fb8025b1f58a656 (patch)
tree0b8ac1acd9c697324c768fd33df78488147ee467
parent5a11975441c84d1fcdbe2cae760fd50df4c1dda5 (diff)
downloadkernel-1c870991f58ef0620112e6510fb8025b1f58a656.tar.gz
kernel-1c870991f58ef0620112e6510fb8025b1f58a656.tar.xz
kernel-1c870991f58ef0620112e6510fb8025b1f58a656.zip
f2fs: rename logical_to_blk and blk_to_logical
This patch renames two functions like below having u64. - logical_to_blk to bytes_to_blks - blk_to_logical to blks_to_bytes Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--fs/f2fs/data.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index be4da52604ed..a8612c6f40ab 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -1808,14 +1808,14 @@ static int get_data_block_bmap(struct inode *inode, sector_t iblock,
1808 NO_CHECK_TYPE, create); 1808 NO_CHECK_TYPE, create);
1809} 1809}
1810 1810
1811static inline sector_t logical_to_blk(struct inode *inode, loff_t offset) 1811static inline u64 bytes_to_blks(struct inode *inode, u64 bytes)
1812{ 1812{
1813 return (offset >> inode->i_blkbits); 1813 return (bytes >> inode->i_blkbits);
1814} 1814}
1815 1815
1816static inline loff_t blk_to_logical(struct inode *inode, sector_t blk) 1816static inline u64 blks_to_bytes(struct inode *inode, u64 blks)
1817{ 1817{
1818 return (blk << inode->i_blkbits); 1818 return (blks << inode->i_blkbits);
1819} 1819}
1820 1820
1821static int f2fs_xattr_fiemap(struct inode *inode, 1821static int f2fs_xattr_fiemap(struct inode *inode,
@@ -1843,7 +1843,7 @@ static int f2fs_xattr_fiemap(struct inode *inode,
1843 return err; 1843 return err;
1844 } 1844 }
1845 1845
1846 phys = (__u64)blk_to_logical(inode, ni.blk_addr); 1846 phys = blks_to_bytes(inode, ni.blk_addr);
1847 offset = offsetof(struct f2fs_inode, i_addr) + 1847 offset = offsetof(struct f2fs_inode, i_addr) +
1848 sizeof(__le32) * (DEF_ADDRS_PER_INODE - 1848 sizeof(__le32) * (DEF_ADDRS_PER_INODE -
1849 get_inline_xattr_addrs(inode)); 1849 get_inline_xattr_addrs(inode));
@@ -1875,7 +1875,7 @@ static int f2fs_xattr_fiemap(struct inode *inode,
1875 return err; 1875 return err;
1876 } 1876 }
1877 1877
1878 phys = (__u64)blk_to_logical(inode, ni.blk_addr); 1878 phys = blks_to_bytes(inode, ni.blk_addr);
1879 len = inode->i_sb->s_blocksize; 1879 len = inode->i_sb->s_blocksize;
1880 1880
1881 f2fs_put_page(page, 1); 1881 f2fs_put_page(page, 1);
@@ -1945,18 +1945,18 @@ int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
1945 goto out; 1945 goto out;
1946 } 1946 }
1947 1947
1948 if (logical_to_blk(inode, len) == 0) 1948 if (bytes_to_blks(inode, len) == 0)
1949 len = blk_to_logical(inode, 1); 1949 len = blks_to_bytes(inode, 1);
1950 1950
1951 start_blk = logical_to_blk(inode, start); 1951 start_blk = bytes_to_blks(inode, start);
1952 last_blk = logical_to_blk(inode, start + len - 1); 1952 last_blk = bytes_to_blks(inode, start + len - 1);
1953 1953
1954next: 1954next:
1955 memset(&map_bh, 0, sizeof(struct buffer_head)); 1955 memset(&map_bh, 0, sizeof(struct buffer_head));
1956 map_bh.b_size = len; 1956 map_bh.b_size = len;
1957 1957
1958 if (compr_cluster) 1958 if (compr_cluster)
1959 map_bh.b_size = blk_to_logical(inode, cluster_size - 1); 1959 map_bh.b_size = blks_to_bytes(inode, cluster_size - 1);
1960 1960
1961 ret = get_data_block(inode, start_blk, &map_bh, 0, 1961 ret = get_data_block(inode, start_blk, &map_bh, 0,
1962 F2FS_GET_BLOCK_FIEMAP, &next_pgofs); 1962 F2FS_GET_BLOCK_FIEMAP, &next_pgofs);
@@ -1967,7 +1967,7 @@ next:
1967 if (!buffer_mapped(&map_bh)) { 1967 if (!buffer_mapped(&map_bh)) {
1968 start_blk = next_pgofs; 1968 start_blk = next_pgofs;
1969 1969
1970 if (blk_to_logical(inode, start_blk) < blk_to_logical(inode, 1970 if (blks_to_bytes(inode, start_blk) < blks_to_bytes(inode,
1971 max_inode_blocks(inode))) 1971 max_inode_blocks(inode)))
1972 goto prep_next; 1972 goto prep_next;
1973 1973
@@ -1993,9 +1993,9 @@ next:
1993 compr_cluster = false; 1993 compr_cluster = false;
1994 1994
1995 1995
1996 logical = blk_to_logical(inode, start_blk - 1); 1996 logical = blks_to_bytes(inode, start_blk - 1);
1997 phys = blk_to_logical(inode, map_bh.b_blocknr); 1997 phys = blks_to_bytes(inode, map_bh.b_blocknr);
1998 size = blk_to_logical(inode, cluster_size); 1998 size = blks_to_bytes(inode, cluster_size);
1999 1999
2000 flags |= FIEMAP_EXTENT_ENCODED; 2000 flags |= FIEMAP_EXTENT_ENCODED;
2001 2001
@@ -2013,14 +2013,14 @@ next:
2013 goto prep_next; 2013 goto prep_next;
2014 } 2014 }
2015 2015
2016 logical = blk_to_logical(inode, start_blk); 2016 logical = blks_to_bytes(inode, start_blk);
2017 phys = blk_to_logical(inode, map_bh.b_blocknr); 2017 phys = blks_to_bytes(inode, map_bh.b_blocknr);
2018 size = map_bh.b_size; 2018 size = map_bh.b_size;
2019 flags = 0; 2019 flags = 0;
2020 if (buffer_unwritten(&map_bh)) 2020 if (buffer_unwritten(&map_bh))
2021 flags = FIEMAP_EXTENT_UNWRITTEN; 2021 flags = FIEMAP_EXTENT_UNWRITTEN;
2022 2022
2023 start_blk += logical_to_blk(inode, size); 2023 start_blk += bytes_to_blks(inode, size);
2024 2024
2025prep_next: 2025prep_next:
2026 cond_resched(); 2026 cond_resched();
@@ -3903,7 +3903,7 @@ static int check_swap_activate_fast(struct swap_info_struct *sis,
3903 * to be very smart. 3903 * to be very smart.
3904 */ 3904 */
3905 cur_lblock = 0; 3905 cur_lblock = 0;
3906 last_lblock = logical_to_blk(inode, i_size_read(inode)); 3906 last_lblock = bytes_to_blks(inode, i_size_read(inode));
3907 len = i_size_read(inode); 3907 len = i_size_read(inode);
3908 3908
3909 while (cur_lblock <= last_lblock && cur_lblock < sis->max) { 3909 while (cur_lblock <= last_lblock && cur_lblock < sis->max) {
@@ -3925,7 +3925,7 @@ static int check_swap_activate_fast(struct swap_info_struct *sis,
3925 goto err_out; 3925 goto err_out;
3926 3926
3927 pblock = map_bh.b_blocknr; 3927 pblock = map_bh.b_blocknr;
3928 nr_pblocks = logical_to_blk(inode, map_bh.b_size); 3928 nr_pblocks = bytes_to_blks(inode, map_bh.b_size);
3929 3929
3930 if (cur_lblock + nr_pblocks >= sis->max) 3930 if (cur_lblock + nr_pblocks >= sis->max)
3931 nr_pblocks = sis->max - cur_lblock; 3931 nr_pblocks = sis->max - cur_lblock;