ctree.c (498456d33e2ee5150f045e604e4531b088083e7a) | ctree.c (e8b0d724d596f2ac1264ad830a04ef8e415be956) |
---|---|
1/* 2 * Copyright (C) 2007,2008 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, --- 4813 unchanged lines hidden (view full) --- 4822static int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path) 4823{ 4824 struct btrfs_key key; 4825 struct btrfs_disk_key found_key; 4826 int ret; 4827 4828 btrfs_item_key_to_cpu(path->nodes[0], &key, 0); 4829 | 1/* 2 * Copyright (C) 2007,2008 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, --- 4813 unchanged lines hidden (view full) --- 4822static int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path) 4823{ 4824 struct btrfs_key key; 4825 struct btrfs_disk_key found_key; 4826 int ret; 4827 4828 btrfs_item_key_to_cpu(path->nodes[0], &key, 0); 4829 |
4830 if (key.offset > 0) | 4830 if (key.offset > 0) { |
4831 key.offset--; | 4831 key.offset--; |
4832 else if (key.type > 0) | 4832 } else if (key.type > 0) { |
4833 key.type--; | 4833 key.type--; |
4834 else if (key.objectid > 0) | 4834 key.offset = (u64)-1; 4835 } else if (key.objectid > 0) { |
4835 key.objectid--; | 4836 key.objectid--; |
4836 else | 4837 key.type = (u8)-1; 4838 key.offset = (u64)-1; 4839 } else { |
4837 return 1; | 4840 return 1; |
4841 } |
|
4838 4839 btrfs_release_path(path); 4840 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); 4841 if (ret < 0) 4842 return ret; 4843 btrfs_item_key(path->nodes[0], &found_key, 0); 4844 ret = comp_keys(&found_key, &key); 4845 if (ret < 0) --- 835 unchanged lines hidden --- | 4842 4843 btrfs_release_path(path); 4844 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); 4845 if (ret < 0) 4846 return ret; 4847 btrfs_item_key(path->nodes[0], &found_key, 0); 4848 ret = comp_keys(&found_key, &key); 4849 if (ret < 0) --- 835 unchanged lines hidden --- |