| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* -*- mode: c; c-basic-offset: 8; -*- |
|---|
| 2 | 3 | * vim: noexpandtab sw=8 ts=8 sts=0: |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 6 | 7 | * Defines journalling api and structures. |
|---|
| 7 | 8 | * |
|---|
| 8 | 9 | * Copyright (C) 2003, 2005 Oracle. All rights reserved. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is free software; you can redistribute it and/or |
|---|
| 11 | | - * modify it under the terms of the GNU General Public |
|---|
| 12 | | - * License as published by the Free Software Foundation; either |
|---|
| 13 | | - * version 2 of the License, or (at your option) any later version. |
|---|
| 14 | | - * |
|---|
| 15 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 16 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 17 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 18 | | - * General Public License for more details. |
|---|
| 19 | | - * |
|---|
| 20 | | - * You should have received a copy of the GNU General Public |
|---|
| 21 | | - * License along with this program; if not, write to the |
|---|
| 22 | | - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|---|
| 23 | | - * Boston, MA 021110-1307, USA. |
|---|
| 24 | 10 | */ |
|---|
| 25 | 11 | |
|---|
| 26 | 12 | #ifndef OCFS2_JOURNAL_H |
|---|
| .. | .. |
|---|
| 158 | 144 | void ocfs2_orphan_scan_init(struct ocfs2_super *osb); |
|---|
| 159 | 145 | void ocfs2_orphan_scan_start(struct ocfs2_super *osb); |
|---|
| 160 | 146 | void ocfs2_orphan_scan_stop(struct ocfs2_super *osb); |
|---|
| 161 | | -void ocfs2_orphan_scan_exit(struct ocfs2_super *osb); |
|---|
| 162 | 147 | |
|---|
| 163 | 148 | void ocfs2_complete_recovery(struct work_struct *work); |
|---|
| 164 | 149 | void ocfs2_wait_for_recovery(struct ocfs2_super *osb); |
|---|
| .. | .. |
|---|
| 167 | 152 | void ocfs2_recovery_exit(struct ocfs2_super *osb); |
|---|
| 168 | 153 | |
|---|
| 169 | 154 | int ocfs2_compute_replay_slots(struct ocfs2_super *osb); |
|---|
| 155 | +void ocfs2_free_replay_slots(struct ocfs2_super *osb); |
|---|
| 170 | 156 | /* |
|---|
| 171 | 157 | * Journal Control: |
|---|
| 172 | 158 | * Initialize, Load, Shutdown, Wipe a journal. |
|---|
| .. | .. |
|---|
| 246 | 232 | * ocfs2_journal_access_*() unless you intend to |
|---|
| 247 | 233 | * manage the checksum by hand. |
|---|
| 248 | 234 | * ocfs2_journal_dirty - Mark a journalled buffer as having dirty data. |
|---|
| 249 | | - * ocfs2_jbd2_file_inode - Mark an inode so that its data goes out before |
|---|
| 250 | | - * the current handle commits. |
|---|
| 235 | + * ocfs2_jbd2_inode_add_write - Mark an inode with range so that its data goes |
|---|
| 236 | + * out before the current handle commits. |
|---|
| 251 | 237 | */ |
|---|
| 252 | 238 | |
|---|
| 253 | 239 | /* You must always start_trans with a number of buffs > 0, but it's |
|---|
| .. | .. |
|---|
| 455 | 441 | * previous dirblock update in the free list */ |
|---|
| 456 | 442 | static inline int ocfs2_link_credits(struct super_block *sb) |
|---|
| 457 | 443 | { |
|---|
| 458 | | - return 2*OCFS2_INODE_UPDATE_CREDITS + 4 + |
|---|
| 444 | + return 2 * OCFS2_INODE_UPDATE_CREDITS + 4 + |
|---|
| 459 | 445 | ocfs2_quota_trans_credits(sb); |
|---|
| 460 | 446 | } |
|---|
| 461 | 447 | |
|---|
| .. | .. |
|---|
| 589 | 575 | return ocfs2_extent_recs_per_gd(sb); |
|---|
| 590 | 576 | } |
|---|
| 591 | 577 | |
|---|
| 592 | | -static inline int ocfs2_calc_tree_trunc_credits(struct super_block *sb, |
|---|
| 593 | | - unsigned int clusters_to_del, |
|---|
| 594 | | - struct ocfs2_dinode *fe, |
|---|
| 595 | | - struct ocfs2_extent_list *last_el) |
|---|
| 578 | +static inline int ocfs2_jbd2_inode_add_write(handle_t *handle, struct inode *inode, |
|---|
| 579 | + loff_t start_byte, loff_t length) |
|---|
| 596 | 580 | { |
|---|
| 597 | | - /* for dinode + all headers in this pass + update to next leaf */ |
|---|
| 598 | | - u16 next_free = le16_to_cpu(last_el->l_next_free_rec); |
|---|
| 599 | | - u16 tree_depth = le16_to_cpu(fe->id2.i_list.l_tree_depth); |
|---|
| 600 | | - int credits = 1 + tree_depth + 1; |
|---|
| 601 | | - int i; |
|---|
| 602 | | - |
|---|
| 603 | | - i = next_free - 1; |
|---|
| 604 | | - BUG_ON(i < 0); |
|---|
| 605 | | - |
|---|
| 606 | | - /* We may be deleting metadata blocks, so metadata alloc dinode + |
|---|
| 607 | | - one desc. block for each possible delete. */ |
|---|
| 608 | | - if (tree_depth && next_free == 1 && |
|---|
| 609 | | - ocfs2_rec_clusters(last_el, &last_el->l_recs[i]) == clusters_to_del) |
|---|
| 610 | | - credits += 1 + tree_depth; |
|---|
| 611 | | - |
|---|
| 612 | | - /* update to the truncate log. */ |
|---|
| 613 | | - credits += OCFS2_TRUNCATE_LOG_UPDATE; |
|---|
| 614 | | - |
|---|
| 615 | | - credits += ocfs2_quota_trans_credits(sb); |
|---|
| 616 | | - |
|---|
| 617 | | - return credits; |
|---|
| 618 | | -} |
|---|
| 619 | | - |
|---|
| 620 | | -static inline int ocfs2_jbd2_file_inode(handle_t *handle, struct inode *inode) |
|---|
| 621 | | -{ |
|---|
| 622 | | - return jbd2_journal_inode_add_write(handle, &OCFS2_I(inode)->ip_jinode); |
|---|
| 581 | + return jbd2_journal_inode_ranged_write(handle, |
|---|
| 582 | + &OCFS2_I(inode)->ip_jinode, |
|---|
| 583 | + start_byte, length); |
|---|
| 623 | 584 | } |
|---|
| 624 | 585 | |
|---|
| 625 | 586 | static inline int ocfs2_begin_ordered_truncate(struct inode *inode, |
|---|