hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/fs/ocfs2/journal.h
....@@ -1,3 +1,4 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /* -*- mode: c; c-basic-offset: 8; -*-
23 * vim: noexpandtab sw=8 ts=8 sts=0:
34 *
....@@ -6,21 +7,6 @@
67 * Defines journalling api and structures.
78 *
89 * 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.
2410 */
2511
2612 #ifndef OCFS2_JOURNAL_H
....@@ -158,7 +144,6 @@
158144 void ocfs2_orphan_scan_init(struct ocfs2_super *osb);
159145 void ocfs2_orphan_scan_start(struct ocfs2_super *osb);
160146 void ocfs2_orphan_scan_stop(struct ocfs2_super *osb);
161
-void ocfs2_orphan_scan_exit(struct ocfs2_super *osb);
162147
163148 void ocfs2_complete_recovery(struct work_struct *work);
164149 void ocfs2_wait_for_recovery(struct ocfs2_super *osb);
....@@ -246,8 +231,8 @@
246231 * ocfs2_journal_access_*() unless you intend to
247232 * manage the checksum by hand.
248233 * 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.
234
+ * ocfs2_jbd2_inode_add_write - Mark an inode with range so that its data goes
235
+ * out before the current handle commits.
251236 */
252237
253238 /* You must always start_trans with a number of buffs > 0, but it's
....@@ -455,7 +440,7 @@
455440 * previous dirblock update in the free list */
456441 static inline int ocfs2_link_credits(struct super_block *sb)
457442 {
458
- return 2*OCFS2_INODE_UPDATE_CREDITS + 4 +
443
+ return 2 * OCFS2_INODE_UPDATE_CREDITS + 4 +
459444 ocfs2_quota_trans_credits(sb);
460445 }
461446
....@@ -589,37 +574,12 @@
589574 return ocfs2_extent_recs_per_gd(sb);
590575 }
591576
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)
577
+static inline int ocfs2_jbd2_inode_add_write(handle_t *handle, struct inode *inode,
578
+ loff_t start_byte, loff_t length)
596579 {
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);
580
+ return jbd2_journal_inode_ranged_write(handle,
581
+ &OCFS2_I(inode)->ip_jinode,
582
+ start_byte, length);
623583 }
624584
625585 static inline int ocfs2_begin_ordered_truncate(struct inode *inode,