super.c 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215
  1. /*
  2. * super.c - NILFS module and super block management.
  3. *
  4. * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  19. *
  20. * Written by Ryusuke Konishi <ryusuke@osrg.net>
  21. */
  22. /*
  23. * linux/fs/ext2/super.c
  24. *
  25. * Copyright (C) 1992, 1993, 1994, 1995
  26. * Remy Card (card@masi.ibp.fr)
  27. * Laboratoire MASI - Institut Blaise Pascal
  28. * Universite Pierre et Marie Curie (Paris VI)
  29. *
  30. * from
  31. *
  32. * linux/fs/minix/inode.c
  33. *
  34. * Copyright (C) 1991, 1992 Linus Torvalds
  35. *
  36. * Big-endian to little-endian byte-swapping/bitmaps by
  37. * David S. Miller (davem@caip.rutgers.edu), 1995
  38. */
  39. #include <linux/module.h>
  40. #include <linux/string.h>
  41. #include <linux/slab.h>
  42. #include <linux/init.h>
  43. #include <linux/blkdev.h>
  44. #include <linux/parser.h>
  45. #include <linux/random.h>
  46. #include <linux/crc32.h>
  47. #include <linux/smp_lock.h>
  48. #include <linux/vfs.h>
  49. #include <linux/writeback.h>
  50. #include <linux/kobject.h>
  51. #include <linux/exportfs.h>
  52. #include <linux/seq_file.h>
  53. #include <linux/mount.h>
  54. #include "nilfs.h"
  55. #include "mdt.h"
  56. #include "alloc.h"
  57. #include "page.h"
  58. #include "cpfile.h"
  59. #include "ifile.h"
  60. #include "dat.h"
  61. #include "segment.h"
  62. #include "segbuf.h"
  63. MODULE_AUTHOR("NTT Corp.");
  64. MODULE_DESCRIPTION("A New Implementation of the Log-structured Filesystem "
  65. "(NILFS)");
  66. MODULE_LICENSE("GPL");
  67. struct kmem_cache *nilfs_inode_cachep;
  68. struct kmem_cache *nilfs_transaction_cachep;
  69. struct kmem_cache *nilfs_segbuf_cachep;
  70. struct kmem_cache *nilfs_btree_path_cache;
  71. static int nilfs_remount(struct super_block *sb, int *flags, char *data);
  72. /**
  73. * nilfs_error() - report failure condition on a filesystem
  74. *
  75. * nilfs_error() sets an ERROR_FS flag on the superblock as well as
  76. * reporting an error message. It should be called when NILFS detects
  77. * incoherences or defects of meta data on disk. As for sustainable
  78. * errors such as a single-shot I/O error, nilfs_warning() or the printk()
  79. * function should be used instead.
  80. *
  81. * The segment constructor must not call this function because it can
  82. * kill itself.
  83. */
  84. void nilfs_error(struct super_block *sb, const char *function,
  85. const char *fmt, ...)
  86. {
  87. struct nilfs_sb_info *sbi = NILFS_SB(sb);
  88. va_list args;
  89. va_start(args, fmt);
  90. printk(KERN_CRIT "NILFS error (device %s): %s: ", sb->s_id, function);
  91. vprintk(fmt, args);
  92. printk("\n");
  93. va_end(args);
  94. if (!(sb->s_flags & MS_RDONLY)) {
  95. struct the_nilfs *nilfs = sbi->s_nilfs;
  96. down_write(&nilfs->ns_sem);
  97. if (!(nilfs->ns_mount_state & NILFS_ERROR_FS)) {
  98. nilfs->ns_mount_state |= NILFS_ERROR_FS;
  99. nilfs->ns_sbp[0]->s_state |=
  100. cpu_to_le16(NILFS_ERROR_FS);
  101. nilfs_commit_super(sbi, 1);
  102. }
  103. up_write(&nilfs->ns_sem);
  104. if (nilfs_test_opt(sbi, ERRORS_RO)) {
  105. printk(KERN_CRIT "Remounting filesystem read-only\n");
  106. sb->s_flags |= MS_RDONLY;
  107. }
  108. }
  109. if (nilfs_test_opt(sbi, ERRORS_PANIC))
  110. panic("NILFS (device %s): panic forced after error\n",
  111. sb->s_id);
  112. }
  113. void nilfs_warning(struct super_block *sb, const char *function,
  114. const char *fmt, ...)
  115. {
  116. va_list args;
  117. va_start(args, fmt);
  118. printk(KERN_WARNING "NILFS warning (device %s): %s: ",
  119. sb->s_id, function);
  120. vprintk(fmt, args);
  121. printk("\n");
  122. va_end(args);
  123. }
  124. struct inode *nilfs_alloc_inode_common(struct the_nilfs *nilfs)
  125. {
  126. struct nilfs_inode_info *ii;
  127. ii = kmem_cache_alloc(nilfs_inode_cachep, GFP_NOFS);
  128. if (!ii)
  129. return NULL;
  130. ii->i_bh = NULL;
  131. ii->i_state = 0;
  132. ii->vfs_inode.i_version = 1;
  133. nilfs_btnode_cache_init(&ii->i_btnode_cache, nilfs->ns_bdi);
  134. return &ii->vfs_inode;
  135. }
  136. struct inode *nilfs_alloc_inode(struct super_block *sb)
  137. {
  138. return nilfs_alloc_inode_common(NILFS_SB(sb)->s_nilfs);
  139. }
  140. void nilfs_destroy_inode(struct inode *inode)
  141. {
  142. kmem_cache_free(nilfs_inode_cachep, NILFS_I(inode));
  143. }
  144. static void nilfs_clear_inode(struct inode *inode)
  145. {
  146. struct nilfs_inode_info *ii = NILFS_I(inode);
  147. /*
  148. * Free resources allocated in nilfs_read_inode(), here.
  149. */
  150. BUG_ON(!list_empty(&ii->i_dirty));
  151. brelse(ii->i_bh);
  152. ii->i_bh = NULL;
  153. if (test_bit(NILFS_I_BMAP, &ii->i_state))
  154. nilfs_bmap_clear(ii->i_bmap);
  155. nilfs_btnode_cache_clear(&ii->i_btnode_cache);
  156. }
  157. static int nilfs_sync_super(struct nilfs_sb_info *sbi, int dupsb)
  158. {
  159. struct the_nilfs *nilfs = sbi->s_nilfs;
  160. int err;
  161. int barrier_done = 0;
  162. if (nilfs_test_opt(sbi, BARRIER)) {
  163. set_buffer_ordered(nilfs->ns_sbh[0]);
  164. barrier_done = 1;
  165. }
  166. retry:
  167. set_buffer_dirty(nilfs->ns_sbh[0]);
  168. err = sync_dirty_buffer(nilfs->ns_sbh[0]);
  169. if (err == -EOPNOTSUPP && barrier_done) {
  170. nilfs_warning(sbi->s_super, __func__,
  171. "barrier-based sync failed. "
  172. "disabling barriers\n");
  173. nilfs_clear_opt(sbi, BARRIER);
  174. barrier_done = 0;
  175. clear_buffer_ordered(nilfs->ns_sbh[0]);
  176. goto retry;
  177. }
  178. if (unlikely(err)) {
  179. printk(KERN_ERR
  180. "NILFS: unable to write superblock (err=%d)\n", err);
  181. if (err == -EIO && nilfs->ns_sbh[1]) {
  182. nilfs_fall_back_super_block(nilfs);
  183. goto retry;
  184. }
  185. } else {
  186. struct nilfs_super_block *sbp = nilfs->ns_sbp[0];
  187. /*
  188. * The latest segment becomes trailable from the position
  189. * written in superblock.
  190. */
  191. clear_nilfs_discontinued(nilfs);
  192. /* update GC protection for recent segments */
  193. if (nilfs->ns_sbh[1]) {
  194. sbp = NULL;
  195. if (dupsb) {
  196. set_buffer_dirty(nilfs->ns_sbh[1]);
  197. if (!sync_dirty_buffer(nilfs->ns_sbh[1]))
  198. sbp = nilfs->ns_sbp[1];
  199. }
  200. }
  201. if (sbp) {
  202. spin_lock(&nilfs->ns_last_segment_lock);
  203. nilfs->ns_prot_seq = le64_to_cpu(sbp->s_last_seq);
  204. spin_unlock(&nilfs->ns_last_segment_lock);
  205. }
  206. }
  207. return err;
  208. }
  209. int nilfs_commit_super(struct nilfs_sb_info *sbi, int dupsb)
  210. {
  211. struct the_nilfs *nilfs = sbi->s_nilfs;
  212. struct nilfs_super_block **sbp = nilfs->ns_sbp;
  213. sector_t nfreeblocks;
  214. time_t t;
  215. int err;
  216. /* nilfs->sem must be locked by the caller. */
  217. if (sbp[0]->s_magic != cpu_to_le16(NILFS_SUPER_MAGIC)) {
  218. if (sbp[1] && sbp[1]->s_magic == cpu_to_le16(NILFS_SUPER_MAGIC))
  219. nilfs_swap_super_block(nilfs);
  220. else {
  221. printk(KERN_CRIT "NILFS: superblock broke on dev %s\n",
  222. sbi->s_super->s_id);
  223. return -EIO;
  224. }
  225. }
  226. err = nilfs_count_free_blocks(nilfs, &nfreeblocks);
  227. if (unlikely(err)) {
  228. printk(KERN_ERR "NILFS: failed to count free blocks\n");
  229. return err;
  230. }
  231. spin_lock(&nilfs->ns_last_segment_lock);
  232. sbp[0]->s_last_seq = cpu_to_le64(nilfs->ns_last_seq);
  233. sbp[0]->s_last_pseg = cpu_to_le64(nilfs->ns_last_pseg);
  234. sbp[0]->s_last_cno = cpu_to_le64(nilfs->ns_last_cno);
  235. spin_unlock(&nilfs->ns_last_segment_lock);
  236. t = get_seconds();
  237. nilfs->ns_sbwtime[0] = t;
  238. sbp[0]->s_free_blocks_count = cpu_to_le64(nfreeblocks);
  239. sbp[0]->s_wtime = cpu_to_le64(t);
  240. sbp[0]->s_sum = 0;
  241. sbp[0]->s_sum = cpu_to_le32(crc32_le(nilfs->ns_crc_seed,
  242. (unsigned char *)sbp[0],
  243. nilfs->ns_sbsize));
  244. if (dupsb && sbp[1]) {
  245. memcpy(sbp[1], sbp[0], nilfs->ns_sbsize);
  246. nilfs->ns_sbwtime[1] = t;
  247. }
  248. clear_nilfs_sb_dirty(nilfs);
  249. return nilfs_sync_super(sbi, dupsb);
  250. }
  251. static void nilfs_put_super(struct super_block *sb)
  252. {
  253. struct nilfs_sb_info *sbi = NILFS_SB(sb);
  254. struct the_nilfs *nilfs = sbi->s_nilfs;
  255. lock_kernel();
  256. nilfs_detach_segment_constructor(sbi);
  257. if (!(sb->s_flags & MS_RDONLY)) {
  258. down_write(&nilfs->ns_sem);
  259. nilfs->ns_sbp[0]->s_state = cpu_to_le16(nilfs->ns_mount_state);
  260. nilfs_commit_super(sbi, 1);
  261. up_write(&nilfs->ns_sem);
  262. }
  263. down_write(&nilfs->ns_super_sem);
  264. if (nilfs->ns_current == sbi)
  265. nilfs->ns_current = NULL;
  266. up_write(&nilfs->ns_super_sem);
  267. nilfs_detach_checkpoint(sbi);
  268. put_nilfs(sbi->s_nilfs);
  269. sbi->s_super = NULL;
  270. sb->s_fs_info = NULL;
  271. nilfs_put_sbinfo(sbi);
  272. unlock_kernel();
  273. }
  274. static int nilfs_sync_fs(struct super_block *sb, int wait)
  275. {
  276. struct nilfs_sb_info *sbi = NILFS_SB(sb);
  277. struct the_nilfs *nilfs = sbi->s_nilfs;
  278. int err = 0;
  279. /* This function is called when super block should be written back */
  280. if (wait)
  281. err = nilfs_construct_segment(sb);
  282. down_write(&nilfs->ns_sem);
  283. if (nilfs_sb_dirty(nilfs))
  284. nilfs_commit_super(sbi, 1);
  285. up_write(&nilfs->ns_sem);
  286. return err;
  287. }
  288. int nilfs_attach_checkpoint(struct nilfs_sb_info *sbi, __u64 cno)
  289. {
  290. struct the_nilfs *nilfs = sbi->s_nilfs;
  291. struct nilfs_checkpoint *raw_cp;
  292. struct buffer_head *bh_cp;
  293. int err;
  294. down_write(&nilfs->ns_super_sem);
  295. list_add(&sbi->s_list, &nilfs->ns_supers);
  296. up_write(&nilfs->ns_super_sem);
  297. sbi->s_ifile = nilfs_ifile_new(sbi, nilfs->ns_inode_size);
  298. if (!sbi->s_ifile)
  299. return -ENOMEM;
  300. down_read(&nilfs->ns_segctor_sem);
  301. err = nilfs_cpfile_get_checkpoint(nilfs->ns_cpfile, cno, 0, &raw_cp,
  302. &bh_cp);
  303. up_read(&nilfs->ns_segctor_sem);
  304. if (unlikely(err)) {
  305. if (err == -ENOENT || err == -EINVAL) {
  306. printk(KERN_ERR
  307. "NILFS: Invalid checkpoint "
  308. "(checkpoint number=%llu)\n",
  309. (unsigned long long)cno);
  310. err = -EINVAL;
  311. }
  312. goto failed;
  313. }
  314. err = nilfs_read_inode_common(sbi->s_ifile, &raw_cp->cp_ifile_inode);
  315. if (unlikely(err))
  316. goto failed_bh;
  317. atomic_set(&sbi->s_inodes_count, le64_to_cpu(raw_cp->cp_inodes_count));
  318. atomic_set(&sbi->s_blocks_count, le64_to_cpu(raw_cp->cp_blocks_count));
  319. nilfs_cpfile_put_checkpoint(nilfs->ns_cpfile, cno, bh_cp);
  320. return 0;
  321. failed_bh:
  322. nilfs_cpfile_put_checkpoint(nilfs->ns_cpfile, cno, bh_cp);
  323. failed:
  324. nilfs_mdt_destroy(sbi->s_ifile);
  325. sbi->s_ifile = NULL;
  326. down_write(&nilfs->ns_super_sem);
  327. list_del_init(&sbi->s_list);
  328. up_write(&nilfs->ns_super_sem);
  329. return err;
  330. }
  331. void nilfs_detach_checkpoint(struct nilfs_sb_info *sbi)
  332. {
  333. struct the_nilfs *nilfs = sbi->s_nilfs;
  334. nilfs_mdt_destroy(sbi->s_ifile);
  335. sbi->s_ifile = NULL;
  336. down_write(&nilfs->ns_super_sem);
  337. list_del_init(&sbi->s_list);
  338. up_write(&nilfs->ns_super_sem);
  339. }
  340. static int nilfs_statfs(struct dentry *dentry, struct kstatfs *buf)
  341. {
  342. struct super_block *sb = dentry->d_sb;
  343. struct nilfs_sb_info *sbi = NILFS_SB(sb);
  344. struct the_nilfs *nilfs = sbi->s_nilfs;
  345. u64 id = huge_encode_dev(sb->s_bdev->bd_dev);
  346. unsigned long long blocks;
  347. unsigned long overhead;
  348. unsigned long nrsvblocks;
  349. sector_t nfreeblocks;
  350. int err;
  351. /*
  352. * Compute all of the segment blocks
  353. *
  354. * The blocks before first segment and after last segment
  355. * are excluded.
  356. */
  357. blocks = nilfs->ns_blocks_per_segment * nilfs->ns_nsegments
  358. - nilfs->ns_first_data_block;
  359. nrsvblocks = nilfs->ns_nrsvsegs * nilfs->ns_blocks_per_segment;
  360. /*
  361. * Compute the overhead
  362. *
  363. * When distributing meta data blocks outside segment structure,
  364. * We must count them as the overhead.
  365. */
  366. overhead = 0;
  367. err = nilfs_count_free_blocks(nilfs, &nfreeblocks);
  368. if (unlikely(err))
  369. return err;
  370. buf->f_type = NILFS_SUPER_MAGIC;
  371. buf->f_bsize = sb->s_blocksize;
  372. buf->f_blocks = blocks - overhead;
  373. buf->f_bfree = nfreeblocks;
  374. buf->f_bavail = (buf->f_bfree >= nrsvblocks) ?
  375. (buf->f_bfree - nrsvblocks) : 0;
  376. buf->f_files = atomic_read(&sbi->s_inodes_count);
  377. buf->f_ffree = 0; /* nilfs_count_free_inodes(sb); */
  378. buf->f_namelen = NILFS_NAME_LEN;
  379. buf->f_fsid.val[0] = (u32)id;
  380. buf->f_fsid.val[1] = (u32)(id >> 32);
  381. return 0;
  382. }
  383. static int nilfs_show_options(struct seq_file *seq, struct vfsmount *vfs)
  384. {
  385. struct super_block *sb = vfs->mnt_sb;
  386. struct nilfs_sb_info *sbi = NILFS_SB(sb);
  387. if (!nilfs_test_opt(sbi, BARRIER))
  388. seq_printf(seq, ",nobarrier");
  389. if (nilfs_test_opt(sbi, SNAPSHOT))
  390. seq_printf(seq, ",cp=%llu",
  391. (unsigned long long int)sbi->s_snapshot_cno);
  392. if (nilfs_test_opt(sbi, ERRORS_PANIC))
  393. seq_printf(seq, ",errors=panic");
  394. if (nilfs_test_opt(sbi, ERRORS_CONT))
  395. seq_printf(seq, ",errors=continue");
  396. if (nilfs_test_opt(sbi, STRICT_ORDER))
  397. seq_printf(seq, ",order=strict");
  398. if (nilfs_test_opt(sbi, NORECOVERY))
  399. seq_printf(seq, ",norecovery");
  400. if (nilfs_test_opt(sbi, DISCARD))
  401. seq_printf(seq, ",discard");
  402. return 0;
  403. }
  404. static const struct super_operations nilfs_sops = {
  405. .alloc_inode = nilfs_alloc_inode,
  406. .destroy_inode = nilfs_destroy_inode,
  407. .dirty_inode = nilfs_dirty_inode,
  408. /* .write_inode = nilfs_write_inode, */
  409. /* .put_inode = nilfs_put_inode, */
  410. /* .drop_inode = nilfs_drop_inode, */
  411. .delete_inode = nilfs_delete_inode,
  412. .put_super = nilfs_put_super,
  413. /* .write_super = nilfs_write_super, */
  414. .sync_fs = nilfs_sync_fs,
  415. /* .write_super_lockfs */
  416. /* .unlockfs */
  417. .statfs = nilfs_statfs,
  418. .remount_fs = nilfs_remount,
  419. .clear_inode = nilfs_clear_inode,
  420. /* .umount_begin */
  421. .show_options = nilfs_show_options
  422. };
  423. static struct inode *
  424. nilfs_nfs_get_inode(struct super_block *sb, u64 ino, u32 generation)
  425. {
  426. struct inode *inode;
  427. if (ino < NILFS_FIRST_INO(sb) && ino != NILFS_ROOT_INO &&
  428. ino != NILFS_SKETCH_INO)
  429. return ERR_PTR(-ESTALE);
  430. inode = nilfs_iget(sb, ino);
  431. if (IS_ERR(inode))
  432. return ERR_CAST(inode);
  433. if (generation && inode->i_generation != generation) {
  434. iput(inode);
  435. return ERR_PTR(-ESTALE);
  436. }
  437. return inode;
  438. }
  439. static struct dentry *
  440. nilfs_fh_to_dentry(struct super_block *sb, struct fid *fid, int fh_len,
  441. int fh_type)
  442. {
  443. return generic_fh_to_dentry(sb, fid, fh_len, fh_type,
  444. nilfs_nfs_get_inode);
  445. }
  446. static struct dentry *
  447. nilfs_fh_to_parent(struct super_block *sb, struct fid *fid, int fh_len,
  448. int fh_type)
  449. {
  450. return generic_fh_to_parent(sb, fid, fh_len, fh_type,
  451. nilfs_nfs_get_inode);
  452. }
  453. static const struct export_operations nilfs_export_ops = {
  454. .fh_to_dentry = nilfs_fh_to_dentry,
  455. .fh_to_parent = nilfs_fh_to_parent,
  456. .get_parent = nilfs_get_parent,
  457. };
  458. enum {
  459. Opt_err_cont, Opt_err_panic, Opt_err_ro,
  460. Opt_nobarrier, Opt_snapshot, Opt_order, Opt_norecovery,
  461. Opt_discard, Opt_err,
  462. };
  463. static match_table_t tokens = {
  464. {Opt_err_cont, "errors=continue"},
  465. {Opt_err_panic, "errors=panic"},
  466. {Opt_err_ro, "errors=remount-ro"},
  467. {Opt_nobarrier, "nobarrier"},
  468. {Opt_snapshot, "cp=%u"},
  469. {Opt_order, "order=%s"},
  470. {Opt_norecovery, "norecovery"},
  471. {Opt_discard, "discard"},
  472. {Opt_err, NULL}
  473. };
  474. static int parse_options(char *options, struct super_block *sb)
  475. {
  476. struct nilfs_sb_info *sbi = NILFS_SB(sb);
  477. char *p;
  478. substring_t args[MAX_OPT_ARGS];
  479. int option;
  480. if (!options)
  481. return 1;
  482. while ((p = strsep(&options, ",")) != NULL) {
  483. int token;
  484. if (!*p)
  485. continue;
  486. token = match_token(p, tokens, args);
  487. switch (token) {
  488. case Opt_nobarrier:
  489. nilfs_clear_opt(sbi, BARRIER);
  490. break;
  491. case Opt_order:
  492. if (strcmp(args[0].from, "relaxed") == 0)
  493. /* Ordered data semantics */
  494. nilfs_clear_opt(sbi, STRICT_ORDER);
  495. else if (strcmp(args[0].from, "strict") == 0)
  496. /* Strict in-order semantics */
  497. nilfs_set_opt(sbi, STRICT_ORDER);
  498. else
  499. return 0;
  500. break;
  501. case Opt_err_panic:
  502. nilfs_write_opt(sbi, ERROR_MODE, ERRORS_PANIC);
  503. break;
  504. case Opt_err_ro:
  505. nilfs_write_opt(sbi, ERROR_MODE, ERRORS_RO);
  506. break;
  507. case Opt_err_cont:
  508. nilfs_write_opt(sbi, ERROR_MODE, ERRORS_CONT);
  509. break;
  510. case Opt_snapshot:
  511. if (match_int(&args[0], &option) || option <= 0)
  512. return 0;
  513. if (!(sb->s_flags & MS_RDONLY))
  514. return 0;
  515. sbi->s_snapshot_cno = option;
  516. nilfs_set_opt(sbi, SNAPSHOT);
  517. break;
  518. case Opt_norecovery:
  519. nilfs_set_opt(sbi, NORECOVERY);
  520. break;
  521. case Opt_discard:
  522. nilfs_set_opt(sbi, DISCARD);
  523. break;
  524. default:
  525. printk(KERN_ERR
  526. "NILFS: Unrecognized mount option \"%s\"\n", p);
  527. return 0;
  528. }
  529. }
  530. return 1;
  531. }
  532. static inline void
  533. nilfs_set_default_options(struct nilfs_sb_info *sbi,
  534. struct nilfs_super_block *sbp)
  535. {
  536. sbi->s_mount_opt =
  537. NILFS_MOUNT_ERRORS_RO | NILFS_MOUNT_BARRIER;
  538. }
  539. static int nilfs_setup_super(struct nilfs_sb_info *sbi)
  540. {
  541. struct the_nilfs *nilfs = sbi->s_nilfs;
  542. struct nilfs_super_block *sbp = nilfs->ns_sbp[0];
  543. int max_mnt_count = le16_to_cpu(sbp->s_max_mnt_count);
  544. int mnt_count = le16_to_cpu(sbp->s_mnt_count);
  545. /* nilfs->sem must be locked by the caller. */
  546. if (nilfs->ns_mount_state & NILFS_ERROR_FS) {
  547. printk(KERN_WARNING
  548. "NILFS warning: mounting fs with errors\n");
  549. #if 0
  550. } else if (max_mnt_count >= 0 && mnt_count >= max_mnt_count) {
  551. printk(KERN_WARNING
  552. "NILFS warning: maximal mount count reached\n");
  553. #endif
  554. }
  555. if (!max_mnt_count)
  556. sbp->s_max_mnt_count = cpu_to_le16(NILFS_DFL_MAX_MNT_COUNT);
  557. sbp->s_mnt_count = cpu_to_le16(mnt_count + 1);
  558. sbp->s_state = cpu_to_le16(le16_to_cpu(sbp->s_state) & ~NILFS_VALID_FS);
  559. sbp->s_mtime = cpu_to_le64(get_seconds());
  560. return nilfs_commit_super(sbi, 1);
  561. }
  562. struct nilfs_super_block *nilfs_read_super_block(struct super_block *sb,
  563. u64 pos, int blocksize,
  564. struct buffer_head **pbh)
  565. {
  566. unsigned long long sb_index = pos;
  567. unsigned long offset;
  568. offset = do_div(sb_index, blocksize);
  569. *pbh = sb_bread(sb, sb_index);
  570. if (!*pbh)
  571. return NULL;
  572. return (struct nilfs_super_block *)((char *)(*pbh)->b_data + offset);
  573. }
  574. int nilfs_store_magic_and_option(struct super_block *sb,
  575. struct nilfs_super_block *sbp,
  576. char *data)
  577. {
  578. struct nilfs_sb_info *sbi = NILFS_SB(sb);
  579. sb->s_magic = le16_to_cpu(sbp->s_magic);
  580. /* FS independent flags */
  581. #ifdef NILFS_ATIME_DISABLE
  582. sb->s_flags |= MS_NOATIME;
  583. #endif
  584. nilfs_set_default_options(sbi, sbp);
  585. sbi->s_resuid = le16_to_cpu(sbp->s_def_resuid);
  586. sbi->s_resgid = le16_to_cpu(sbp->s_def_resgid);
  587. sbi->s_interval = le32_to_cpu(sbp->s_c_interval);
  588. sbi->s_watermark = le32_to_cpu(sbp->s_c_block_max);
  589. return !parse_options(data, sb) ? -EINVAL : 0 ;
  590. }
  591. /**
  592. * nilfs_fill_super() - initialize a super block instance
  593. * @sb: super_block
  594. * @data: mount options
  595. * @silent: silent mode flag
  596. * @nilfs: the_nilfs struct
  597. *
  598. * This function is called exclusively by nilfs->ns_mount_mutex.
  599. * So, the recovery process is protected from other simultaneous mounts.
  600. */
  601. static int
  602. nilfs_fill_super(struct super_block *sb, void *data, int silent,
  603. struct the_nilfs *nilfs)
  604. {
  605. struct nilfs_sb_info *sbi;
  606. struct inode *root;
  607. __u64 cno;
  608. int err;
  609. sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
  610. if (!sbi)
  611. return -ENOMEM;
  612. sb->s_fs_info = sbi;
  613. get_nilfs(nilfs);
  614. sbi->s_nilfs = nilfs;
  615. sbi->s_super = sb;
  616. atomic_set(&sbi->s_count, 1);
  617. err = init_nilfs(nilfs, sbi, (char *)data);
  618. if (err)
  619. goto failed_sbi;
  620. spin_lock_init(&sbi->s_inode_lock);
  621. INIT_LIST_HEAD(&sbi->s_dirty_files);
  622. INIT_LIST_HEAD(&sbi->s_list);
  623. /*
  624. * Following initialization is overlapped because
  625. * nilfs_sb_info structure has been cleared at the beginning.
  626. * But we reserve them to keep our interest and make ready
  627. * for the future change.
  628. */
  629. get_random_bytes(&sbi->s_next_generation,
  630. sizeof(sbi->s_next_generation));
  631. spin_lock_init(&sbi->s_next_gen_lock);
  632. sb->s_op = &nilfs_sops;
  633. sb->s_export_op = &nilfs_export_ops;
  634. sb->s_root = NULL;
  635. sb->s_time_gran = 1;
  636. sb->s_bdi = nilfs->ns_bdi;
  637. err = load_nilfs(nilfs, sbi);
  638. if (err)
  639. goto failed_sbi;
  640. cno = nilfs_last_cno(nilfs);
  641. if (sb->s_flags & MS_RDONLY) {
  642. if (nilfs_test_opt(sbi, SNAPSHOT)) {
  643. down_read(&nilfs->ns_segctor_sem);
  644. err = nilfs_cpfile_is_snapshot(nilfs->ns_cpfile,
  645. sbi->s_snapshot_cno);
  646. up_read(&nilfs->ns_segctor_sem);
  647. if (err < 0) {
  648. if (err == -ENOENT)
  649. err = -EINVAL;
  650. goto failed_sbi;
  651. }
  652. if (!err) {
  653. printk(KERN_ERR
  654. "NILFS: The specified checkpoint is "
  655. "not a snapshot "
  656. "(checkpoint number=%llu).\n",
  657. (unsigned long long)sbi->s_snapshot_cno);
  658. err = -EINVAL;
  659. goto failed_sbi;
  660. }
  661. cno = sbi->s_snapshot_cno;
  662. } else
  663. /* Read-only mount */
  664. sbi->s_snapshot_cno = cno;
  665. }
  666. err = nilfs_attach_checkpoint(sbi, cno);
  667. if (err) {
  668. printk(KERN_ERR "NILFS: error loading a checkpoint"
  669. " (checkpoint number=%llu).\n", (unsigned long long)cno);
  670. goto failed_sbi;
  671. }
  672. if (!(sb->s_flags & MS_RDONLY)) {
  673. err = nilfs_attach_segment_constructor(sbi);
  674. if (err)
  675. goto failed_checkpoint;
  676. }
  677. root = nilfs_iget(sb, NILFS_ROOT_INO);
  678. if (IS_ERR(root)) {
  679. printk(KERN_ERR "NILFS: get root inode failed\n");
  680. err = PTR_ERR(root);
  681. goto failed_segctor;
  682. }
  683. if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) {
  684. iput(root);
  685. printk(KERN_ERR "NILFS: corrupt root inode.\n");
  686. err = -EINVAL;
  687. goto failed_segctor;
  688. }
  689. sb->s_root = d_alloc_root(root);
  690. if (!sb->s_root) {
  691. iput(root);
  692. printk(KERN_ERR "NILFS: get root dentry failed\n");
  693. err = -ENOMEM;
  694. goto failed_segctor;
  695. }
  696. if (!(sb->s_flags & MS_RDONLY)) {
  697. down_write(&nilfs->ns_sem);
  698. nilfs_setup_super(sbi);
  699. up_write(&nilfs->ns_sem);
  700. }
  701. down_write(&nilfs->ns_super_sem);
  702. if (!nilfs_test_opt(sbi, SNAPSHOT))
  703. nilfs->ns_current = sbi;
  704. up_write(&nilfs->ns_super_sem);
  705. return 0;
  706. failed_segctor:
  707. nilfs_detach_segment_constructor(sbi);
  708. failed_checkpoint:
  709. nilfs_detach_checkpoint(sbi);
  710. failed_sbi:
  711. put_nilfs(nilfs);
  712. sb->s_fs_info = NULL;
  713. nilfs_put_sbinfo(sbi);
  714. return err;
  715. }
  716. static int nilfs_remount(struct super_block *sb, int *flags, char *data)
  717. {
  718. struct nilfs_sb_info *sbi = NILFS_SB(sb);
  719. struct nilfs_super_block *sbp;
  720. struct the_nilfs *nilfs = sbi->s_nilfs;
  721. unsigned long old_sb_flags;
  722. struct nilfs_mount_options old_opts;
  723. int err;
  724. lock_kernel();
  725. down_write(&nilfs->ns_super_sem);
  726. old_sb_flags = sb->s_flags;
  727. old_opts.mount_opt = sbi->s_mount_opt;
  728. old_opts.snapshot_cno = sbi->s_snapshot_cno;
  729. if (!parse_options(data, sb)) {
  730. err = -EINVAL;
  731. goto restore_opts;
  732. }
  733. sb->s_flags = (sb->s_flags & ~MS_POSIXACL);
  734. if ((*flags & MS_RDONLY) &&
  735. sbi->s_snapshot_cno != old_opts.snapshot_cno) {
  736. printk(KERN_WARNING "NILFS (device %s): couldn't "
  737. "remount to a different snapshot.\n",
  738. sb->s_id);
  739. err = -EINVAL;
  740. goto restore_opts;
  741. }
  742. if (!nilfs_valid_fs(nilfs)) {
  743. printk(KERN_WARNING "NILFS (device %s): couldn't "
  744. "remount because the filesystem is in an "
  745. "incomplete recovery state.\n", sb->s_id);
  746. err = -EINVAL;
  747. goto restore_opts;
  748. }
  749. if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY))
  750. goto out;
  751. if (*flags & MS_RDONLY) {
  752. /* Shutting down the segment constructor */
  753. nilfs_detach_segment_constructor(sbi);
  754. sb->s_flags |= MS_RDONLY;
  755. sbi->s_snapshot_cno = nilfs_last_cno(nilfs);
  756. /* nilfs_set_opt(sbi, SNAPSHOT); */
  757. /*
  758. * Remounting a valid RW partition RDONLY, so set
  759. * the RDONLY flag and then mark the partition as valid again.
  760. */
  761. down_write(&nilfs->ns_sem);
  762. sbp = nilfs->ns_sbp[0];
  763. if (!(sbp->s_state & le16_to_cpu(NILFS_VALID_FS)) &&
  764. (nilfs->ns_mount_state & NILFS_VALID_FS))
  765. sbp->s_state = cpu_to_le16(nilfs->ns_mount_state);
  766. sbp->s_mtime = cpu_to_le64(get_seconds());
  767. nilfs_commit_super(sbi, 1);
  768. up_write(&nilfs->ns_sem);
  769. } else {
  770. /*
  771. * Mounting a RDONLY partition read-write, so reread and
  772. * store the current valid flag. (It may have been changed
  773. * by fsck since we originally mounted the partition.)
  774. */
  775. if (nilfs->ns_current && nilfs->ns_current != sbi) {
  776. printk(KERN_WARNING "NILFS (device %s): couldn't "
  777. "remount because an RW-mount exists.\n",
  778. sb->s_id);
  779. err = -EBUSY;
  780. goto restore_opts;
  781. }
  782. if (sbi->s_snapshot_cno != nilfs_last_cno(nilfs)) {
  783. printk(KERN_WARNING "NILFS (device %s): couldn't "
  784. "remount because the current RO-mount is not "
  785. "the latest one.\n",
  786. sb->s_id);
  787. err = -EINVAL;
  788. goto restore_opts;
  789. }
  790. sb->s_flags &= ~MS_RDONLY;
  791. nilfs_clear_opt(sbi, SNAPSHOT);
  792. sbi->s_snapshot_cno = 0;
  793. err = nilfs_attach_segment_constructor(sbi);
  794. if (err)
  795. goto restore_opts;
  796. down_write(&nilfs->ns_sem);
  797. nilfs_setup_super(sbi);
  798. up_write(&nilfs->ns_sem);
  799. nilfs->ns_current = sbi;
  800. }
  801. out:
  802. up_write(&nilfs->ns_super_sem);
  803. unlock_kernel();
  804. return 0;
  805. restore_opts:
  806. sb->s_flags = old_sb_flags;
  807. sbi->s_mount_opt = old_opts.mount_opt;
  808. sbi->s_snapshot_cno = old_opts.snapshot_cno;
  809. up_write(&nilfs->ns_super_sem);
  810. unlock_kernel();
  811. return err;
  812. }
  813. struct nilfs_super_data {
  814. struct block_device *bdev;
  815. struct nilfs_sb_info *sbi;
  816. __u64 cno;
  817. int flags;
  818. };
  819. /**
  820. * nilfs_identify - pre-read mount options needed to identify mount instance
  821. * @data: mount options
  822. * @sd: nilfs_super_data
  823. */
  824. static int nilfs_identify(char *data, struct nilfs_super_data *sd)
  825. {
  826. char *p, *options = data;
  827. substring_t args[MAX_OPT_ARGS];
  828. int option, token;
  829. int ret = 0;
  830. do {
  831. p = strsep(&options, ",");
  832. if (p != NULL && *p) {
  833. token = match_token(p, tokens, args);
  834. if (token == Opt_snapshot) {
  835. if (!(sd->flags & MS_RDONLY))
  836. ret++;
  837. else {
  838. ret = match_int(&args[0], &option);
  839. if (!ret) {
  840. if (option > 0)
  841. sd->cno = option;
  842. else
  843. ret++;
  844. }
  845. }
  846. }
  847. if (ret)
  848. printk(KERN_ERR
  849. "NILFS: invalid mount option: %s\n", p);
  850. }
  851. if (!options)
  852. break;
  853. BUG_ON(options == data);
  854. *(options - 1) = ',';
  855. } while (!ret);
  856. return ret;
  857. }
  858. static int nilfs_set_bdev_super(struct super_block *s, void *data)
  859. {
  860. struct nilfs_super_data *sd = data;
  861. s->s_bdev = sd->bdev;
  862. s->s_dev = s->s_bdev->bd_dev;
  863. return 0;
  864. }
  865. static int nilfs_test_bdev_super(struct super_block *s, void *data)
  866. {
  867. struct nilfs_super_data *sd = data;
  868. return sd->sbi && s->s_fs_info == (void *)sd->sbi;
  869. }
  870. static int
  871. nilfs_get_sb(struct file_system_type *fs_type, int flags,
  872. const char *dev_name, void *data, struct vfsmount *mnt)
  873. {
  874. struct nilfs_super_data sd;
  875. struct super_block *s;
  876. fmode_t mode = FMODE_READ;
  877. struct the_nilfs *nilfs;
  878. int err, need_to_close = 1;
  879. if (!(flags & MS_RDONLY))
  880. mode |= FMODE_WRITE;
  881. sd.bdev = open_bdev_exclusive(dev_name, mode, fs_type);
  882. if (IS_ERR(sd.bdev))
  883. return PTR_ERR(sd.bdev);
  884. /*
  885. * To get mount instance using sget() vfs-routine, NILFS needs
  886. * much more information than normal filesystems to identify mount
  887. * instance. For snapshot mounts, not only a mount type (ro-mount
  888. * or rw-mount) but also a checkpoint number is required.
  889. */
  890. sd.cno = 0;
  891. sd.flags = flags;
  892. if (nilfs_identify((char *)data, &sd)) {
  893. err = -EINVAL;
  894. goto failed;
  895. }
  896. nilfs = find_or_create_nilfs(sd.bdev);
  897. if (!nilfs) {
  898. err = -ENOMEM;
  899. goto failed;
  900. }
  901. mutex_lock(&nilfs->ns_mount_mutex);
  902. if (!sd.cno) {
  903. /*
  904. * Check if an exclusive mount exists or not.
  905. * Snapshot mounts coexist with a current mount
  906. * (i.e. rw-mount or ro-mount), whereas rw-mount and
  907. * ro-mount are mutually exclusive.
  908. */
  909. down_read(&nilfs->ns_super_sem);
  910. if (nilfs->ns_current &&
  911. ((nilfs->ns_current->s_super->s_flags ^ flags)
  912. & MS_RDONLY)) {
  913. up_read(&nilfs->ns_super_sem);
  914. err = -EBUSY;
  915. goto failed_unlock;
  916. }
  917. up_read(&nilfs->ns_super_sem);
  918. }
  919. /*
  920. * Find existing nilfs_sb_info struct
  921. */
  922. sd.sbi = nilfs_find_sbinfo(nilfs, !(flags & MS_RDONLY), sd.cno);
  923. /*
  924. * Get super block instance holding the nilfs_sb_info struct.
  925. * A new instance is allocated if no existing mount is present or
  926. * existing instance has been unmounted.
  927. */
  928. s = sget(fs_type, nilfs_test_bdev_super, nilfs_set_bdev_super, &sd);
  929. if (sd.sbi)
  930. nilfs_put_sbinfo(sd.sbi);
  931. if (IS_ERR(s)) {
  932. err = PTR_ERR(s);
  933. goto failed_unlock;
  934. }
  935. if (!s->s_root) {
  936. char b[BDEVNAME_SIZE];
  937. /* New superblock instance created */
  938. s->s_flags = flags;
  939. s->s_mode = mode;
  940. strlcpy(s->s_id, bdevname(sd.bdev, b), sizeof(s->s_id));
  941. sb_set_blocksize(s, block_size(sd.bdev));
  942. err = nilfs_fill_super(s, data, flags & MS_SILENT ? 1 : 0,
  943. nilfs);
  944. if (err)
  945. goto cancel_new;
  946. s->s_flags |= MS_ACTIVE;
  947. need_to_close = 0;
  948. }
  949. mutex_unlock(&nilfs->ns_mount_mutex);
  950. put_nilfs(nilfs);
  951. if (need_to_close)
  952. close_bdev_exclusive(sd.bdev, mode);
  953. simple_set_mnt(mnt, s);
  954. return 0;
  955. failed_unlock:
  956. mutex_unlock(&nilfs->ns_mount_mutex);
  957. put_nilfs(nilfs);
  958. failed:
  959. close_bdev_exclusive(sd.bdev, mode);
  960. return err;
  961. cancel_new:
  962. /* Abandoning the newly allocated superblock */
  963. mutex_unlock(&nilfs->ns_mount_mutex);
  964. put_nilfs(nilfs);
  965. deactivate_locked_super(s);
  966. /*
  967. * deactivate_locked_super() invokes close_bdev_exclusive().
  968. * We must finish all post-cleaning before this call;
  969. * put_nilfs() needs the block device.
  970. */
  971. return err;
  972. }
  973. struct file_system_type nilfs_fs_type = {
  974. .owner = THIS_MODULE,
  975. .name = "nilfs2",
  976. .get_sb = nilfs_get_sb,
  977. .kill_sb = kill_block_super,
  978. .fs_flags = FS_REQUIRES_DEV,
  979. };
  980. static void nilfs_inode_init_once(void *obj)
  981. {
  982. struct nilfs_inode_info *ii = obj;
  983. INIT_LIST_HEAD(&ii->i_dirty);
  984. #ifdef CONFIG_NILFS_XATTR
  985. init_rwsem(&ii->xattr_sem);
  986. #endif
  987. nilfs_btnode_cache_init_once(&ii->i_btnode_cache);
  988. ii->i_bmap = (struct nilfs_bmap *)&ii->i_bmap_union;
  989. inode_init_once(&ii->vfs_inode);
  990. }
  991. static void nilfs_segbuf_init_once(void *obj)
  992. {
  993. memset(obj, 0, sizeof(struct nilfs_segment_buffer));
  994. }
  995. static void nilfs_destroy_cachep(void)
  996. {
  997. if (nilfs_inode_cachep)
  998. kmem_cache_destroy(nilfs_inode_cachep);
  999. if (nilfs_transaction_cachep)
  1000. kmem_cache_destroy(nilfs_transaction_cachep);
  1001. if (nilfs_segbuf_cachep)
  1002. kmem_cache_destroy(nilfs_segbuf_cachep);
  1003. if (nilfs_btree_path_cache)
  1004. kmem_cache_destroy(nilfs_btree_path_cache);
  1005. }
  1006. static int __init nilfs_init_cachep(void)
  1007. {
  1008. nilfs_inode_cachep = kmem_cache_create("nilfs2_inode_cache",
  1009. sizeof(struct nilfs_inode_info), 0,
  1010. SLAB_RECLAIM_ACCOUNT, nilfs_inode_init_once);
  1011. if (!nilfs_inode_cachep)
  1012. goto fail;
  1013. nilfs_transaction_cachep = kmem_cache_create("nilfs2_transaction_cache",
  1014. sizeof(struct nilfs_transaction_info), 0,
  1015. SLAB_RECLAIM_ACCOUNT, NULL);
  1016. if (!nilfs_transaction_cachep)
  1017. goto fail;
  1018. nilfs_segbuf_cachep = kmem_cache_create("nilfs2_segbuf_cache",
  1019. sizeof(struct nilfs_segment_buffer), 0,
  1020. SLAB_RECLAIM_ACCOUNT, nilfs_segbuf_init_once);
  1021. if (!nilfs_segbuf_cachep)
  1022. goto fail;
  1023. nilfs_btree_path_cache = kmem_cache_create("nilfs2_btree_path_cache",
  1024. sizeof(struct nilfs_btree_path) * NILFS_BTREE_LEVEL_MAX,
  1025. 0, 0, NULL);
  1026. if (!nilfs_btree_path_cache)
  1027. goto fail;
  1028. return 0;
  1029. fail:
  1030. nilfs_destroy_cachep();
  1031. return -ENOMEM;
  1032. }
  1033. static int __init init_nilfs_fs(void)
  1034. {
  1035. int err;
  1036. err = nilfs_init_cachep();
  1037. if (err)
  1038. goto fail;
  1039. err = register_filesystem(&nilfs_fs_type);
  1040. if (err)
  1041. goto free_cachep;
  1042. printk(KERN_INFO "NILFS version 2 loaded\n");
  1043. return 0;
  1044. free_cachep:
  1045. nilfs_destroy_cachep();
  1046. fail:
  1047. return err;
  1048. }
  1049. static void __exit exit_nilfs_fs(void)
  1050. {
  1051. nilfs_destroy_cachep();
  1052. unregister_filesystem(&nilfs_fs_type);
  1053. }
  1054. module_init(init_nilfs_fs)
  1055. module_exit(exit_nilfs_fs)