Jaegeuk Kim | 0a8165d | 2012-11-29 13:28:09 +0900 | [diff] [blame] | 1 | /* |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 2 | * fs/f2fs/file.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/stat.h> |
| 14 | #include <linux/buffer_head.h> |
| 15 | #include <linux/writeback.h> |
Jaegeuk Kim | ae51fb3 | 2013-03-16 11:13:04 +0900 | [diff] [blame] | 16 | #include <linux/blkdev.h> |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 17 | #include <linux/falloc.h> |
| 18 | #include <linux/types.h> |
Namjae Jeon | e975082 | 2013-02-04 23:41:41 +0900 | [diff] [blame] | 19 | #include <linux/compat.h> |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 20 | #include <linux/uaccess.h> |
| 21 | #include <linux/mount.h> |
| 22 | |
| 23 | #include "f2fs.h" |
| 24 | #include "node.h" |
| 25 | #include "segment.h" |
| 26 | #include "xattr.h" |
| 27 | #include "acl.h" |
Namjae Jeon | a2a4a7e | 2013-04-20 01:28:40 +0900 | [diff] [blame] | 28 | #include <trace/events/f2fs.h> |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 29 | |
| 30 | static int f2fs_vm_page_mkwrite(struct vm_area_struct *vma, |
| 31 | struct vm_fault *vmf) |
| 32 | { |
| 33 | struct page *page = vmf->page; |
Al Viro | 6131ffa | 2013-02-27 16:59:05 -0500 | [diff] [blame] | 34 | struct inode *inode = file_inode(vma->vm_file); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 35 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 36 | struct dnode_of_data dn; |
Gu Zheng | e479556 | 2013-09-27 18:08:30 +0800 | [diff] [blame] | 37 | int err; |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 38 | |
| 39 | f2fs_balance_fs(sbi); |
| 40 | |
| 41 | sb_start_pagefault(inode->i_sb); |
| 42 | |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 43 | /* block allocation */ |
Gu Zheng | e479556 | 2013-09-27 18:08:30 +0800 | [diff] [blame] | 44 | f2fs_lock_op(sbi); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 45 | set_new_dnode(&dn, inode, NULL, NULL, 0); |
Huajun Li | b600965 | 2013-11-10 23:13:18 +0800 | [diff] [blame] | 46 | err = f2fs_reserve_block(&dn, page->index); |
Gu Zheng | e479556 | 2013-09-27 18:08:30 +0800 | [diff] [blame] | 47 | f2fs_unlock_op(sbi); |
Huajun Li | b600965 | 2013-11-10 23:13:18 +0800 | [diff] [blame] | 48 | if (err) |
| 49 | goto out; |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 50 | |
Namjae Jeon | 9851e6e | 2013-04-28 09:04:18 +0900 | [diff] [blame] | 51 | file_update_time(vma->vm_file); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 52 | lock_page(page); |
Jaegeuk Kim | 6bacf52 | 2013-12-06 15:00:58 +0900 | [diff] [blame] | 53 | if (unlikely(page->mapping != inode->i_mapping || |
Namjae Jeon | 9851e6e | 2013-04-28 09:04:18 +0900 | [diff] [blame] | 54 | page_offset(page) > i_size_read(inode) || |
Jaegeuk Kim | 6bacf52 | 2013-12-06 15:00:58 +0900 | [diff] [blame] | 55 | !PageUptodate(page))) { |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 56 | unlock_page(page); |
| 57 | err = -EFAULT; |
| 58 | goto out; |
| 59 | } |
| 60 | |
| 61 | /* |
| 62 | * check to see if the page is mapped already (no holes) |
| 63 | */ |
| 64 | if (PageMappedToDisk(page)) |
Namjae Jeon | 9851e6e | 2013-04-28 09:04:18 +0900 | [diff] [blame] | 65 | goto mapped; |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 66 | |
| 67 | /* page is wholly or partially inside EOF */ |
| 68 | if (((page->index + 1) << PAGE_CACHE_SHIFT) > i_size_read(inode)) { |
| 69 | unsigned offset; |
| 70 | offset = i_size_read(inode) & ~PAGE_CACHE_MASK; |
| 71 | zero_user_segment(page, offset, PAGE_CACHE_SIZE); |
| 72 | } |
| 73 | set_page_dirty(page); |
| 74 | SetPageUptodate(page); |
| 75 | |
Jaegeuk Kim | e943a10 | 2013-10-25 14:26:31 +0900 | [diff] [blame] | 76 | trace_f2fs_vm_page_mkwrite(page, DATA); |
Namjae Jeon | 9851e6e | 2013-04-28 09:04:18 +0900 | [diff] [blame] | 77 | mapped: |
| 78 | /* fill the page */ |
| 79 | wait_on_page_writeback(page); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 80 | out: |
| 81 | sb_end_pagefault(inode->i_sb); |
| 82 | return block_page_mkwrite_return(err); |
| 83 | } |
| 84 | |
| 85 | static const struct vm_operations_struct f2fs_file_vm_ops = { |
Jaegeuk Kim | 692bb55 | 2013-01-17 18:37:41 +0900 | [diff] [blame] | 86 | .fault = filemap_fault, |
| 87 | .page_mkwrite = f2fs_vm_page_mkwrite, |
| 88 | .remap_pages = generic_file_remap_pages, |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 89 | }; |
| 90 | |
Jaegeuk Kim | 354a339 | 2013-06-14 08:52:35 +0900 | [diff] [blame] | 91 | static int get_parent_ino(struct inode *inode, nid_t *pino) |
| 92 | { |
| 93 | struct dentry *dentry; |
| 94 | |
| 95 | inode = igrab(inode); |
| 96 | dentry = d_find_any_alias(inode); |
| 97 | iput(inode); |
| 98 | if (!dentry) |
| 99 | return 0; |
| 100 | |
Jaegeuk Kim | f0947e5 | 2013-07-22 22:12:56 +0900 | [diff] [blame] | 101 | if (update_dent_inode(inode, &dentry->d_name)) { |
| 102 | dput(dentry); |
| 103 | return 0; |
| 104 | } |
Jaegeuk Kim | 354a339 | 2013-06-14 08:52:35 +0900 | [diff] [blame] | 105 | |
Jaegeuk Kim | f0947e5 | 2013-07-22 22:12:56 +0900 | [diff] [blame] | 106 | *pino = parent_ino(dentry); |
| 107 | dput(dentry); |
Jaegeuk Kim | 354a339 | 2013-06-14 08:52:35 +0900 | [diff] [blame] | 108 | return 1; |
| 109 | } |
| 110 | |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 111 | int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) |
| 112 | { |
| 113 | struct inode *inode = file->f_mapping->host; |
| 114 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 115 | int ret = 0; |
| 116 | bool need_cp = false; |
| 117 | struct writeback_control wbc = { |
| 118 | .sync_mode = WB_SYNC_ALL, |
| 119 | .nr_to_write = LONG_MAX, |
| 120 | .for_reclaim = 0, |
| 121 | }; |
| 122 | |
Jaegeuk Kim | 6bacf52 | 2013-12-06 15:00:58 +0900 | [diff] [blame] | 123 | if (unlikely(f2fs_readonly(inode->i_sb))) |
Namjae Jeon | 1fa95b0 | 2012-12-01 10:56:01 +0900 | [diff] [blame] | 124 | return 0; |
| 125 | |
Namjae Jeon | a2a4a7e | 2013-04-20 01:28:40 +0900 | [diff] [blame] | 126 | trace_f2fs_sync_file_enter(inode); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 127 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); |
Namjae Jeon | a2a4a7e | 2013-04-20 01:28:40 +0900 | [diff] [blame] | 128 | if (ret) { |
| 129 | trace_f2fs_sync_file_exit(inode, need_cp, datasync, ret); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 130 | return ret; |
Namjae Jeon | a2a4a7e | 2013-04-20 01:28:40 +0900 | [diff] [blame] | 131 | } |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 132 | |
Jaegeuk Kim | 7d82db8 | 2013-01-11 13:10:49 +0900 | [diff] [blame] | 133 | /* guarantee free sections for fsync */ |
| 134 | f2fs_balance_fs(sbi); |
| 135 | |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 136 | mutex_lock(&inode->i_mutex); |
| 137 | |
Jaegeuk Kim | e5d2385 | 2013-07-03 10:55:52 +0900 | [diff] [blame] | 138 | /* |
| 139 | * Both of fdatasync() and fsync() are able to be recovered from |
| 140 | * sudden-power-off. |
| 141 | */ |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 142 | if (!S_ISREG(inode->i_mode) || inode->i_nlink != 1) |
| 143 | need_cp = true; |
Jaegeuk Kim | 354a339 | 2013-06-14 08:52:35 +0900 | [diff] [blame] | 144 | else if (file_wrong_pino(inode)) |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 145 | need_cp = true; |
Changman Lee | facb020 | 2013-01-31 17:16:56 +0900 | [diff] [blame] | 146 | else if (!space_for_roll_forward(sbi)) |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 147 | need_cp = true; |
Jaegeuk Kim | 953a3e2 | 2013-03-21 15:21:57 +0900 | [diff] [blame] | 148 | else if (!is_checkpointed_node(sbi, F2FS_I(inode)->i_pino)) |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 149 | need_cp = true; |
Jaegeuk Kim | d71b556 | 2013-08-09 15:03:21 +0900 | [diff] [blame] | 150 | else if (F2FS_I(inode)->xattr_ver == cur_cp_version(F2FS_CKPT(sbi))) |
Jaegeuk Kim | e518ff8 | 2013-08-09 14:46:15 +0900 | [diff] [blame] | 151 | need_cp = true; |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 152 | |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 153 | if (need_cp) { |
Jaegeuk Kim | 354a339 | 2013-06-14 08:52:35 +0900 | [diff] [blame] | 154 | nid_t pino; |
| 155 | |
Jaegeuk Kim | e518ff8 | 2013-08-09 14:46:15 +0900 | [diff] [blame] | 156 | F2FS_I(inode)->xattr_ver = 0; |
| 157 | |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 158 | /* all the dirty node pages should be flushed for POR */ |
| 159 | ret = f2fs_sync_fs(inode->i_sb, 1); |
Jaegeuk Kim | 354a339 | 2013-06-14 08:52:35 +0900 | [diff] [blame] | 160 | if (file_wrong_pino(inode) && inode->i_nlink == 1 && |
| 161 | get_parent_ino(inode, &pino)) { |
| 162 | F2FS_I(inode)->i_pino = pino; |
| 163 | file_got_pino(inode); |
| 164 | mark_inode_dirty_sync(inode); |
| 165 | ret = f2fs_write_inode(inode, NULL); |
| 166 | if (ret) |
| 167 | goto out; |
| 168 | } |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 169 | } else { |
Jaegeuk Kim | 398b1ac | 2012-12-19 15:28:39 +0900 | [diff] [blame] | 170 | /* if there is no written node page, write its inode page */ |
| 171 | while (!sync_node_pages(sbi, inode->i_ino, &wbc)) { |
Jaegeuk Kim | b378387 | 2013-06-10 09:17:01 +0900 | [diff] [blame] | 172 | mark_inode_dirty_sync(inode); |
Jaegeuk Kim | 398b1ac | 2012-12-19 15:28:39 +0900 | [diff] [blame] | 173 | ret = f2fs_write_inode(inode, NULL); |
| 174 | if (ret) |
| 175 | goto out; |
| 176 | } |
Jaegeuk Kim | cfe58f9 | 2013-10-31 14:57:01 +0900 | [diff] [blame] | 177 | ret = wait_on_node_pages_writeback(sbi, inode->i_ino); |
| 178 | if (ret) |
| 179 | goto out; |
Jaegeuk Kim | ae51fb3 | 2013-03-16 11:13:04 +0900 | [diff] [blame] | 180 | ret = blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 181 | } |
| 182 | out: |
| 183 | mutex_unlock(&inode->i_mutex); |
Namjae Jeon | a2a4a7e | 2013-04-20 01:28:40 +0900 | [diff] [blame] | 184 | trace_f2fs_sync_file_exit(inode, need_cp, datasync, ret); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 185 | return ret; |
| 186 | } |
| 187 | |
| 188 | static int f2fs_file_mmap(struct file *file, struct vm_area_struct *vma) |
| 189 | { |
| 190 | file_accessed(file); |
| 191 | vma->vm_ops = &f2fs_file_vm_ops; |
| 192 | return 0; |
| 193 | } |
| 194 | |
Jaegeuk Kim | b292dcab | 2013-05-22 08:02:02 +0900 | [diff] [blame] | 195 | int truncate_data_blocks_range(struct dnode_of_data *dn, int count) |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 196 | { |
| 197 | int nr_free = 0, ofs = dn->ofs_in_node; |
| 198 | struct f2fs_sb_info *sbi = F2FS_SB(dn->inode->i_sb); |
| 199 | struct f2fs_node *raw_node; |
| 200 | __le32 *addr; |
| 201 | |
Gu Zheng | 4559071 | 2013-07-15 17:57:38 +0800 | [diff] [blame] | 202 | raw_node = F2FS_NODE(dn->node_page); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 203 | addr = blkaddr_in_node(raw_node) + ofs; |
| 204 | |
| 205 | for ( ; count > 0; count--, addr++, dn->ofs_in_node++) { |
| 206 | block_t blkaddr = le32_to_cpu(*addr); |
| 207 | if (blkaddr == NULL_ADDR) |
| 208 | continue; |
| 209 | |
| 210 | update_extent_cache(NULL_ADDR, dn); |
| 211 | invalidate_blocks(sbi, blkaddr); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 212 | nr_free++; |
| 213 | } |
| 214 | if (nr_free) { |
Namjae Jeon | d7cc950 | 2013-06-08 21:25:40 +0900 | [diff] [blame] | 215 | dec_valid_block_count(sbi, dn->inode, nr_free); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 216 | set_page_dirty(dn->node_page); |
| 217 | sync_inode_page(dn); |
| 218 | } |
| 219 | dn->ofs_in_node = ofs; |
Namjae Jeon | 51dd624 | 2013-04-20 01:28:52 +0900 | [diff] [blame] | 220 | |
| 221 | trace_f2fs_truncate_data_blocks_range(dn->inode, dn->nid, |
| 222 | dn->ofs_in_node, nr_free); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 223 | return nr_free; |
| 224 | } |
| 225 | |
| 226 | void truncate_data_blocks(struct dnode_of_data *dn) |
| 227 | { |
| 228 | truncate_data_blocks_range(dn, ADDRS_PER_BLOCK); |
| 229 | } |
| 230 | |
| 231 | static void truncate_partial_data_page(struct inode *inode, u64 from) |
| 232 | { |
| 233 | unsigned offset = from & (PAGE_CACHE_SIZE - 1); |
| 234 | struct page *page; |
| 235 | |
| 236 | if (!offset) |
| 237 | return; |
| 238 | |
Jaegeuk Kim | c718379b | 2013-04-24 13:19:56 +0900 | [diff] [blame] | 239 | page = find_data_page(inode, from >> PAGE_CACHE_SHIFT, false); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 240 | if (IS_ERR(page)) |
| 241 | return; |
| 242 | |
| 243 | lock_page(page); |
Jaegeuk Kim | 6bacf52 | 2013-12-06 15:00:58 +0900 | [diff] [blame] | 244 | if (unlikely(page->mapping != inode->i_mapping)) { |
Jaegeuk Kim | afcb7ca0 | 2013-04-26 11:55:17 +0900 | [diff] [blame] | 245 | f2fs_put_page(page, 1); |
| 246 | return; |
| 247 | } |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 248 | wait_on_page_writeback(page); |
| 249 | zero_user(page, offset, PAGE_CACHE_SIZE - offset); |
| 250 | set_page_dirty(page); |
| 251 | f2fs_put_page(page, 1); |
| 252 | } |
| 253 | |
| 254 | static int truncate_blocks(struct inode *inode, u64 from) |
| 255 | { |
| 256 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); |
| 257 | unsigned int blocksize = inode->i_sb->s_blocksize; |
| 258 | struct dnode_of_data dn; |
| 259 | pgoff_t free_from; |
Huajun Li | 9ffe0fb | 2013-11-10 23:13:20 +0800 | [diff] [blame] | 260 | int count = 0, err = 0; |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 261 | |
Namjae Jeon | 51dd624 | 2013-04-20 01:28:52 +0900 | [diff] [blame] | 262 | trace_f2fs_truncate_blocks_enter(inode, from); |
| 263 | |
Jaegeuk Kim | f185ff9 | 2013-12-27 11:01:54 +0900 | [diff] [blame] | 264 | if (f2fs_has_inline_data(inode)) |
| 265 | goto done; |
| 266 | |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 267 | free_from = (pgoff_t) |
| 268 | ((from + blocksize - 1) >> (sbi->log_blocksize)); |
| 269 | |
Gu Zheng | e479556 | 2013-09-27 18:08:30 +0800 | [diff] [blame] | 270 | f2fs_lock_op(sbi); |
Huajun Li | 9ffe0fb | 2013-11-10 23:13:20 +0800 | [diff] [blame] | 271 | |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 272 | set_new_dnode(&dn, inode, NULL, NULL, 0); |
Jaegeuk Kim | 266e97a | 2013-02-26 13:10:46 +0900 | [diff] [blame] | 273 | err = get_dnode_of_data(&dn, free_from, LOOKUP_NODE); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 274 | if (err) { |
| 275 | if (err == -ENOENT) |
| 276 | goto free_next; |
Gu Zheng | e479556 | 2013-09-27 18:08:30 +0800 | [diff] [blame] | 277 | f2fs_unlock_op(sbi); |
Namjae Jeon | 51dd624 | 2013-04-20 01:28:52 +0900 | [diff] [blame] | 278 | trace_f2fs_truncate_blocks_exit(inode, err); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 279 | return err; |
| 280 | } |
| 281 | |
| 282 | if (IS_INODE(dn.node_page)) |
Jaegeuk Kim | de93653 | 2013-08-12 21:08:03 +0900 | [diff] [blame] | 283 | count = ADDRS_PER_INODE(F2FS_I(inode)); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 284 | else |
| 285 | count = ADDRS_PER_BLOCK; |
| 286 | |
| 287 | count -= dn.ofs_in_node; |
Jaegeuk Kim | 5d56b67 | 2013-10-29 15:14:54 +0900 | [diff] [blame] | 288 | f2fs_bug_on(count < 0); |
Jaegeuk Kim | 3993683 | 2012-11-22 16:21:29 +0900 | [diff] [blame] | 289 | |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 290 | if (dn.ofs_in_node || IS_INODE(dn.node_page)) { |
| 291 | truncate_data_blocks_range(&dn, count); |
| 292 | free_from += count; |
| 293 | } |
| 294 | |
| 295 | f2fs_put_dnode(&dn); |
| 296 | free_next: |
| 297 | err = truncate_inode_blocks(inode, free_from); |
Gu Zheng | e479556 | 2013-09-27 18:08:30 +0800 | [diff] [blame] | 298 | f2fs_unlock_op(sbi); |
Jaegeuk Kim | f185ff9 | 2013-12-27 11:01:54 +0900 | [diff] [blame] | 299 | done: |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 300 | /* lastly zero out the first data page */ |
| 301 | truncate_partial_data_page(inode, from); |
| 302 | |
Namjae Jeon | 51dd624 | 2013-04-20 01:28:52 +0900 | [diff] [blame] | 303 | trace_f2fs_truncate_blocks_exit(inode, err); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 304 | return err; |
| 305 | } |
| 306 | |
| 307 | void f2fs_truncate(struct inode *inode) |
| 308 | { |
| 309 | if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || |
| 310 | S_ISLNK(inode->i_mode))) |
| 311 | return; |
| 312 | |
Namjae Jeon | 51dd624 | 2013-04-20 01:28:52 +0900 | [diff] [blame] | 313 | trace_f2fs_truncate(inode); |
| 314 | |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 315 | if (!truncate_blocks(inode, i_size_read(inode))) { |
| 316 | inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
| 317 | mark_inode_dirty(inode); |
| 318 | } |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 319 | } |
| 320 | |
Jaegeuk Kim | 2d4d9fb5 | 2013-06-07 16:33:07 +0900 | [diff] [blame] | 321 | int f2fs_getattr(struct vfsmount *mnt, |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 322 | struct dentry *dentry, struct kstat *stat) |
| 323 | { |
| 324 | struct inode *inode = dentry->d_inode; |
| 325 | generic_fillattr(inode, stat); |
| 326 | stat->blocks <<= 3; |
| 327 | return 0; |
| 328 | } |
| 329 | |
| 330 | #ifdef CONFIG_F2FS_FS_POSIX_ACL |
| 331 | static void __setattr_copy(struct inode *inode, const struct iattr *attr) |
| 332 | { |
| 333 | struct f2fs_inode_info *fi = F2FS_I(inode); |
| 334 | unsigned int ia_valid = attr->ia_valid; |
| 335 | |
| 336 | if (ia_valid & ATTR_UID) |
| 337 | inode->i_uid = attr->ia_uid; |
| 338 | if (ia_valid & ATTR_GID) |
| 339 | inode->i_gid = attr->ia_gid; |
| 340 | if (ia_valid & ATTR_ATIME) |
| 341 | inode->i_atime = timespec_trunc(attr->ia_atime, |
| 342 | inode->i_sb->s_time_gran); |
| 343 | if (ia_valid & ATTR_MTIME) |
| 344 | inode->i_mtime = timespec_trunc(attr->ia_mtime, |
| 345 | inode->i_sb->s_time_gran); |
| 346 | if (ia_valid & ATTR_CTIME) |
| 347 | inode->i_ctime = timespec_trunc(attr->ia_ctime, |
| 348 | inode->i_sb->s_time_gran); |
| 349 | if (ia_valid & ATTR_MODE) { |
| 350 | umode_t mode = attr->ia_mode; |
| 351 | |
| 352 | if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID)) |
| 353 | mode &= ~S_ISGID; |
| 354 | set_acl_inode(fi, mode); |
| 355 | } |
| 356 | } |
| 357 | #else |
| 358 | #define __setattr_copy setattr_copy |
| 359 | #endif |
| 360 | |
| 361 | int f2fs_setattr(struct dentry *dentry, struct iattr *attr) |
| 362 | { |
| 363 | struct inode *inode = dentry->d_inode; |
| 364 | struct f2fs_inode_info *fi = F2FS_I(inode); |
| 365 | int err; |
| 366 | |
| 367 | err = inode_change_ok(inode, attr); |
| 368 | if (err) |
| 369 | return err; |
| 370 | |
| 371 | if ((attr->ia_valid & ATTR_SIZE) && |
| 372 | attr->ia_size != i_size_read(inode)) { |
Jaegeuk Kim | 9e09fc8 | 2013-12-27 12:28:59 +0900 | [diff] [blame^] | 373 | err = f2fs_convert_inline_data(inode, attr->ia_size); |
| 374 | if (err) |
| 375 | return err; |
Huajun Li | 9ffe0fb | 2013-11-10 23:13:20 +0800 | [diff] [blame] | 376 | |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 377 | truncate_setsize(inode, attr->ia_size); |
Jaegeuk Kim | 9e09fc8 | 2013-12-27 12:28:59 +0900 | [diff] [blame^] | 378 | f2fs_truncate(inode); |
Jaegeuk Kim | d4686d56 | 2013-01-31 15:36:04 +0900 | [diff] [blame] | 379 | f2fs_balance_fs(F2FS_SB(inode->i_sb)); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 380 | } |
| 381 | |
| 382 | __setattr_copy(inode, attr); |
| 383 | |
| 384 | if (attr->ia_valid & ATTR_MODE) { |
| 385 | err = f2fs_acl_chmod(inode); |
| 386 | if (err || is_inode_flag_set(fi, FI_ACL_MODE)) { |
| 387 | inode->i_mode = fi->i_acl_mode; |
| 388 | clear_inode_flag(fi, FI_ACL_MODE); |
| 389 | } |
| 390 | } |
| 391 | |
| 392 | mark_inode_dirty(inode); |
| 393 | return err; |
| 394 | } |
| 395 | |
| 396 | const struct inode_operations f2fs_file_inode_operations = { |
| 397 | .getattr = f2fs_getattr, |
| 398 | .setattr = f2fs_setattr, |
| 399 | .get_acl = f2fs_get_acl, |
| 400 | #ifdef CONFIG_F2FS_FS_XATTR |
| 401 | .setxattr = generic_setxattr, |
| 402 | .getxattr = generic_getxattr, |
| 403 | .listxattr = f2fs_listxattr, |
| 404 | .removexattr = generic_removexattr, |
| 405 | #endif |
| 406 | }; |
| 407 | |
| 408 | static void fill_zero(struct inode *inode, pgoff_t index, |
| 409 | loff_t start, loff_t len) |
| 410 | { |
Jaegeuk Kim | bd43df0 | 2013-01-25 18:33:41 +0900 | [diff] [blame] | 411 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 412 | struct page *page; |
| 413 | |
| 414 | if (!len) |
| 415 | return; |
| 416 | |
Jaegeuk Kim | bd43df0 | 2013-01-25 18:33:41 +0900 | [diff] [blame] | 417 | f2fs_balance_fs(sbi); |
| 418 | |
Gu Zheng | e479556 | 2013-09-27 18:08:30 +0800 | [diff] [blame] | 419 | f2fs_lock_op(sbi); |
Jaegeuk Kim | 64aa7ed | 2013-05-20 09:55:50 +0900 | [diff] [blame] | 420 | page = get_new_data_page(inode, NULL, index, false); |
Gu Zheng | e479556 | 2013-09-27 18:08:30 +0800 | [diff] [blame] | 421 | f2fs_unlock_op(sbi); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 422 | |
| 423 | if (!IS_ERR(page)) { |
| 424 | wait_on_page_writeback(page); |
| 425 | zero_user(page, start, len); |
| 426 | set_page_dirty(page); |
| 427 | f2fs_put_page(page, 1); |
| 428 | } |
| 429 | } |
| 430 | |
| 431 | int truncate_hole(struct inode *inode, pgoff_t pg_start, pgoff_t pg_end) |
| 432 | { |
| 433 | pgoff_t index; |
| 434 | int err; |
| 435 | |
| 436 | for (index = pg_start; index < pg_end; index++) { |
| 437 | struct dnode_of_data dn; |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 438 | |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 439 | set_new_dnode(&dn, inode, NULL, NULL, 0); |
Jaegeuk Kim | 266e97a | 2013-02-26 13:10:46 +0900 | [diff] [blame] | 440 | err = get_dnode_of_data(&dn, index, LOOKUP_NODE); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 441 | if (err) { |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 442 | if (err == -ENOENT) |
| 443 | continue; |
| 444 | return err; |
| 445 | } |
| 446 | |
| 447 | if (dn.data_blkaddr != NULL_ADDR) |
| 448 | truncate_data_blocks_range(&dn, 1); |
| 449 | f2fs_put_dnode(&dn); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 450 | } |
| 451 | return 0; |
| 452 | } |
| 453 | |
Chao Yu | a66c7b2 | 2013-11-22 16:52:50 +0800 | [diff] [blame] | 454 | static int punch_hole(struct inode *inode, loff_t offset, loff_t len) |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 455 | { |
| 456 | pgoff_t pg_start, pg_end; |
| 457 | loff_t off_start, off_end; |
| 458 | int ret = 0; |
| 459 | |
Jaegeuk Kim | 9e09fc8 | 2013-12-27 12:28:59 +0900 | [diff] [blame^] | 460 | ret = f2fs_convert_inline_data(inode, MAX_INLINE_DATA + 1); |
Jaegeuk Kim | 8230a0a | 2013-12-27 11:13:21 +0900 | [diff] [blame] | 461 | if (ret) |
| 462 | return ret; |
Huajun Li | 9ffe0fb | 2013-11-10 23:13:20 +0800 | [diff] [blame] | 463 | |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 464 | pg_start = ((unsigned long long) offset) >> PAGE_CACHE_SHIFT; |
| 465 | pg_end = ((unsigned long long) offset + len) >> PAGE_CACHE_SHIFT; |
| 466 | |
| 467 | off_start = offset & (PAGE_CACHE_SIZE - 1); |
| 468 | off_end = (offset + len) & (PAGE_CACHE_SIZE - 1); |
| 469 | |
| 470 | if (pg_start == pg_end) { |
| 471 | fill_zero(inode, pg_start, off_start, |
| 472 | off_end - off_start); |
| 473 | } else { |
| 474 | if (off_start) |
| 475 | fill_zero(inode, pg_start++, off_start, |
| 476 | PAGE_CACHE_SIZE - off_start); |
| 477 | if (off_end) |
| 478 | fill_zero(inode, pg_end, 0, off_end); |
| 479 | |
| 480 | if (pg_start < pg_end) { |
| 481 | struct address_space *mapping = inode->i_mapping; |
| 482 | loff_t blk_start, blk_end; |
Jason Hrycay | 1127a3d | 2013-04-08 20:16:44 -0500 | [diff] [blame] | 483 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); |
| 484 | |
| 485 | f2fs_balance_fs(sbi); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 486 | |
| 487 | blk_start = pg_start << PAGE_CACHE_SHIFT; |
| 488 | blk_end = pg_end << PAGE_CACHE_SHIFT; |
| 489 | truncate_inode_pages_range(mapping, blk_start, |
| 490 | blk_end - 1); |
Jaegeuk Kim | 3993683 | 2012-11-22 16:21:29 +0900 | [diff] [blame] | 491 | |
Gu Zheng | e479556 | 2013-09-27 18:08:30 +0800 | [diff] [blame] | 492 | f2fs_lock_op(sbi); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 493 | ret = truncate_hole(inode, pg_start, pg_end); |
Gu Zheng | e479556 | 2013-09-27 18:08:30 +0800 | [diff] [blame] | 494 | f2fs_unlock_op(sbi); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 495 | } |
| 496 | } |
| 497 | |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 498 | return ret; |
| 499 | } |
| 500 | |
| 501 | static int expand_inode_data(struct inode *inode, loff_t offset, |
| 502 | loff_t len, int mode) |
| 503 | { |
| 504 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); |
| 505 | pgoff_t index, pg_start, pg_end; |
| 506 | loff_t new_size = i_size_read(inode); |
| 507 | loff_t off_start, off_end; |
| 508 | int ret = 0; |
| 509 | |
| 510 | ret = inode_newsize_ok(inode, (len + offset)); |
| 511 | if (ret) |
| 512 | return ret; |
| 513 | |
Jaegeuk Kim | 9e09fc8 | 2013-12-27 12:28:59 +0900 | [diff] [blame^] | 514 | ret = f2fs_convert_inline_data(inode, offset + len); |
| 515 | if (ret) |
| 516 | return ret; |
| 517 | |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 518 | pg_start = ((unsigned long long) offset) >> PAGE_CACHE_SHIFT; |
| 519 | pg_end = ((unsigned long long) offset + len) >> PAGE_CACHE_SHIFT; |
| 520 | |
| 521 | off_start = offset & (PAGE_CACHE_SIZE - 1); |
| 522 | off_end = (offset + len) & (PAGE_CACHE_SIZE - 1); |
| 523 | |
| 524 | for (index = pg_start; index <= pg_end; index++) { |
| 525 | struct dnode_of_data dn; |
| 526 | |
Gu Zheng | e479556 | 2013-09-27 18:08:30 +0800 | [diff] [blame] | 527 | f2fs_lock_op(sbi); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 528 | set_new_dnode(&dn, inode, NULL, NULL, 0); |
Huajun Li | b600965 | 2013-11-10 23:13:18 +0800 | [diff] [blame] | 529 | ret = f2fs_reserve_block(&dn, index); |
Gu Zheng | e479556 | 2013-09-27 18:08:30 +0800 | [diff] [blame] | 530 | f2fs_unlock_op(sbi); |
Huajun Li | b600965 | 2013-11-10 23:13:18 +0800 | [diff] [blame] | 531 | if (ret) |
| 532 | break; |
| 533 | |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 534 | if (pg_start == pg_end) |
| 535 | new_size = offset + len; |
| 536 | else if (index == pg_start && off_start) |
| 537 | new_size = (index + 1) << PAGE_CACHE_SHIFT; |
| 538 | else if (index == pg_end) |
| 539 | new_size = (index << PAGE_CACHE_SHIFT) + off_end; |
| 540 | else |
| 541 | new_size += PAGE_CACHE_SIZE; |
| 542 | } |
| 543 | |
| 544 | if (!(mode & FALLOC_FL_KEEP_SIZE) && |
| 545 | i_size_read(inode) < new_size) { |
| 546 | i_size_write(inode, new_size); |
| 547 | mark_inode_dirty(inode); |
| 548 | } |
| 549 | |
| 550 | return ret; |
| 551 | } |
| 552 | |
| 553 | static long f2fs_fallocate(struct file *file, int mode, |
| 554 | loff_t offset, loff_t len) |
| 555 | { |
Al Viro | 6131ffa | 2013-02-27 16:59:05 -0500 | [diff] [blame] | 556 | struct inode *inode = file_inode(file); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 557 | long ret; |
| 558 | |
| 559 | if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE)) |
| 560 | return -EOPNOTSUPP; |
| 561 | |
| 562 | if (mode & FALLOC_FL_PUNCH_HOLE) |
Chao Yu | a66c7b2 | 2013-11-22 16:52:50 +0800 | [diff] [blame] | 563 | ret = punch_hole(inode, offset, len); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 564 | else |
| 565 | ret = expand_inode_data(inode, offset, len, mode); |
| 566 | |
Namjae Jeon | 3af60a4 | 2012-12-30 14:52:37 +0900 | [diff] [blame] | 567 | if (!ret) { |
| 568 | inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
| 569 | mark_inode_dirty(inode); |
| 570 | } |
Namjae Jeon | c01e285 | 2013-04-23 17:00:52 +0900 | [diff] [blame] | 571 | trace_f2fs_fallocate(inode, mode, offset, len, ret); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 572 | return ret; |
| 573 | } |
| 574 | |
| 575 | #define F2FS_REG_FLMASK (~(FS_DIRSYNC_FL | FS_TOPDIR_FL)) |
| 576 | #define F2FS_OTHER_FLMASK (FS_NODUMP_FL | FS_NOATIME_FL) |
| 577 | |
| 578 | static inline __u32 f2fs_mask_flags(umode_t mode, __u32 flags) |
| 579 | { |
| 580 | if (S_ISDIR(mode)) |
| 581 | return flags; |
| 582 | else if (S_ISREG(mode)) |
| 583 | return flags & F2FS_REG_FLMASK; |
| 584 | else |
| 585 | return flags & F2FS_OTHER_FLMASK; |
| 586 | } |
| 587 | |
| 588 | long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
| 589 | { |
Al Viro | 6131ffa | 2013-02-27 16:59:05 -0500 | [diff] [blame] | 590 | struct inode *inode = file_inode(filp); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 591 | struct f2fs_inode_info *fi = F2FS_I(inode); |
| 592 | unsigned int flags; |
| 593 | int ret; |
| 594 | |
| 595 | switch (cmd) { |
Namjae Jeon | 6a3e8ef | 2013-06-08 21:25:28 +0900 | [diff] [blame] | 596 | case F2FS_IOC_GETFLAGS: |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 597 | flags = fi->i_flags & FS_FL_USER_VISIBLE; |
| 598 | return put_user(flags, (int __user *) arg); |
Namjae Jeon | 6a3e8ef | 2013-06-08 21:25:28 +0900 | [diff] [blame] | 599 | case F2FS_IOC_SETFLAGS: |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 600 | { |
| 601 | unsigned int oldflags; |
| 602 | |
Al Viro | bdaec33 | 2013-03-20 09:33:23 -0400 | [diff] [blame] | 603 | ret = mnt_want_write_file(filp); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 604 | if (ret) |
| 605 | return ret; |
| 606 | |
| 607 | if (!inode_owner_or_capable(inode)) { |
| 608 | ret = -EACCES; |
| 609 | goto out; |
| 610 | } |
| 611 | |
| 612 | if (get_user(flags, (int __user *) arg)) { |
| 613 | ret = -EFAULT; |
| 614 | goto out; |
| 615 | } |
| 616 | |
| 617 | flags = f2fs_mask_flags(inode->i_mode, flags); |
| 618 | |
| 619 | mutex_lock(&inode->i_mutex); |
| 620 | |
| 621 | oldflags = fi->i_flags; |
| 622 | |
| 623 | if ((flags ^ oldflags) & (FS_APPEND_FL | FS_IMMUTABLE_FL)) { |
| 624 | if (!capable(CAP_LINUX_IMMUTABLE)) { |
| 625 | mutex_unlock(&inode->i_mutex); |
| 626 | ret = -EPERM; |
| 627 | goto out; |
| 628 | } |
| 629 | } |
| 630 | |
| 631 | flags = flags & FS_FL_USER_MODIFIABLE; |
| 632 | flags |= oldflags & ~FS_FL_USER_MODIFIABLE; |
| 633 | fi->i_flags = flags; |
| 634 | mutex_unlock(&inode->i_mutex); |
| 635 | |
| 636 | f2fs_set_inode_flags(inode); |
| 637 | inode->i_ctime = CURRENT_TIME; |
| 638 | mark_inode_dirty(inode); |
| 639 | out: |
Al Viro | bdaec33 | 2013-03-20 09:33:23 -0400 | [diff] [blame] | 640 | mnt_drop_write_file(filp); |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 641 | return ret; |
| 642 | } |
| 643 | default: |
| 644 | return -ENOTTY; |
| 645 | } |
| 646 | } |
| 647 | |
Namjae Jeon | e975082 | 2013-02-04 23:41:41 +0900 | [diff] [blame] | 648 | #ifdef CONFIG_COMPAT |
| 649 | long f2fs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
| 650 | { |
| 651 | switch (cmd) { |
| 652 | case F2FS_IOC32_GETFLAGS: |
| 653 | cmd = F2FS_IOC_GETFLAGS; |
| 654 | break; |
| 655 | case F2FS_IOC32_SETFLAGS: |
| 656 | cmd = F2FS_IOC_SETFLAGS; |
| 657 | break; |
| 658 | default: |
| 659 | return -ENOIOCTLCMD; |
| 660 | } |
| 661 | return f2fs_ioctl(file, cmd, (unsigned long) compat_ptr(arg)); |
| 662 | } |
| 663 | #endif |
| 664 | |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 665 | const struct file_operations f2fs_file_operations = { |
| 666 | .llseek = generic_file_llseek, |
| 667 | .read = do_sync_read, |
| 668 | .write = do_sync_write, |
| 669 | .aio_read = generic_file_aio_read, |
| 670 | .aio_write = generic_file_aio_write, |
| 671 | .open = generic_file_open, |
| 672 | .mmap = f2fs_file_mmap, |
| 673 | .fsync = f2fs_sync_file, |
| 674 | .fallocate = f2fs_fallocate, |
| 675 | .unlocked_ioctl = f2fs_ioctl, |
Namjae Jeon | e975082 | 2013-02-04 23:41:41 +0900 | [diff] [blame] | 676 | #ifdef CONFIG_COMPAT |
| 677 | .compat_ioctl = f2fs_compat_ioctl, |
| 678 | #endif |
Jaegeuk Kim | fbfa2cc | 2012-11-02 17:09:44 +0900 | [diff] [blame] | 679 | .splice_read = generic_file_splice_read, |
| 680 | .splice_write = generic_file_splice_write, |
| 681 | }; |