aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jbd2
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jbd2')
-rw-r--r--fs/jbd2/journal.c72
1 files changed, 0 insertions, 72 deletions
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 34ef98057202..b10d7283ba5b 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -66,7 +66,6 @@ EXPORT_SYMBOL(jbd2_journal_update_format);
66EXPORT_SYMBOL(jbd2_journal_check_used_features); 66EXPORT_SYMBOL(jbd2_journal_check_used_features);
67EXPORT_SYMBOL(jbd2_journal_check_available_features); 67EXPORT_SYMBOL(jbd2_journal_check_available_features);
68EXPORT_SYMBOL(jbd2_journal_set_features); 68EXPORT_SYMBOL(jbd2_journal_set_features);
69EXPORT_SYMBOL(jbd2_journal_create);
70EXPORT_SYMBOL(jbd2_journal_load); 69EXPORT_SYMBOL(jbd2_journal_load);
71EXPORT_SYMBOL(jbd2_journal_destroy); 70EXPORT_SYMBOL(jbd2_journal_destroy);
72EXPORT_SYMBOL(jbd2_journal_abort); 71EXPORT_SYMBOL(jbd2_journal_abort);
@@ -1163,77 +1162,6 @@ static int journal_reset(journal_t *journal)
1163} 1162}
1164 1163
1165/** 1164/**
1166 * int jbd2_journal_create() - Initialise the new journal file
1167 * @journal: Journal to create. This structure must have been initialised
1168 *
1169 * Given a journal_t structure which tells us which disk blocks we can
1170 * use, create a new journal superblock and initialise all of the
1171 * journal fields from scratch.
1172 **/
1173int jbd2_journal_create(journal_t *journal)
1174{
1175 unsigned long long blocknr;
1176 struct buffer_head *bh;
1177 journal_superblock_t *sb;
1178 int i, err;
1179
1180 if (journal->j_maxlen < JBD2_MIN_JOURNAL_BLOCKS) {
1181 printk (KERN_ERR "Journal length (%d blocks) too short.\n",
1182 journal->j_maxlen);
1183 journal_fail_superblock(journal);
1184 return -EINVAL;
1185 }
1186
1187 if (journal->j_inode == NULL) {
1188 /*
1189 * We don't know what block to start at!
1190 */
1191 printk(KERN_EMERG
1192 "%s: creation of journal on external device!\n",
1193 __func__);
1194 BUG();
1195 }
1196
1197 /* Zero out the entire journal on disk. We cannot afford to
1198 have any blocks on disk beginning with JBD2_MAGIC_NUMBER. */
1199 jbd_debug(1, "JBD: Zeroing out journal blocks...\n");
1200 for (i = 0; i < journal->j_maxlen; i++) {
1201 err = jbd2_journal_bmap(journal, i, &blocknr);
1202 if (err)
1203 return err;
1204 bh = __getblk(journal->j_dev, blocknr, journal->j_blocksize);
1205 lock_buffer(bh);
1206 memset (bh->b_data, 0, journal->j_blocksize);
1207 BUFFER_TRACE(bh, "marking dirty");
1208 mark_buffer_dirty(bh);
1209 BUFFER_TRACE(bh, "marking uptodate");
1210 set_buffer_uptodate(bh);
1211 unlock_buffer(bh);
1212 __brelse(bh);
1213 }
1214
1215 sync_blockdev(journal->j_dev);
1216 jbd_debug(1, "JBD: journal cleared.\n");
1217
1218 /* OK, fill in the initial static fields in the new superblock */
1219 sb = journal->j_superblock;
1220
1221 sb->s_header.h_magic = cpu_to_be32(JBD2_MAGIC_NUMBER);
1222 sb->s_header.h_blocktype = cpu_to_be32(JBD2_SUPERBLOCK_V2);
1223
1224 sb->s_blocksize = cpu_to_be32(journal->j_blocksize);
1225 sb->s_maxlen = cpu_to_be32(journal->j_maxlen);
1226 sb->s_first = cpu_to_be32(1);
1227
1228 journal->j_transaction_sequence = 1;
1229
1230 journal->j_flags &= ~JBD2_ABORT;
1231 journal->j_format_version = 2;
1232
1233 return journal_reset(journal);
1234}
1235
1236/**
1237 * void jbd2_journal_update_superblock() - Update journal sb on disk. 1165 * void jbd2_journal_update_superblock() - Update journal sb on disk.
1238 * @journal: The journal to update. 1166 * @journal: The journal to update.
1239 * @wait: Set to '0' if you don't want to wait for IO completion. 1167 * @wait: Set to '0' if you don't want to wait for IO completion.