data.c (2baf07818549c8bb8d7b3437e889b86eab56d38e) data.c (1e78e8bd9d107c351930cdb1e11202caec01b311)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * fs/f2fs/data.c
4 *
5 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
6 * http://www.samsung.com/
7 */
8#include <linux/fs.h>

--- 1039 unchanged lines hidden (view full) ---

1048 end = pgofs + maxblocks;
1049
1050 if (!create && f2fs_lookup_extent_cache(inode, pgofs, &ei)) {
1051 map->m_pblk = ei.blk + pgofs - ei.fofs;
1052 map->m_len = min((pgoff_t)maxblocks, ei.fofs + ei.len - pgofs);
1053 map->m_flags = F2FS_MAP_MAPPED;
1054 if (map->m_next_extent)
1055 *map->m_next_extent = pgofs + map->m_len;
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * fs/f2fs/data.c
4 *
5 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
6 * http://www.samsung.com/
7 */
8#include <linux/fs.h>

--- 1039 unchanged lines hidden (view full) ---

1048 end = pgofs + maxblocks;
1049
1050 if (!create && f2fs_lookup_extent_cache(inode, pgofs, &ei)) {
1051 map->m_pblk = ei.blk + pgofs - ei.fofs;
1052 map->m_len = min((pgoff_t)maxblocks, ei.fofs + ei.len - pgofs);
1053 map->m_flags = F2FS_MAP_MAPPED;
1054 if (map->m_next_extent)
1055 *map->m_next_extent = pgofs + map->m_len;
1056
1057 /* for hardware encryption, but to avoid potential issue in future */
1058 if (flag == F2FS_GET_BLOCK_DIO)
1059 f2fs_wait_on_block_writeback_range(inode,
1060 map->m_pblk, map->m_len);
1056 goto out;
1057 }
1058
1059next_dnode:
1060 if (create)
1061 __do_map_lock(sbi, flag, true);
1062
1063 /* When reading holes, we need its node page */

--- 142 unchanged lines hidden (view full) ---

1206
1207 if (create) {
1208 __do_map_lock(sbi, flag, false);
1209 f2fs_balance_fs(sbi, dn.node_changed);
1210 }
1211 goto next_dnode;
1212
1213sync_out:
1061 goto out;
1062 }
1063
1064next_dnode:
1065 if (create)
1066 __do_map_lock(sbi, flag, true);
1067
1068 /* When reading holes, we need its node page */

--- 142 unchanged lines hidden (view full) ---

1211
1212 if (create) {
1213 __do_map_lock(sbi, flag, false);
1214 f2fs_balance_fs(sbi, dn.node_changed);
1215 }
1216 goto next_dnode;
1217
1218sync_out:
1219
1220 /* for hardware encryption, but to avoid potential issue in future */
1221 if (flag == F2FS_GET_BLOCK_DIO && map->m_flags & F2FS_MAP_MAPPED)
1222 f2fs_wait_on_block_writeback_range(inode,
1223 map->m_pblk, map->m_len);
1224
1214 if (flag == F2FS_GET_BLOCK_PRECACHE) {
1215 if (map->m_flags & F2FS_MAP_MAPPED) {
1216 unsigned int ofs = start_pgofs - map->m_lblk;
1217
1218 f2fs_update_extent_cache_range(&dn,
1219 start_pgofs, map->m_pblk + ofs,
1220 map->m_len - ofs);
1221 }

--- 1585 unchanged lines hidden ---
1225 if (flag == F2FS_GET_BLOCK_PRECACHE) {
1226 if (map->m_flags & F2FS_MAP_MAPPED) {
1227 unsigned int ofs = start_pgofs - map->m_lblk;
1228
1229 f2fs_update_extent_cache_range(&dn,
1230 start_pgofs, map->m_pblk + ofs,
1231 map->m_len - ofs);
1232 }

--- 1585 unchanged lines hidden ---