Jaegeuk Kim | 0a8165d | 2012-11-29 13:28:09 +0900 | [diff] [blame] | 1 | /* |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 2 | * fs/f2fs/data.c |
| 3 | * |
| 4 | * Copyright (c) 2012 Samsung Electronics Co., Ltd. |
| 5 | * http://www.samsung.com/ |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as |
| 9 | * published by the Free Software Foundation. |
| 10 | */ |
| 11 | #include <linux/fs.h> |
| 12 | #include <linux/f2fs_fs.h> |
| 13 | #include <linux/buffer_head.h> |
| 14 | #include <linux/mpage.h> |
Kent Overstreet | a27bb33 | 2013-05-07 16:19:08 -0700 | [diff] [blame] | 15 | #include <linux/aio.h> |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 16 | #include <linux/writeback.h> |
| 17 | #include <linux/backing-dev.h> |
| 18 | #include <linux/blkdev.h> |
| 19 | #include <linux/bio.h> |
Geert Uytterhoeven | 690e4a3 | 2012-12-19 22:19:30 +0100 | [diff] [blame] | 20 | #include <linux/prefetch.h> |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 21 | |
| 22 | #include "f2fs.h" |
| 23 | #include "node.h" |
| 24 | #include "segment.h" |
Namjae Jeon | 848753a | 2013-04-23 16:38:02 +0900 | [diff] [blame] | 25 | #include <trace/events/f2fs.h> |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 26 | |
Jaegeuk Kim | 0a8165d | 2012-11-29 13:28:09 +0900 | [diff] [blame] | 27 | /* |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 28 | * Lock ordering for the change of data block address: |
| 29 | * ->data_page |
| 30 | * ->node_page |
| 31 | * update block addresses in the node page |
| 32 | */ |
| 33 | static void __set_data_blkaddr(struct dnode_of_data *dn, block_t new_addr) |
| 34 | { |
| 35 | struct f2fs_node *rn; |
| 36 | __le32 *addr_array; |
| 37 | struct page *node_page = dn->node_page; |
| 38 | unsigned int ofs_in_node = dn->ofs_in_node; |
| 39 | |
| 40 | wait_on_page_writeback(node_page); |
| 41 | |
| 42 | rn = (struct f2fs_node *)page_address(node_page); |
| 43 | |
| 44 | /* Get physical address of data block */ |
| 45 | addr_array = blkaddr_in_node(rn); |
| 46 | addr_array[ofs_in_node] = cpu_to_le32(new_addr); |
| 47 | set_page_dirty(node_page); |
| 48 | } |
| 49 | |
| 50 | int reserve_new_block(struct dnode_of_data *dn) |
| 51 | { |
| 52 | struct f2fs_sb_info *sbi = F2FS_SB(dn->inode->i_sb); |
| 53 | |
| 54 | if (is_inode_flag_set(F2FS_I(dn->inode), FI_NO_ALLOC)) |
| 55 | return -EPERM; |
| 56 | if (!inc_valid_block_count(sbi, dn->inode, 1)) |
| 57 | return -ENOSPC; |
| 58 | |
Namjae Jeon | c01e285 | 2013-04-23 17:00:52 +0900 | [diff] [blame] | 59 | trace_f2fs_reserve_new_block(dn->inode, dn->nid, dn->ofs_in_node); |
| 60 | |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 61 | __set_data_blkaddr(dn, NEW_ADDR); |
| 62 | dn->data_blkaddr = NEW_ADDR; |
| 63 | sync_inode_page(dn); |
| 64 | return 0; |
| 65 | } |
| 66 | |
| 67 | static int check_extent_cache(struct inode *inode, pgoff_t pgofs, |
| 68 | struct buffer_head *bh_result) |
| 69 | { |
| 70 | struct f2fs_inode_info *fi = F2FS_I(inode); |
| 71 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); |
| 72 | pgoff_t start_fofs, end_fofs; |
| 73 | block_t start_blkaddr; |
| 74 | |
| 75 | read_lock(&fi->ext.ext_lock); |
| 76 | if (fi->ext.len == 0) { |
| 77 | read_unlock(&fi->ext.ext_lock); |
| 78 | return 0; |
| 79 | } |
| 80 | |
| 81 | sbi->total_hit_ext++; |
| 82 | start_fofs = fi->ext.fofs; |
| 83 | end_fofs = fi->ext.fofs + fi->ext.len - 1; |
| 84 | start_blkaddr = fi->ext.blk_addr; |
| 85 | |
| 86 | if (pgofs >= start_fofs && pgofs <= end_fofs) { |
| 87 | unsigned int blkbits = inode->i_sb->s_blocksize_bits; |
| 88 | size_t count; |
| 89 | |
| 90 | clear_buffer_new(bh_result); |
| 91 | map_bh(bh_result, inode->i_sb, |
| 92 | start_blkaddr + pgofs - start_fofs); |
| 93 | count = end_fofs - pgofs + 1; |
| 94 | if (count < (UINT_MAX >> blkbits)) |
| 95 | bh_result->b_size = (count << blkbits); |
| 96 | else |
| 97 | bh_result->b_size = UINT_MAX; |
| 98 | |
| 99 | sbi->read_hit_ext++; |
| 100 | read_unlock(&fi->ext.ext_lock); |
| 101 | return 1; |
| 102 | } |
| 103 | read_unlock(&fi->ext.ext_lock); |
| 104 | return 0; |
| 105 | } |
| 106 | |
| 107 | void update_extent_cache(block_t blk_addr, struct dnode_of_data *dn) |
| 108 | { |
| 109 | struct f2fs_inode_info *fi = F2FS_I(dn->inode); |
| 110 | pgoff_t fofs, start_fofs, end_fofs; |
| 111 | block_t start_blkaddr, end_blkaddr; |
| 112 | |
| 113 | BUG_ON(blk_addr == NEW_ADDR); |
| 114 | fofs = start_bidx_of_node(ofs_of_node(dn->node_page)) + dn->ofs_in_node; |
| 115 | |
| 116 | /* Update the page address in the parent node */ |
| 117 | __set_data_blkaddr(dn, blk_addr); |
| 118 | |
| 119 | write_lock(&fi->ext.ext_lock); |
| 120 | |
| 121 | start_fofs = fi->ext.fofs; |
| 122 | end_fofs = fi->ext.fofs + fi->ext.len - 1; |
| 123 | start_blkaddr = fi->ext.blk_addr; |
| 124 | end_blkaddr = fi->ext.blk_addr + fi->ext.len - 1; |
| 125 | |
| 126 | /* Drop and initialize the matched extent */ |
| 127 | if (fi->ext.len == 1 && fofs == start_fofs) |
| 128 | fi->ext.len = 0; |
| 129 | |
| 130 | /* Initial extent */ |
| 131 | if (fi->ext.len == 0) { |
| 132 | if (blk_addr != NULL_ADDR) { |
| 133 | fi->ext.fofs = fofs; |
| 134 | fi->ext.blk_addr = blk_addr; |
| 135 | fi->ext.len = 1; |
| 136 | } |
| 137 | goto end_update; |
| 138 | } |
| 139 | |
Namjae Jeon | 6224da8 | 2013-04-06 14:44:32 +0900 | [diff] [blame] | 140 | /* Front merge */ |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 141 | if (fofs == start_fofs - 1 && blk_addr == start_blkaddr - 1) { |
| 142 | fi->ext.fofs--; |
| 143 | fi->ext.blk_addr--; |
| 144 | fi->ext.len++; |
| 145 | goto end_update; |
| 146 | } |
| 147 | |
| 148 | /* Back merge */ |
| 149 | if (fofs == end_fofs + 1 && blk_addr == end_blkaddr + 1) { |
| 150 | fi->ext.len++; |
| 151 | goto end_update; |
| 152 | } |
| 153 | |
| 154 | /* Split the existing extent */ |
| 155 | if (fi->ext.len > 1 && |
| 156 | fofs >= start_fofs && fofs <= end_fofs) { |
| 157 | if ((end_fofs - fofs) < (fi->ext.len >> 1)) { |
| 158 | fi->ext.len = fofs - start_fofs; |
| 159 | } else { |
| 160 | fi->ext.fofs = fofs + 1; |
| 161 | fi->ext.blk_addr = start_blkaddr + |
| 162 | fofs - start_fofs + 1; |
| 163 | fi->ext.len -= fofs - start_fofs + 1; |
| 164 | } |
| 165 | goto end_update; |
| 166 | } |
| 167 | write_unlock(&fi->ext.ext_lock); |
| 168 | return; |
| 169 | |
| 170 | end_update: |
| 171 | write_unlock(&fi->ext.ext_lock); |
| 172 | sync_inode_page(dn); |
| 173 | return; |
| 174 | } |
| 175 | |
Jaegeuk Kim | c718379b | 2013-04-24 13:19:56 +0900 | [diff] [blame] | 176 | struct page *find_data_page(struct inode *inode, pgoff_t index, bool sync) |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 177 | { |
| 178 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); |
| 179 | struct address_space *mapping = inode->i_mapping; |
| 180 | struct dnode_of_data dn; |
| 181 | struct page *page; |
| 182 | int err; |
| 183 | |
| 184 | page = find_get_page(mapping, index); |
| 185 | if (page && PageUptodate(page)) |
| 186 | return page; |
| 187 | f2fs_put_page(page, 0); |
| 188 | |
| 189 | set_new_dnode(&dn, inode, NULL, NULL, 0); |
Jaegeuk Kim | 266e97a | 2013-02-26 13:10:46 +0900 | [diff] [blame] | 190 | err = get_dnode_of_data(&dn, index, LOOKUP_NODE); |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 191 | if (err) |
| 192 | return ERR_PTR(err); |
| 193 | f2fs_put_dnode(&dn); |
| 194 | |
| 195 | if (dn.data_blkaddr == NULL_ADDR) |
| 196 | return ERR_PTR(-ENOENT); |
| 197 | |
| 198 | /* By fallocate(), there is no cached page, but with NEW_ADDR */ |
| 199 | if (dn.data_blkaddr == NEW_ADDR) |
| 200 | return ERR_PTR(-EINVAL); |
| 201 | |
| 202 | page = grab_cache_page(mapping, index); |
| 203 | if (!page) |
| 204 | return ERR_PTR(-ENOMEM); |
| 205 | |
Jaegeuk Kim | 393ff91 | 2013-03-08 21:29:23 +0900 | [diff] [blame] | 206 | if (PageUptodate(page)) { |
| 207 | unlock_page(page); |
| 208 | return page; |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 209 | } |
Jaegeuk Kim | 393ff91 | 2013-03-08 21:29:23 +0900 | [diff] [blame] | 210 | |
Jaegeuk Kim | c718379b | 2013-04-24 13:19:56 +0900 | [diff] [blame] | 211 | err = f2fs_readpage(sbi, page, dn.data_blkaddr, |
| 212 | sync ? READ_SYNC : READA); |
| 213 | if (sync) { |
| 214 | wait_on_page_locked(page); |
| 215 | if (!PageUptodate(page)) { |
| 216 | f2fs_put_page(page, 0); |
| 217 | return ERR_PTR(-EIO); |
| 218 | } |
Jaegeuk Kim | 393ff91 | 2013-03-08 21:29:23 +0900 | [diff] [blame] | 219 | } |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 220 | return page; |
| 221 | } |
| 222 | |
Jaegeuk Kim | 0a8165d | 2012-11-29 13:28:09 +0900 | [diff] [blame] | 223 | /* |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 224 | * If it tries to access a hole, return an error. |
| 225 | * Because, the callers, functions in dir.c and GC, should be able to know |
| 226 | * whether this page exists or not. |
| 227 | */ |
| 228 | struct page *get_lock_data_page(struct inode *inode, pgoff_t index) |
| 229 | { |
| 230 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); |
| 231 | struct address_space *mapping = inode->i_mapping; |
| 232 | struct dnode_of_data dn; |
| 233 | struct page *page; |
| 234 | int err; |
| 235 | |
Jaegeuk Kim | afcb7ca0 | 2013-04-26 11:55:17 +0900 | [diff] [blame] | 236 | repeat: |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 237 | page = grab_cache_page(mapping, index); |
| 238 | if (!page) |
| 239 | return ERR_PTR(-ENOMEM); |
| 240 | |
Jaegeuk Kim | 650495d | 2013-05-13 08:38:35 +0900 | [diff] [blame^] | 241 | set_new_dnode(&dn, inode, NULL, NULL, 0); |
| 242 | err = get_dnode_of_data(&dn, index, LOOKUP_NODE); |
| 243 | if (err) { |
| 244 | f2fs_put_page(page, 1); |
| 245 | return ERR_PTR(err); |
| 246 | } |
| 247 | f2fs_put_dnode(&dn); |
| 248 | |
| 249 | if (dn.data_blkaddr == NULL_ADDR) { |
| 250 | f2fs_put_page(page, 1); |
| 251 | return ERR_PTR(-ENOENT); |
| 252 | } |
| 253 | |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 254 | if (PageUptodate(page)) |
| 255 | return page; |
| 256 | |
| 257 | BUG_ON(dn.data_blkaddr == NEW_ADDR); |
| 258 | BUG_ON(dn.data_blkaddr == NULL_ADDR); |
| 259 | |
| 260 | err = f2fs_readpage(sbi, page, dn.data_blkaddr, READ_SYNC); |
Jaegeuk Kim | 393ff91 | 2013-03-08 21:29:23 +0900 | [diff] [blame] | 261 | if (err) |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 262 | return ERR_PTR(err); |
Jaegeuk Kim | 393ff91 | 2013-03-08 21:29:23 +0900 | [diff] [blame] | 263 | |
| 264 | lock_page(page); |
| 265 | if (!PageUptodate(page)) { |
| 266 | f2fs_put_page(page, 1); |
| 267 | return ERR_PTR(-EIO); |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 268 | } |
Jaegeuk Kim | afcb7ca0 | 2013-04-26 11:55:17 +0900 | [diff] [blame] | 269 | if (page->mapping != mapping) { |
| 270 | f2fs_put_page(page, 1); |
| 271 | goto repeat; |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 272 | } |
| 273 | return page; |
| 274 | } |
| 275 | |
Jaegeuk Kim | 0a8165d | 2012-11-29 13:28:09 +0900 | [diff] [blame] | 276 | /* |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 277 | * Caller ensures that this data page is never allocated. |
| 278 | * A new zero-filled data page is allocated in the page cache. |
Jaegeuk Kim | 3993683 | 2012-11-22 16:21:29 +0900 | [diff] [blame] | 279 | * |
| 280 | * Also, caller should grab and release a mutex by calling mutex_lock_op() and |
| 281 | * mutex_unlock_op(). |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 282 | */ |
| 283 | struct page *get_new_data_page(struct inode *inode, pgoff_t index, |
| 284 | bool new_i_size) |
| 285 | { |
| 286 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); |
| 287 | struct address_space *mapping = inode->i_mapping; |
| 288 | struct page *page; |
| 289 | struct dnode_of_data dn; |
| 290 | int err; |
| 291 | |
| 292 | set_new_dnode(&dn, inode, NULL, NULL, 0); |
Jaegeuk Kim | 266e97a | 2013-02-26 13:10:46 +0900 | [diff] [blame] | 293 | err = get_dnode_of_data(&dn, index, ALLOC_NODE); |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 294 | if (err) |
| 295 | return ERR_PTR(err); |
| 296 | |
| 297 | if (dn.data_blkaddr == NULL_ADDR) { |
| 298 | if (reserve_new_block(&dn)) { |
| 299 | f2fs_put_dnode(&dn); |
| 300 | return ERR_PTR(-ENOSPC); |
| 301 | } |
| 302 | } |
| 303 | f2fs_put_dnode(&dn); |
Jaegeuk Kim | afcb7ca0 | 2013-04-26 11:55:17 +0900 | [diff] [blame] | 304 | repeat: |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 305 | page = grab_cache_page(mapping, index); |
| 306 | if (!page) |
| 307 | return ERR_PTR(-ENOMEM); |
| 308 | |
| 309 | if (PageUptodate(page)) |
| 310 | return page; |
| 311 | |
| 312 | if (dn.data_blkaddr == NEW_ADDR) { |
| 313 | zero_user_segment(page, 0, PAGE_CACHE_SIZE); |
Jaegeuk Kim | 393ff91 | 2013-03-08 21:29:23 +0900 | [diff] [blame] | 314 | SetPageUptodate(page); |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 315 | } else { |
| 316 | err = f2fs_readpage(sbi, page, dn.data_blkaddr, READ_SYNC); |
Jaegeuk Kim | 393ff91 | 2013-03-08 21:29:23 +0900 | [diff] [blame] | 317 | if (err) |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 318 | return ERR_PTR(err); |
Jaegeuk Kim | 393ff91 | 2013-03-08 21:29:23 +0900 | [diff] [blame] | 319 | lock_page(page); |
| 320 | if (!PageUptodate(page)) { |
| 321 | f2fs_put_page(page, 1); |
| 322 | return ERR_PTR(-EIO); |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 323 | } |
Jaegeuk Kim | afcb7ca0 | 2013-04-26 11:55:17 +0900 | [diff] [blame] | 324 | if (page->mapping != mapping) { |
| 325 | f2fs_put_page(page, 1); |
| 326 | goto repeat; |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 327 | } |
| 328 | } |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 329 | |
| 330 | if (new_i_size && |
| 331 | i_size_read(inode) < ((index + 1) << PAGE_CACHE_SHIFT)) { |
| 332 | i_size_write(inode, ((index + 1) << PAGE_CACHE_SHIFT)); |
| 333 | mark_inode_dirty_sync(inode); |
| 334 | } |
| 335 | return page; |
| 336 | } |
| 337 | |
| 338 | static void read_end_io(struct bio *bio, int err) |
| 339 | { |
| 340 | const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); |
| 341 | struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1; |
| 342 | |
| 343 | do { |
| 344 | struct page *page = bvec->bv_page; |
| 345 | |
| 346 | if (--bvec >= bio->bi_io_vec) |
| 347 | prefetchw(&bvec->bv_page->flags); |
| 348 | |
| 349 | if (uptodate) { |
| 350 | SetPageUptodate(page); |
| 351 | } else { |
| 352 | ClearPageUptodate(page); |
| 353 | SetPageError(page); |
| 354 | } |
| 355 | unlock_page(page); |
| 356 | } while (bvec >= bio->bi_io_vec); |
| 357 | kfree(bio->bi_private); |
| 358 | bio_put(bio); |
| 359 | } |
| 360 | |
Jaegeuk Kim | 0a8165d | 2012-11-29 13:28:09 +0900 | [diff] [blame] | 361 | /* |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 362 | * Fill the locked page with data located in the block address. |
Jaegeuk Kim | 393ff91 | 2013-03-08 21:29:23 +0900 | [diff] [blame] | 363 | * Return unlocked page. |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 364 | */ |
| 365 | int f2fs_readpage(struct f2fs_sb_info *sbi, struct page *page, |
| 366 | block_t blk_addr, int type) |
| 367 | { |
| 368 | struct block_device *bdev = sbi->sb->s_bdev; |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 369 | struct bio *bio; |
| 370 | |
Namjae Jeon | 848753a | 2013-04-23 16:38:02 +0900 | [diff] [blame] | 371 | trace_f2fs_readpage(page, blk_addr, type); |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 372 | |
| 373 | down_read(&sbi->bio_sem); |
| 374 | |
| 375 | /* Allocate a new bio */ |
Jaegeuk Kim | 3cd8a23 | 2012-12-10 09:26:05 +0900 | [diff] [blame] | 376 | bio = f2fs_bio_alloc(bdev, 1); |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 377 | |
| 378 | /* Initialize the bio */ |
Jaegeuk Kim | 3cd8a23 | 2012-12-10 09:26:05 +0900 | [diff] [blame] | 379 | bio->bi_sector = SECTOR_FROM_BLOCK(sbi, blk_addr); |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 380 | bio->bi_end_io = read_end_io; |
Jaegeuk Kim | 3cd8a23 | 2012-12-10 09:26:05 +0900 | [diff] [blame] | 381 | |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 382 | if (bio_add_page(bio, page, PAGE_CACHE_SIZE, 0) < PAGE_CACHE_SIZE) { |
| 383 | kfree(bio->bi_private); |
| 384 | bio_put(bio); |
| 385 | up_read(&sbi->bio_sem); |
Jaegeuk Kim | 393ff91 | 2013-03-08 21:29:23 +0900 | [diff] [blame] | 386 | f2fs_put_page(page, 1); |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 387 | return -EFAULT; |
| 388 | } |
| 389 | |
| 390 | submit_bio(type, bio); |
| 391 | up_read(&sbi->bio_sem); |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 392 | return 0; |
| 393 | } |
| 394 | |
Jaegeuk Kim | 0a8165d | 2012-11-29 13:28:09 +0900 | [diff] [blame] | 395 | /* |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 396 | * This function should be used by the data read flow only where it |
| 397 | * does not check the "create" flag that indicates block allocation. |
| 398 | * The reason for this special functionality is to exploit VFS readahead |
| 399 | * mechanism. |
| 400 | */ |
| 401 | static int get_data_block_ro(struct inode *inode, sector_t iblock, |
| 402 | struct buffer_head *bh_result, int create) |
| 403 | { |
| 404 | unsigned int blkbits = inode->i_sb->s_blocksize_bits; |
| 405 | unsigned maxblocks = bh_result->b_size >> blkbits; |
| 406 | struct dnode_of_data dn; |
| 407 | pgoff_t pgofs; |
| 408 | int err; |
| 409 | |
| 410 | /* Get the page offset from the block offset(iblock) */ |
| 411 | pgofs = (pgoff_t)(iblock >> (PAGE_CACHE_SHIFT - blkbits)); |
| 412 | |
Namjae Jeon | 848753a | 2013-04-23 16:38:02 +0900 | [diff] [blame] | 413 | if (check_extent_cache(inode, pgofs, bh_result)) { |
| 414 | trace_f2fs_get_data_block(inode, iblock, bh_result, 0); |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 415 | return 0; |
Namjae Jeon | 848753a | 2013-04-23 16:38:02 +0900 | [diff] [blame] | 416 | } |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 417 | |
| 418 | /* When reading holes, we need its node page */ |
| 419 | set_new_dnode(&dn, inode, NULL, NULL, 0); |
Jaegeuk Kim | 266e97a | 2013-02-26 13:10:46 +0900 | [diff] [blame] | 420 | err = get_dnode_of_data(&dn, pgofs, LOOKUP_NODE_RA); |
Namjae Jeon | 848753a | 2013-04-23 16:38:02 +0900 | [diff] [blame] | 421 | if (err) { |
| 422 | trace_f2fs_get_data_block(inode, iblock, bh_result, err); |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 423 | return (err == -ENOENT) ? 0 : err; |
Namjae Jeon | 848753a | 2013-04-23 16:38:02 +0900 | [diff] [blame] | 424 | } |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 425 | |
| 426 | /* It does not support data allocation */ |
| 427 | BUG_ON(create); |
| 428 | |
| 429 | if (dn.data_blkaddr != NEW_ADDR && dn.data_blkaddr != NULL_ADDR) { |
| 430 | int i; |
| 431 | unsigned int end_offset; |
| 432 | |
| 433 | end_offset = IS_INODE(dn.node_page) ? |
| 434 | ADDRS_PER_INODE : |
| 435 | ADDRS_PER_BLOCK; |
| 436 | |
| 437 | clear_buffer_new(bh_result); |
| 438 | |
| 439 | /* Give more consecutive addresses for the read ahead */ |
| 440 | for (i = 0; i < end_offset - dn.ofs_in_node; i++) |
| 441 | if (((datablock_addr(dn.node_page, |
| 442 | dn.ofs_in_node + i)) |
| 443 | != (dn.data_blkaddr + i)) || maxblocks == i) |
| 444 | break; |
| 445 | map_bh(bh_result, inode->i_sb, dn.data_blkaddr); |
| 446 | bh_result->b_size = (i << blkbits); |
| 447 | } |
| 448 | f2fs_put_dnode(&dn); |
Namjae Jeon | 848753a | 2013-04-23 16:38:02 +0900 | [diff] [blame] | 449 | trace_f2fs_get_data_block(inode, iblock, bh_result, 0); |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 450 | return 0; |
| 451 | } |
| 452 | |
| 453 | static int f2fs_read_data_page(struct file *file, struct page *page) |
| 454 | { |
| 455 | return mpage_readpage(page, get_data_block_ro); |
| 456 | } |
| 457 | |
| 458 | static int f2fs_read_data_pages(struct file *file, |
| 459 | struct address_space *mapping, |
| 460 | struct list_head *pages, unsigned nr_pages) |
| 461 | { |
| 462 | return mpage_readpages(mapping, pages, nr_pages, get_data_block_ro); |
| 463 | } |
| 464 | |
| 465 | int do_write_data_page(struct page *page) |
| 466 | { |
| 467 | struct inode *inode = page->mapping->host; |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 468 | block_t old_blk_addr, new_blk_addr; |
| 469 | struct dnode_of_data dn; |
| 470 | int err = 0; |
| 471 | |
| 472 | set_new_dnode(&dn, inode, NULL, NULL, 0); |
Jaegeuk Kim | 266e97a | 2013-02-26 13:10:46 +0900 | [diff] [blame] | 473 | err = get_dnode_of_data(&dn, page->index, LOOKUP_NODE); |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 474 | if (err) |
| 475 | return err; |
| 476 | |
| 477 | old_blk_addr = dn.data_blkaddr; |
| 478 | |
| 479 | /* This page is already truncated */ |
| 480 | if (old_blk_addr == NULL_ADDR) |
| 481 | goto out_writepage; |
| 482 | |
| 483 | set_page_writeback(page); |
| 484 | |
| 485 | /* |
| 486 | * If current allocation needs SSR, |
| 487 | * it had better in-place writes for updated data. |
| 488 | */ |
| 489 | if (old_blk_addr != NEW_ADDR && !is_cold_data(page) && |
| 490 | need_inplace_update(inode)) { |
| 491 | rewrite_data_page(F2FS_SB(inode->i_sb), page, |
| 492 | old_blk_addr); |
| 493 | } else { |
| 494 | write_data_page(inode, page, &dn, |
| 495 | old_blk_addr, &new_blk_addr); |
| 496 | update_extent_cache(new_blk_addr, &dn); |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 497 | } |
| 498 | out_writepage: |
| 499 | f2fs_put_dnode(&dn); |
| 500 | return err; |
| 501 | } |
| 502 | |
| 503 | static int f2fs_write_data_page(struct page *page, |
| 504 | struct writeback_control *wbc) |
| 505 | { |
| 506 | struct inode *inode = page->mapping->host; |
| 507 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); |
| 508 | loff_t i_size = i_size_read(inode); |
| 509 | const pgoff_t end_index = ((unsigned long long) i_size) |
| 510 | >> PAGE_CACHE_SHIFT; |
| 511 | unsigned offset; |
Jaegeuk Kim | 3993683 | 2012-11-22 16:21:29 +0900 | [diff] [blame] | 512 | bool need_balance_fs = false; |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 513 | int err = 0; |
| 514 | |
| 515 | if (page->index < end_index) |
Jaegeuk Kim | 3993683 | 2012-11-22 16:21:29 +0900 | [diff] [blame] | 516 | goto write; |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 517 | |
| 518 | /* |
| 519 | * If the offset is out-of-range of file size, |
| 520 | * this page does not have to be written to disk. |
| 521 | */ |
| 522 | offset = i_size & (PAGE_CACHE_SIZE - 1); |
| 523 | if ((page->index >= end_index + 1) || !offset) { |
| 524 | if (S_ISDIR(inode->i_mode)) { |
| 525 | dec_page_count(sbi, F2FS_DIRTY_DENTS); |
| 526 | inode_dec_dirty_dents(inode); |
| 527 | } |
Jaegeuk Kim | 3993683 | 2012-11-22 16:21:29 +0900 | [diff] [blame] | 528 | goto out; |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 529 | } |
| 530 | |
| 531 | zero_user_segment(page, offset, PAGE_CACHE_SIZE); |
Jaegeuk Kim | 3993683 | 2012-11-22 16:21:29 +0900 | [diff] [blame] | 532 | write: |
| 533 | if (sbi->por_doing) { |
| 534 | err = AOP_WRITEPAGE_ACTIVATE; |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 535 | goto redirty_out; |
Jaegeuk Kim | 3993683 | 2012-11-22 16:21:29 +0900 | [diff] [blame] | 536 | } |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 537 | |
Jaegeuk Kim | 3993683 | 2012-11-22 16:21:29 +0900 | [diff] [blame] | 538 | /* Dentry blocks are controlled by checkpoint */ |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 539 | if (S_ISDIR(inode->i_mode)) { |
| 540 | dec_page_count(sbi, F2FS_DIRTY_DENTS); |
| 541 | inode_dec_dirty_dents(inode); |
Jaegeuk Kim | 3993683 | 2012-11-22 16:21:29 +0900 | [diff] [blame] | 542 | err = do_write_data_page(page); |
| 543 | } else { |
| 544 | int ilock = mutex_lock_op(sbi); |
| 545 | err = do_write_data_page(page); |
| 546 | mutex_unlock_op(sbi, ilock); |
| 547 | need_balance_fs = true; |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 548 | } |
Jaegeuk Kim | 3993683 | 2012-11-22 16:21:29 +0900 | [diff] [blame] | 549 | if (err == -ENOENT) |
| 550 | goto out; |
| 551 | else if (err) |
| 552 | goto redirty_out; |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 553 | |
| 554 | if (wbc->for_reclaim) |
| 555 | f2fs_submit_bio(sbi, DATA, true); |
| 556 | |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 557 | clear_cold_data(page); |
Jaegeuk Kim | 3993683 | 2012-11-22 16:21:29 +0900 | [diff] [blame] | 558 | out: |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 559 | unlock_page(page); |
Jaegeuk Kim | 3993683 | 2012-11-22 16:21:29 +0900 | [diff] [blame] | 560 | if (need_balance_fs) |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 561 | f2fs_balance_fs(sbi); |
| 562 | return 0; |
| 563 | |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 564 | redirty_out: |
| 565 | wbc->pages_skipped++; |
| 566 | set_page_dirty(page); |
Jaegeuk Kim | 3993683 | 2012-11-22 16:21:29 +0900 | [diff] [blame] | 567 | return err; |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 568 | } |
| 569 | |
| 570 | #define MAX_DESIRED_PAGES_WP 4096 |
| 571 | |
Namjae Jeon | fa9150a | 2013-01-15 16:45:24 +0900 | [diff] [blame] | 572 | static int __f2fs_writepage(struct page *page, struct writeback_control *wbc, |
| 573 | void *data) |
| 574 | { |
| 575 | struct address_space *mapping = data; |
| 576 | int ret = mapping->a_ops->writepage(page, wbc); |
| 577 | mapping_set_error(mapping, ret); |
| 578 | return ret; |
| 579 | } |
| 580 | |
Jaegeuk Kim | 25ca923 | 2012-11-28 16:12:41 +0900 | [diff] [blame] | 581 | static int f2fs_write_data_pages(struct address_space *mapping, |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 582 | struct writeback_control *wbc) |
| 583 | { |
| 584 | struct inode *inode = mapping->host; |
| 585 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); |
Jaegeuk Kim | 531ad7d | 2013-04-30 11:33:27 +0900 | [diff] [blame] | 586 | bool locked = false; |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 587 | int ret; |
| 588 | long excess_nrtw = 0, desired_nrtw; |
| 589 | |
P J P | cfb185a | 2013-04-03 11:38:00 +0900 | [diff] [blame] | 590 | /* deal with chardevs and other special file */ |
| 591 | if (!mapping->a_ops->writepage) |
| 592 | return 0; |
| 593 | |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 594 | if (wbc->nr_to_write < MAX_DESIRED_PAGES_WP) { |
| 595 | desired_nrtw = MAX_DESIRED_PAGES_WP; |
| 596 | excess_nrtw = desired_nrtw - wbc->nr_to_write; |
| 597 | wbc->nr_to_write = desired_nrtw; |
| 598 | } |
| 599 | |
Jaegeuk Kim | 531ad7d | 2013-04-30 11:33:27 +0900 | [diff] [blame] | 600 | if (!S_ISDIR(inode->i_mode)) { |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 601 | mutex_lock(&sbi->writepages); |
Jaegeuk Kim | 531ad7d | 2013-04-30 11:33:27 +0900 | [diff] [blame] | 602 | locked = true; |
| 603 | } |
Namjae Jeon | fa9150a | 2013-01-15 16:45:24 +0900 | [diff] [blame] | 604 | ret = write_cache_pages(mapping, wbc, __f2fs_writepage, mapping); |
Jaegeuk Kim | 531ad7d | 2013-04-30 11:33:27 +0900 | [diff] [blame] | 605 | if (locked) |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 606 | mutex_unlock(&sbi->writepages); |
| 607 | f2fs_submit_bio(sbi, DATA, (wbc->sync_mode == WB_SYNC_ALL)); |
| 608 | |
| 609 | remove_dirty_dir_inode(inode); |
| 610 | |
| 611 | wbc->nr_to_write -= excess_nrtw; |
| 612 | return ret; |
| 613 | } |
| 614 | |
| 615 | static int f2fs_write_begin(struct file *file, struct address_space *mapping, |
| 616 | loff_t pos, unsigned len, unsigned flags, |
| 617 | struct page **pagep, void **fsdata) |
| 618 | { |
| 619 | struct inode *inode = mapping->host; |
| 620 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); |
| 621 | struct page *page; |
| 622 | pgoff_t index = ((unsigned long long) pos) >> PAGE_CACHE_SHIFT; |
| 623 | struct dnode_of_data dn; |
| 624 | int err = 0; |
Jaegeuk Kim | 3993683 | 2012-11-22 16:21:29 +0900 | [diff] [blame] | 625 | int ilock; |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 626 | |
| 627 | /* for nobh_write_end */ |
| 628 | *fsdata = NULL; |
| 629 | |
| 630 | f2fs_balance_fs(sbi); |
Jaegeuk Kim | afcb7ca0 | 2013-04-26 11:55:17 +0900 | [diff] [blame] | 631 | repeat: |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 632 | page = grab_cache_page_write_begin(mapping, index, flags); |
| 633 | if (!page) |
| 634 | return -ENOMEM; |
| 635 | *pagep = page; |
| 636 | |
Jaegeuk Kim | 3993683 | 2012-11-22 16:21:29 +0900 | [diff] [blame] | 637 | ilock = mutex_lock_op(sbi); |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 638 | |
| 639 | set_new_dnode(&dn, inode, NULL, NULL, 0); |
Jaegeuk Kim | 266e97a | 2013-02-26 13:10:46 +0900 | [diff] [blame] | 640 | err = get_dnode_of_data(&dn, index, ALLOC_NODE); |
Jaegeuk Kim | 3993683 | 2012-11-22 16:21:29 +0900 | [diff] [blame] | 641 | if (err) |
| 642 | goto err; |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 643 | |
Jaegeuk Kim | 3993683 | 2012-11-22 16:21:29 +0900 | [diff] [blame] | 644 | if (dn.data_blkaddr == NULL_ADDR) |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 645 | err = reserve_new_block(&dn); |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 646 | |
Jaegeuk Kim | 3993683 | 2012-11-22 16:21:29 +0900 | [diff] [blame] | 647 | f2fs_put_dnode(&dn); |
| 648 | if (err) |
| 649 | goto err; |
| 650 | |
| 651 | mutex_unlock_op(sbi, ilock); |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 652 | |
| 653 | if ((len == PAGE_CACHE_SIZE) || PageUptodate(page)) |
| 654 | return 0; |
| 655 | |
| 656 | if ((pos & PAGE_CACHE_MASK) >= i_size_read(inode)) { |
| 657 | unsigned start = pos & (PAGE_CACHE_SIZE - 1); |
| 658 | unsigned end = start + len; |
| 659 | |
| 660 | /* Reading beyond i_size is simple: memset to zero */ |
| 661 | zero_user_segments(page, 0, start, end, PAGE_CACHE_SIZE); |
Jaegeuk Kim | 393ff91 | 2013-03-08 21:29:23 +0900 | [diff] [blame] | 662 | goto out; |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 663 | } |
| 664 | |
| 665 | if (dn.data_blkaddr == NEW_ADDR) { |
| 666 | zero_user_segment(page, 0, PAGE_CACHE_SIZE); |
| 667 | } else { |
| 668 | err = f2fs_readpage(sbi, page, dn.data_blkaddr, READ_SYNC); |
Jaegeuk Kim | 393ff91 | 2013-03-08 21:29:23 +0900 | [diff] [blame] | 669 | if (err) |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 670 | return err; |
Jaegeuk Kim | 393ff91 | 2013-03-08 21:29:23 +0900 | [diff] [blame] | 671 | lock_page(page); |
| 672 | if (!PageUptodate(page)) { |
| 673 | f2fs_put_page(page, 1); |
| 674 | return -EIO; |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 675 | } |
Jaegeuk Kim | afcb7ca0 | 2013-04-26 11:55:17 +0900 | [diff] [blame] | 676 | if (page->mapping != mapping) { |
| 677 | f2fs_put_page(page, 1); |
| 678 | goto repeat; |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 679 | } |
| 680 | } |
Jaegeuk Kim | 393ff91 | 2013-03-08 21:29:23 +0900 | [diff] [blame] | 681 | out: |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 682 | SetPageUptodate(page); |
| 683 | clear_cold_data(page); |
| 684 | return 0; |
Jaegeuk Kim | 3993683 | 2012-11-22 16:21:29 +0900 | [diff] [blame] | 685 | |
| 686 | err: |
| 687 | mutex_unlock_op(sbi, ilock); |
| 688 | f2fs_put_page(page, 1); |
| 689 | return err; |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 690 | } |
| 691 | |
| 692 | static ssize_t f2fs_direct_IO(int rw, struct kiocb *iocb, |
| 693 | const struct iovec *iov, loff_t offset, unsigned long nr_segs) |
| 694 | { |
| 695 | struct file *file = iocb->ki_filp; |
| 696 | struct inode *inode = file->f_mapping->host; |
| 697 | |
| 698 | if (rw == WRITE) |
| 699 | return 0; |
| 700 | |
| 701 | /* Needs synchronization with the cleaner */ |
| 702 | return blockdev_direct_IO(rw, iocb, inode, iov, offset, nr_segs, |
| 703 | get_data_block_ro); |
| 704 | } |
| 705 | |
| 706 | static void f2fs_invalidate_data_page(struct page *page, unsigned long offset) |
| 707 | { |
| 708 | struct inode *inode = page->mapping->host; |
| 709 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); |
| 710 | if (S_ISDIR(inode->i_mode) && PageDirty(page)) { |
| 711 | dec_page_count(sbi, F2FS_DIRTY_DENTS); |
| 712 | inode_dec_dirty_dents(inode); |
| 713 | } |
| 714 | ClearPagePrivate(page); |
| 715 | } |
| 716 | |
| 717 | static int f2fs_release_data_page(struct page *page, gfp_t wait) |
| 718 | { |
| 719 | ClearPagePrivate(page); |
Jaegeuk Kim | c3850aa | 2013-03-14 09:24:32 +0900 | [diff] [blame] | 720 | return 1; |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 721 | } |
| 722 | |
| 723 | static int f2fs_set_data_page_dirty(struct page *page) |
| 724 | { |
| 725 | struct address_space *mapping = page->mapping; |
| 726 | struct inode *inode = mapping->host; |
| 727 | |
| 728 | SetPageUptodate(page); |
| 729 | if (!PageDirty(page)) { |
| 730 | __set_page_dirty_nobuffers(page); |
| 731 | set_dirty_dir_page(inode, page); |
| 732 | return 1; |
| 733 | } |
| 734 | return 0; |
| 735 | } |
| 736 | |
Jaegeuk Kim | c01e54b | 2013-01-17 20:30:23 +0900 | [diff] [blame] | 737 | static sector_t f2fs_bmap(struct address_space *mapping, sector_t block) |
| 738 | { |
| 739 | return generic_block_bmap(mapping, block, get_data_block_ro); |
| 740 | } |
| 741 | |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 742 | const struct address_space_operations f2fs_dblock_aops = { |
| 743 | .readpage = f2fs_read_data_page, |
| 744 | .readpages = f2fs_read_data_pages, |
| 745 | .writepage = f2fs_write_data_page, |
| 746 | .writepages = f2fs_write_data_pages, |
| 747 | .write_begin = f2fs_write_begin, |
| 748 | .write_end = nobh_write_end, |
| 749 | .set_page_dirty = f2fs_set_data_page_dirty, |
| 750 | .invalidatepage = f2fs_invalidate_data_page, |
| 751 | .releasepage = f2fs_release_data_page, |
| 752 | .direct_IO = f2fs_direct_IO, |
Jaegeuk Kim | c01e54b | 2013-01-17 20:30:23 +0900 | [diff] [blame] | 753 | .bmap = f2fs_bmap, |
Jaegeuk Kim | eb47b80 | 2012-11-02 17:10:12 +0900 | [diff] [blame] | 754 | }; |