Btrfs: trivial include fixups
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / fs / btrfs / file.c
blobf327525f541d7ae0d759c4fcbf426979b95c70ef
1 /*
2 * Copyright (C) 2007 Oracle. All rights reserved.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License v2 as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public
14 * License along with this program; if not, write to the
15 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16 * Boston, MA 021110-1307, USA.
19 #include <linux/buffer_head.h>
20 #include <linux/fs.h>
21 #include <linux/pagemap.h>
22 #include <linux/highmem.h>
23 #include <linux/time.h>
24 #include <linux/init.h>
25 #include <linux/string.h>
26 #include <linux/smp_lock.h>
27 #include <linux/backing-dev.h>
28 #include <linux/mpage.h>
29 #include <linux/swap.h>
30 #include <linux/writeback.h>
31 #include <linux/statfs.h>
32 #include <linux/compat.h>
33 #include "ctree.h"
34 #include "disk-io.h"
35 #include "transaction.h"
36 #include "btrfs_inode.h"
37 #include "ioctl.h"
38 #include "print-tree.h"
41 static int btrfs_copy_from_user(loff_t pos, int num_pages, int write_bytes,
42 struct page **prepared_pages,
43 const char __user * buf)
45 long page_fault = 0;
46 int i;
47 int offset = pos & (PAGE_CACHE_SIZE - 1);
49 for (i = 0; i < num_pages && write_bytes > 0; i++, offset = 0) {
50 size_t count = min_t(size_t,
51 PAGE_CACHE_SIZE - offset, write_bytes);
52 struct page *page = prepared_pages[i];
53 fault_in_pages_readable(buf, count);
55 /* Copy data from userspace to the current page */
56 kmap(page);
57 page_fault = __copy_from_user(page_address(page) + offset,
58 buf, count);
59 /* Flush processor's dcache for this page */
60 flush_dcache_page(page);
61 kunmap(page);
62 buf += count;
63 write_bytes -= count;
65 if (page_fault)
66 break;
68 return page_fault ? -EFAULT : 0;
71 static void btrfs_drop_pages(struct page **pages, size_t num_pages)
73 size_t i;
74 for (i = 0; i < num_pages; i++) {
75 if (!pages[i])
76 break;
77 unlock_page(pages[i]);
78 mark_page_accessed(pages[i]);
79 page_cache_release(pages[i]);
83 static int insert_inline_extent(struct btrfs_root *root, struct inode *inode,
84 u64 offset, ssize_t size,
85 struct buffer_head *bh)
87 struct btrfs_key key;
88 struct btrfs_path *path;
89 char *ptr, *kaddr;
90 struct btrfs_trans_handle *trans;
91 struct btrfs_file_extent_item *ei;
92 u32 datasize;
93 int err = 0;
94 int ret;
96 path = btrfs_alloc_path();
97 if (!path)
98 return -ENOMEM;
100 mutex_lock(&root->fs_info->fs_mutex);
101 trans = btrfs_start_transaction(root, 1);
102 btrfs_set_trans_block_group(trans, inode);
104 key.objectid = inode->i_ino;
105 key.offset = offset;
106 key.flags = 0;
107 btrfs_set_key_type(&key, BTRFS_EXTENT_DATA_KEY);
108 BUG_ON(size >= PAGE_CACHE_SIZE);
109 datasize = btrfs_file_extent_calc_inline_size(size);
111 ret = btrfs_insert_empty_item(trans, root, path, &key,
112 datasize);
113 if (ret) {
114 err = ret;
115 goto fail;
117 ei = btrfs_item_ptr(btrfs_buffer_leaf(path->nodes[0]),
118 path->slots[0], struct btrfs_file_extent_item);
119 btrfs_set_file_extent_generation(ei, trans->transid);
120 btrfs_set_file_extent_type(ei,
121 BTRFS_FILE_EXTENT_INLINE);
122 ptr = btrfs_file_extent_inline_start(ei);
124 kaddr = kmap_atomic(bh->b_page, KM_USER0);
125 btrfs_memcpy(root, path->nodes[0]->b_data,
126 ptr, kaddr + bh_offset(bh),
127 size);
128 kunmap_atomic(kaddr, KM_USER0);
129 btrfs_mark_buffer_dirty(path->nodes[0]);
130 fail:
131 btrfs_free_path(path);
132 ret = btrfs_end_transaction(trans, root);
133 if (ret && !err)
134 err = ret;
135 mutex_unlock(&root->fs_info->fs_mutex);
136 return err;
139 static int dirty_and_release_pages(struct btrfs_trans_handle *trans,
140 struct btrfs_root *root,
141 struct file *file,
142 struct page **pages,
143 size_t num_pages,
144 loff_t pos,
145 size_t write_bytes)
147 int i;
148 int offset;
149 int err = 0;
150 int ret;
151 int this_write;
152 struct inode *inode = file->f_path.dentry->d_inode;
153 struct buffer_head *bh;
155 for (i = 0; i < num_pages; i++) {
156 offset = pos & (PAGE_CACHE_SIZE -1);
157 this_write = min((size_t)PAGE_CACHE_SIZE - offset, write_bytes);
159 /* FIXME, one block at a time */
160 bh = page_buffers(pages[i]);
162 if (buffer_mapped(bh) && bh->b_blocknr == 0) {
163 ret = insert_inline_extent(root, inode,
164 pages[i]->index << PAGE_CACHE_SHIFT,
165 offset + this_write, bh);
166 if (ret) {
167 err = ret;
168 goto failed;
172 ret = btrfs_commit_write(file, pages[i], offset,
173 offset + this_write);
174 pos += this_write;
175 if (ret) {
176 err = ret;
177 goto failed;
179 WARN_ON(this_write > write_bytes);
180 write_bytes -= this_write;
182 failed:
183 return err;
187 * this is very complex, but the basic idea is to drop all extents
188 * in the range start - end. hint_block is filled in with a block number
189 * that would be a good hint to the block allocator for this file.
191 * If an extent intersects the range but is not entirely inside the range
192 * it is either truncated or split. Anything entirely inside the range
193 * is deleted from the tree.
195 int btrfs_drop_extents(struct btrfs_trans_handle *trans,
196 struct btrfs_root *root, struct inode *inode,
197 u64 start, u64 end, u64 *hint_block)
199 int ret;
200 struct btrfs_key key;
201 struct btrfs_leaf *leaf;
202 int slot;
203 struct btrfs_file_extent_item *extent;
204 u64 extent_end = 0;
205 int keep;
206 struct btrfs_file_extent_item old;
207 struct btrfs_path *path;
208 u64 search_start = start;
209 int bookend;
210 int found_type;
211 int found_extent;
212 int found_inline;
213 int recow;
215 path = btrfs_alloc_path();
216 if (!path)
217 return -ENOMEM;
218 while(1) {
219 recow = 0;
220 btrfs_release_path(root, path);
221 ret = btrfs_lookup_file_extent(trans, root, path, inode->i_ino,
222 search_start, -1);
223 if (ret < 0)
224 goto out;
225 if (ret > 0) {
226 if (path->slots[0] == 0) {
227 ret = 0;
228 goto out;
230 path->slots[0]--;
232 next_slot:
233 keep = 0;
234 bookend = 0;
235 found_extent = 0;
236 found_inline = 0;
237 extent = NULL;
238 leaf = btrfs_buffer_leaf(path->nodes[0]);
239 slot = path->slots[0];
240 ret = 0;
241 btrfs_disk_key_to_cpu(&key, &leaf->items[slot].key);
242 if (key.offset >= end || key.objectid != inode->i_ino) {
243 goto out;
245 if (btrfs_key_type(&key) > BTRFS_EXTENT_DATA_KEY) {
246 goto out;
248 if (recow) {
249 search_start = key.offset;
250 continue;
252 if (btrfs_key_type(&key) == BTRFS_EXTENT_DATA_KEY) {
253 extent = btrfs_item_ptr(leaf, slot,
254 struct btrfs_file_extent_item);
255 found_type = btrfs_file_extent_type(extent);
256 if (found_type == BTRFS_FILE_EXTENT_REG) {
257 extent_end = key.offset +
258 (btrfs_file_extent_num_blocks(extent) <<
259 inode->i_blkbits);
260 found_extent = 1;
261 } else if (found_type == BTRFS_FILE_EXTENT_INLINE) {
262 found_inline = 1;
263 extent_end = key.offset +
264 btrfs_file_extent_inline_len(leaf->items +
265 slot);
267 } else {
268 extent_end = search_start;
271 /* we found nothing we can drop */
272 if ((!found_extent && !found_inline) ||
273 search_start >= extent_end) {
274 int nextret;
275 u32 nritems;
276 nritems = btrfs_header_nritems(
277 btrfs_buffer_header(path->nodes[0]));
278 if (slot >= nritems - 1) {
279 nextret = btrfs_next_leaf(root, path);
280 if (nextret)
281 goto out;
282 recow = 1;
283 } else {
284 path->slots[0]++;
286 goto next_slot;
289 /* FIXME, there's only one inline extent allowed right now */
290 if (found_inline) {
291 u64 mask = root->blocksize - 1;
292 search_start = (extent_end + mask) & ~mask;
293 } else
294 search_start = extent_end;
296 if (end < extent_end && end >= key.offset) {
297 if (found_extent) {
298 u64 disk_blocknr =
299 btrfs_file_extent_disk_blocknr(extent);
300 u64 disk_num_blocks =
301 btrfs_file_extent_disk_num_blocks(extent);
302 memcpy(&old, extent, sizeof(old));
303 if (disk_blocknr != 0) {
304 ret = btrfs_inc_extent_ref(trans, root,
305 disk_blocknr, disk_num_blocks);
306 BUG_ON(ret);
309 WARN_ON(found_inline);
310 bookend = 1;
312 /* truncate existing extent */
313 if (start > key.offset) {
314 u64 new_num;
315 u64 old_num;
316 keep = 1;
317 WARN_ON(start & (root->blocksize - 1));
318 if (found_extent) {
319 new_num = (start - key.offset) >>
320 inode->i_blkbits;
321 old_num = btrfs_file_extent_num_blocks(extent);
322 *hint_block =
323 btrfs_file_extent_disk_blocknr(extent);
324 if (btrfs_file_extent_disk_blocknr(extent)) {
325 inode->i_blocks -=
326 (old_num - new_num) << 3;
328 btrfs_set_file_extent_num_blocks(extent,
329 new_num);
330 btrfs_mark_buffer_dirty(path->nodes[0]);
331 } else {
332 WARN_ON(1);
335 /* delete the entire extent */
336 if (!keep) {
337 u64 disk_blocknr = 0;
338 u64 disk_num_blocks = 0;
339 u64 extent_num_blocks = 0;
340 if (found_extent) {
341 disk_blocknr =
342 btrfs_file_extent_disk_blocknr(extent);
343 disk_num_blocks =
344 btrfs_file_extent_disk_num_blocks(extent);
345 extent_num_blocks =
346 btrfs_file_extent_num_blocks(extent);
347 *hint_block =
348 btrfs_file_extent_disk_blocknr(extent);
350 ret = btrfs_del_item(trans, root, path);
351 /* TODO update progress marker and return */
352 BUG_ON(ret);
353 btrfs_release_path(root, path);
354 extent = NULL;
355 if (found_extent && disk_blocknr != 0) {
356 inode->i_blocks -= extent_num_blocks << 3;
357 ret = btrfs_free_extent(trans, root,
358 disk_blocknr,
359 disk_num_blocks, 0);
362 BUG_ON(ret);
363 if (!bookend && search_start >= end) {
364 ret = 0;
365 goto out;
367 if (!bookend)
368 continue;
370 /* create bookend, splitting the extent in two */
371 if (bookend && found_extent) {
372 struct btrfs_key ins;
373 ins.objectid = inode->i_ino;
374 ins.offset = end;
375 ins.flags = 0;
376 btrfs_set_key_type(&ins, BTRFS_EXTENT_DATA_KEY);
377 btrfs_release_path(root, path);
378 ret = btrfs_insert_empty_item(trans, root, path, &ins,
379 sizeof(*extent));
381 if (ret) {
382 btrfs_print_leaf(root, btrfs_buffer_leaf(path->nodes[0]));
383 printk("got %d on inserting %Lu %u %Lu start %Lu end %Lu found %Lu %Lu\n", ret , ins.objectid, ins.flags, ins.offset, start, end, key.offset, extent_end);
385 BUG_ON(ret);
386 extent = btrfs_item_ptr(
387 btrfs_buffer_leaf(path->nodes[0]),
388 path->slots[0],
389 struct btrfs_file_extent_item);
390 btrfs_set_file_extent_disk_blocknr(extent,
391 btrfs_file_extent_disk_blocknr(&old));
392 btrfs_set_file_extent_disk_num_blocks(extent,
393 btrfs_file_extent_disk_num_blocks(&old));
395 btrfs_set_file_extent_offset(extent,
396 btrfs_file_extent_offset(&old) +
397 ((end - key.offset) >> inode->i_blkbits));
398 WARN_ON(btrfs_file_extent_num_blocks(&old) <
399 (extent_end - end) >> inode->i_blkbits);
400 btrfs_set_file_extent_num_blocks(extent,
401 (extent_end - end) >> inode->i_blkbits);
403 btrfs_set_file_extent_type(extent,
404 BTRFS_FILE_EXTENT_REG);
405 btrfs_set_file_extent_generation(extent,
406 btrfs_file_extent_generation(&old));
407 btrfs_mark_buffer_dirty(path->nodes[0]);
408 if (btrfs_file_extent_disk_blocknr(&old) != 0) {
409 inode->i_blocks +=
410 btrfs_file_extent_num_blocks(extent) << 3;
412 ret = 0;
413 goto out;
416 out:
417 btrfs_free_path(path);
418 return ret;
422 * this gets pages into the page cache and locks them down
424 static int prepare_pages(struct btrfs_root *root,
425 struct file *file,
426 struct page **pages,
427 size_t num_pages,
428 loff_t pos,
429 unsigned long first_index,
430 unsigned long last_index,
431 size_t write_bytes)
433 int i;
434 unsigned long index = pos >> PAGE_CACHE_SHIFT;
435 struct inode *inode = file->f_path.dentry->d_inode;
436 int offset;
437 int err = 0;
438 int this_write;
439 struct buffer_head *bh;
440 struct buffer_head *head;
441 loff_t isize = i_size_read(inode);
442 struct btrfs_trans_handle *trans;
443 u64 hint_block;
444 u64 num_blocks;
445 u64 alloc_extent_start;
446 u64 start_pos;
447 struct btrfs_key ins;
449 start_pos = pos & ~((u64)PAGE_CACHE_SIZE - 1);
450 num_blocks = (write_bytes + pos - start_pos + root->blocksize - 1) >>
451 inode->i_blkbits;
453 memset(pages, 0, num_pages * sizeof(struct page *));
455 for (i = 0; i < num_pages; i++) {
456 pages[i] = grab_cache_page(inode->i_mapping, index + i);
457 if (!pages[i]) {
458 err = -ENOMEM;
459 goto failed_release;
461 cancel_dirty_page(pages[i], PAGE_CACHE_SIZE);
462 wait_on_page_writeback(pages[i]);
465 mutex_lock(&root->fs_info->fs_mutex);
466 trans = btrfs_start_transaction(root, 1);
467 if (!trans) {
468 err = -ENOMEM;
469 mutex_unlock(&root->fs_info->fs_mutex);
470 goto out_unlock;
472 btrfs_set_trans_block_group(trans, inode);
473 /* FIXME blocksize != 4096 */
474 inode->i_blocks += num_blocks << 3;
475 hint_block = 0;
477 /* FIXME...EIEIO, ENOSPC and more */
479 /* step one, delete the existing extents in this range */
480 /* FIXME blocksize != pagesize */
481 if (start_pos < inode->i_size) {
482 err = btrfs_drop_extents(trans, root, inode,
483 start_pos, (pos + write_bytes + root->blocksize -1) &
484 ~((u64)root->blocksize - 1), &hint_block);
485 if (err)
486 goto failed_release;
489 /* insert any holes we need to create */
490 if (inode->i_size < start_pos) {
491 u64 last_pos_in_file;
492 u64 hole_size;
493 u64 mask = root->blocksize - 1;
494 last_pos_in_file = (isize + mask) & ~mask;
495 hole_size = (start_pos - last_pos_in_file + mask) & ~mask;
496 hole_size >>= inode->i_blkbits;
497 if (last_pos_in_file < start_pos) {
498 err = btrfs_insert_file_extent(trans, root,
499 inode->i_ino,
500 last_pos_in_file,
501 0, 0, hole_size);
503 if (err)
504 goto failed_release;
508 * either allocate an extent for the new bytes or setup the key
509 * to show we are doing inline data in the extent
511 if (isize >= PAGE_CACHE_SIZE || pos + write_bytes < inode->i_size ||
512 pos + write_bytes - start_pos > BTRFS_MAX_INLINE_DATA_SIZE(root)) {
513 err = btrfs_alloc_extent(trans, root, inode->i_ino,
514 num_blocks, hint_block, (u64)-1,
515 &ins, 1);
516 if (err)
517 goto failed_truncate;
518 err = btrfs_insert_file_extent(trans, root, inode->i_ino,
519 start_pos, ins.objectid, ins.offset,
520 ins.offset);
521 if (err)
522 goto failed_truncate;
523 } else {
524 ins.offset = 0;
525 ins.objectid = 0;
527 BUG_ON(err);
528 alloc_extent_start = ins.objectid;
529 err = btrfs_end_transaction(trans, root);
530 mutex_unlock(&root->fs_info->fs_mutex);
532 for (i = 0; i < num_pages; i++) {
533 offset = pos & (PAGE_CACHE_SIZE -1);
534 this_write = min((size_t)PAGE_CACHE_SIZE - offset, write_bytes);
535 if (!page_has_buffers(pages[i])) {
536 create_empty_buffers(pages[i],
537 root->fs_info->sb->s_blocksize,
538 (1 << BH_Uptodate));
540 head = page_buffers(pages[i]);
541 bh = head;
542 do {
543 err = btrfs_map_bh_to_logical(root, bh,
544 alloc_extent_start);
545 BUG_ON(err);
546 if (err)
547 goto failed_truncate;
548 bh = bh->b_this_page;
549 if (alloc_extent_start)
550 alloc_extent_start++;
551 } while (bh != head);
552 pos += this_write;
553 WARN_ON(this_write > write_bytes);
554 write_bytes -= this_write;
556 return 0;
558 failed_release:
559 btrfs_drop_pages(pages, num_pages);
560 return err;
562 failed_truncate:
563 btrfs_drop_pages(pages, num_pages);
564 if (pos > isize)
565 vmtruncate(inode, isize);
566 return err;
568 out_unlock:
569 mutex_unlock(&root->fs_info->fs_mutex);
570 goto failed_release;
574 static ssize_t btrfs_file_write(struct file *file, const char __user *buf,
575 size_t count, loff_t *ppos)
577 loff_t pos;
578 size_t num_written = 0;
579 int err = 0;
580 int ret = 0;
581 struct inode *inode = file->f_path.dentry->d_inode;
582 struct btrfs_root *root = BTRFS_I(inode)->root;
583 struct page **pages = NULL;
584 int nrptrs;
585 struct page *pinned[2];
586 unsigned long first_index;
587 unsigned long last_index;
589 nrptrs = min((count + PAGE_CACHE_SIZE - 1) / PAGE_CACHE_SIZE,
590 PAGE_CACHE_SIZE / (sizeof(struct page *)));
591 pinned[0] = NULL;
592 pinned[1] = NULL;
593 if (file->f_flags & O_DIRECT)
594 return -EINVAL;
595 pos = *ppos;
596 vfs_check_frozen(inode->i_sb, SB_FREEZE_WRITE);
597 current->backing_dev_info = inode->i_mapping->backing_dev_info;
598 err = generic_write_checks(file, &pos, &count, S_ISBLK(inode->i_mode));
599 if (err)
600 goto out;
601 if (count == 0)
602 goto out;
603 err = remove_suid(file->f_path.dentry);
604 if (err)
605 goto out;
606 file_update_time(file);
608 pages = kmalloc(nrptrs * sizeof(struct page *), GFP_KERNEL);
610 mutex_lock(&inode->i_mutex);
611 first_index = pos >> PAGE_CACHE_SHIFT;
612 last_index = (pos + count) >> PAGE_CACHE_SHIFT;
615 * there are lots of better ways to do this, but this code
616 * makes sure the first and last page in the file range are
617 * up to date and ready for cow
619 if ((pos & (PAGE_CACHE_SIZE - 1))) {
620 pinned[0] = grab_cache_page(inode->i_mapping, first_index);
621 if (!PageUptodate(pinned[0])) {
622 ret = btrfs_readpage(NULL, pinned[0]);
623 BUG_ON(ret);
624 wait_on_page_locked(pinned[0]);
625 } else {
626 unlock_page(pinned[0]);
629 if ((pos + count) & (PAGE_CACHE_SIZE - 1)) {
630 pinned[1] = grab_cache_page(inode->i_mapping, last_index);
631 if (!PageUptodate(pinned[1])) {
632 ret = btrfs_readpage(NULL, pinned[1]);
633 BUG_ON(ret);
634 wait_on_page_locked(pinned[1]);
635 } else {
636 unlock_page(pinned[1]);
640 while(count > 0) {
641 size_t offset = pos & (PAGE_CACHE_SIZE - 1);
642 size_t write_bytes = min(count, nrptrs *
643 (size_t)PAGE_CACHE_SIZE -
644 offset);
645 size_t num_pages = (write_bytes + PAGE_CACHE_SIZE - 1) >>
646 PAGE_CACHE_SHIFT;
648 WARN_ON(num_pages > nrptrs);
649 memset(pages, 0, sizeof(pages));
650 ret = prepare_pages(root, file, pages, num_pages,
651 pos, first_index, last_index,
652 write_bytes);
653 if (ret)
654 goto out;
656 ret = btrfs_copy_from_user(pos, num_pages,
657 write_bytes, pages, buf);
658 if (ret) {
659 btrfs_drop_pages(pages, num_pages);
660 goto out;
663 ret = dirty_and_release_pages(NULL, root, file, pages,
664 num_pages, pos, write_bytes);
665 btrfs_drop_pages(pages, num_pages);
666 if (ret)
667 goto out;
669 buf += write_bytes;
670 count -= write_bytes;
671 pos += write_bytes;
672 num_written += write_bytes;
674 balance_dirty_pages_ratelimited_nr(inode->i_mapping, num_pages);
675 btrfs_btree_balance_dirty(root);
676 cond_resched();
678 mutex_unlock(&inode->i_mutex);
679 out:
680 kfree(pages);
681 if (pinned[0])
682 page_cache_release(pinned[0]);
683 if (pinned[1])
684 page_cache_release(pinned[1]);
685 *ppos = pos;
686 current->backing_dev_info = NULL;
687 mark_inode_dirty(inode);
688 return num_written ? num_written : err;
691 static int btrfs_sync_file(struct file *file,
692 struct dentry *dentry, int datasync)
694 struct inode *inode = dentry->d_inode;
695 struct btrfs_root *root = BTRFS_I(inode)->root;
696 int ret;
697 struct btrfs_trans_handle *trans;
700 * FIXME, use inode generation number to check if we can skip the
701 * commit
703 mutex_lock(&root->fs_info->fs_mutex);
704 trans = btrfs_start_transaction(root, 1);
705 if (!trans) {
706 ret = -ENOMEM;
707 goto out;
709 ret = btrfs_commit_transaction(trans, root);
710 mutex_unlock(&root->fs_info->fs_mutex);
711 out:
712 return ret > 0 ? EIO : ret;
715 static struct vm_operations_struct btrfs_file_vm_ops = {
716 .nopage = filemap_nopage,
717 .populate = filemap_populate,
718 .page_mkwrite = btrfs_page_mkwrite,
721 static int btrfs_file_mmap(struct file *filp, struct vm_area_struct *vma)
723 vma->vm_ops = &btrfs_file_vm_ops;
724 file_accessed(filp);
725 return 0;
728 struct file_operations btrfs_file_operations = {
729 .llseek = generic_file_llseek,
730 .read = do_sync_read,
731 .aio_read = generic_file_aio_read,
732 .write = btrfs_file_write,
733 .mmap = btrfs_file_mmap,
734 .open = generic_file_open,
735 .ioctl = btrfs_ioctl,
736 .fsync = btrfs_sync_file,
737 #ifdef CONFIG_COMPAT
738 .compat_ioctl = btrfs_compat_ioctl,
739 #endif