tree-log.c (8d5bf1cb35ea29795862ff0ea2f4c4d7e22727f3) tree-log.c (49eb7e46d47ea72a9bd2a5f8cedb04f5159cc277)
1/*
2 * Copyright (C) 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,

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

1968 mutex_lock(&log->fs_info->tree_log_mutex);
1969 if (atomic_read(&log->fs_info->tree_log_commit)) {
1970 wait_log_commit(log);
1971 goto out;
1972 }
1973 atomic_set(&log->fs_info->tree_log_commit, 1);
1974
1975 while(1) {
1/*
2 * Copyright (C) 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,

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

1968 mutex_lock(&log->fs_info->tree_log_mutex);
1969 if (atomic_read(&log->fs_info->tree_log_commit)) {
1970 wait_log_commit(log);
1971 goto out;
1972 }
1973 atomic_set(&log->fs_info->tree_log_commit, 1);
1974
1975 while(1) {
1976 batch = log->fs_info->tree_log_batch;
1976 mutex_unlock(&log->fs_info->tree_log_mutex);
1977 schedule_timeout_uninterruptible(1);
1978 mutex_lock(&log->fs_info->tree_log_mutex);
1977 mutex_unlock(&log->fs_info->tree_log_mutex);
1978 schedule_timeout_uninterruptible(1);
1979 mutex_lock(&log->fs_info->tree_log_mutex);
1979 batch = log->fs_info->tree_log_batch;
1980
1981 while(atomic_read(&log->fs_info->tree_log_writers)) {
1982 DEFINE_WAIT(wait);
1983 prepare_to_wait(&log->fs_info->tree_log_wait, &wait,
1984 TASK_UNINTERRUPTIBLE);
1985 batch = log->fs_info->tree_log_batch;
1986 mutex_unlock(&log->fs_info->tree_log_mutex);
1987 if (atomic_read(&log->fs_info->tree_log_writers))

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

2184 log = root->log_root;
2185 mutex_lock(&BTRFS_I(inode)->log_mutex);
2186
2187 ret = btrfs_del_inode_ref(trans, log, name, name_len, inode->i_ino,
2188 dirid, &index);
2189 mutex_unlock(&BTRFS_I(inode)->log_mutex);
2190 end_log_trans(root);
2191
1980
1981 while(atomic_read(&log->fs_info->tree_log_writers)) {
1982 DEFINE_WAIT(wait);
1983 prepare_to_wait(&log->fs_info->tree_log_wait, &wait,
1984 TASK_UNINTERRUPTIBLE);
1985 batch = log->fs_info->tree_log_batch;
1986 mutex_unlock(&log->fs_info->tree_log_mutex);
1987 if (atomic_read(&log->fs_info->tree_log_writers))

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

2184 log = root->log_root;
2185 mutex_lock(&BTRFS_I(inode)->log_mutex);
2186
2187 ret = btrfs_del_inode_ref(trans, log, name, name_len, inode->i_ino,
2188 dirid, &index);
2189 mutex_unlock(&BTRFS_I(inode)->log_mutex);
2190 end_log_trans(root);
2191
2192 if (ret == 0 || ret == -ENOENT)
2193 return 0;
2194 return ret;
2195}
2196
2197/*
2198 * creates a range item in the log for 'dirid'. first_offset and
2199 * last_offset tell us which parts of the key space the log should
2200 * be considered authoritative for.
2201 */

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

2615 min_key.offset++;
2616 else if (min_key.type < (u8)-1)
2617 min_key.type++;
2618 else if (min_key.objectid < (u64)-1)
2619 min_key.objectid++;
2620 else
2621 break;
2622 }
2192 return ret;
2193}
2194
2195/*
2196 * creates a range item in the log for 'dirid'. first_offset and
2197 * last_offset tell us which parts of the key space the log should
2198 * be considered authoritative for.
2199 */

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

2613 min_key.offset++;
2614 else if (min_key.type < (u8)-1)
2615 min_key.type++;
2616 else if (min_key.objectid < (u64)-1)
2617 min_key.objectid++;
2618 else
2619 break;
2620 }
2623 if (inode_only == LOG_INODE_ALL && S_ISDIR(inode->i_mode)) {
2621 if (inode_only == LOG_INODE_ALL && S_ISDIR(inode->i_mode) &&
2622 BTRFS_I(inode)->log_dirty_trans >= trans->transid) {
2624 btrfs_release_path(root, path);
2625 btrfs_release_path(log, dst_path);
2623 btrfs_release_path(root, path);
2624 btrfs_release_path(log, dst_path);
2625 BTRFS_I(inode)->log_dirty_trans = 0;
2626 ret = log_directory_changes(trans, root, inode, path, dst_path);
2627 BUG_ON(ret);
2628 }
2629 mutex_unlock(&BTRFS_I(inode)->log_mutex);
2630
2631 btrfs_free_path(path);
2632 btrfs_free_path(dst_path);
2633

--- 183 unchanged lines hidden ---
2626 ret = log_directory_changes(trans, root, inode, path, dst_path);
2627 BUG_ON(ret);
2628 }
2629 mutex_unlock(&BTRFS_I(inode)->log_mutex);
2630
2631 btrfs_free_path(path);
2632 btrfs_free_path(dst_path);
2633

--- 183 unchanged lines hidden ---