ordered-data.c (9ffba8cda917c0158857426f0e74b64d0206aaa9) ordered-data.c (c1c9ff7c94e83fae89a742df74db51156869bad5)
1/*
2 * Copyright (C) 2007 Oracle. All rights reserved.
3 *
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.
7 *
8 * This program is distributed in the hope that it will be useful,

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

62 return NULL;
63}
64
65static void ordered_data_tree_panic(struct inode *inode, int errno,
66 u64 offset)
67{
68 struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
69 btrfs_panic(fs_info, errno, "Inconsistency in ordered tree at offset "
1/*
2 * Copyright (C) 2007 Oracle. All rights reserved.
3 *
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.
7 *
8 * This program is distributed in the hope that it will be useful,

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

62 return NULL;
63}
64
65static void ordered_data_tree_panic(struct inode *inode, int errno,
66 u64 offset)
67{
68 struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
69 btrfs_panic(fs_info, errno, "Inconsistency in ordered tree at offset "
70 "%llu\n", (unsigned long long)offset);
70 "%llu\n", offset);
71}
72
73/*
74 * look for a given offset in the tree, and if it can't be found return the
75 * first lesser offset
76 */
77static struct rb_node *__tree_search(struct rb_root *root, u64 file_offset,
78 struct rb_node **prev_ret)

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

331 }
332
333 dec_start = max(*file_offset, entry->file_offset);
334 dec_end = min(*file_offset + io_size, entry->file_offset +
335 entry->len);
336 *file_offset = dec_end;
337 if (dec_start > dec_end) {
338 printk(KERN_CRIT "bad ordering dec_start %llu end %llu\n",
71}
72
73/*
74 * look for a given offset in the tree, and if it can't be found return the
75 * first lesser offset
76 */
77static struct rb_node *__tree_search(struct rb_root *root, u64 file_offset,
78 struct rb_node **prev_ret)

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

331 }
332
333 dec_start = max(*file_offset, entry->file_offset);
334 dec_end = min(*file_offset + io_size, entry->file_offset +
335 entry->len);
336 *file_offset = dec_end;
337 if (dec_start > dec_end) {
338 printk(KERN_CRIT "bad ordering dec_start %llu end %llu\n",
339 (unsigned long long)dec_start,
340 (unsigned long long)dec_end);
339 dec_start, dec_end);
341 }
342 to_dec = dec_end - dec_start;
343 if (to_dec > entry->bytes_left) {
344 printk(KERN_CRIT "bad ordered accounting left %llu size %llu\n",
340 }
341 to_dec = dec_end - dec_start;
342 if (to_dec > entry->bytes_left) {
343 printk(KERN_CRIT "bad ordered accounting left %llu size %llu\n",
345 (unsigned long long)entry->bytes_left,
346 (unsigned long long)to_dec);
344 entry->bytes_left, to_dec);
347 }
348 entry->bytes_left -= to_dec;
349 if (!uptodate)
350 set_bit(BTRFS_ORDERED_IOERR, &entry->flags);
351
352 if (entry->bytes_left == 0)
353 ret = test_and_set_bit(BTRFS_ORDERED_IO_DONE, &entry->flags);
354 else

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

398have_entry:
399 if (!offset_in_entry(entry, file_offset)) {
400 ret = 1;
401 goto out;
402 }
403
404 if (io_size > entry->bytes_left) {
405 printk(KERN_CRIT "bad ordered accounting left %llu size %llu\n",
345 }
346 entry->bytes_left -= to_dec;
347 if (!uptodate)
348 set_bit(BTRFS_ORDERED_IOERR, &entry->flags);
349
350 if (entry->bytes_left == 0)
351 ret = test_and_set_bit(BTRFS_ORDERED_IO_DONE, &entry->flags);
352 else

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

396have_entry:
397 if (!offset_in_entry(entry, file_offset)) {
398 ret = 1;
399 goto out;
400 }
401
402 if (io_size > entry->bytes_left) {
403 printk(KERN_CRIT "bad ordered accounting left %llu size %llu\n",
406 (unsigned long long)entry->bytes_left,
407 (unsigned long long)io_size);
404 entry->bytes_left, io_size);
408 }
409 entry->bytes_left -= io_size;
410 if (!uptodate)
411 set_bit(BTRFS_ORDERED_IOERR, &entry->flags);
412
413 if (entry->bytes_left == 0)
414 ret = test_and_set_bit(BTRFS_ORDERED_IO_DONE, &entry->flags);
415 else

--- 707 unchanged lines hidden ---
405 }
406 entry->bytes_left -= io_size;
407 if (!uptodate)
408 set_bit(BTRFS_ORDERED_IOERR, &entry->flags);
409
410 if (entry->bytes_left == 0)
411 ret = test_and_set_bit(BTRFS_ORDERED_IO_DONE, &entry->flags);
412 else

--- 707 unchanged lines hidden ---