Lines Matching +full:- +full:c
4 * Copyright (C) 2006-2008 Nokia Corporation.
6 * SPDX-License-Identifier: GPL-2.0+
40 #include <mtd/ubi-user.h>
66 inode->i_ino = ino; in iget_locked()
67 inode->i_sb = sb; in iget_locked()
68 list_add(&inode->i_sb_list, &sb->s_inodes); in iget_locked()
69 inode->i_state = I_LOCK | I_NEW; in iget_locked()
81 list_del_init(&inode->i_sb_list); in ubifs_iput()
120 /* from fs/inode.c */
122 * clear_nlink - directly zero an inode's link count
125 * This is a low-level filesystem helper to replace any
131 if (inode->i_nlink) { in clear_nlink()
132 inode->__i_nlink = 0; in clear_nlink()
133 atomic_long_inc(&inode->i_sb->s_remove_count); in clear_nlink()
139 * set_nlink - directly set an inode's link count
141 * @nlink: new nlink (should be non-zero)
143 * This is a low-level filesystem helper to replace any
152 if (inode->i_nlink == 0) in set_nlink()
153 atomic_long_dec(&inode->i_sb->s_remove_count); in set_nlink()
155 inode->__i_nlink = nlink; in set_nlink()
163 inode->i_uid.val = uid; in i_uid_write()
168 inode->i_gid.val = gid; in i_gid_write()
196 * validate_inode - validate inode.
197 * @c: UBIFS file-system description object
203 * a non-zero error code if not.
205 static int validate_inode(struct ubifs_info *c, const struct inode *inode) in validate_inode() argument
210 if (inode->i_size > c->max_inode_sz) { in validate_inode()
211 ubifs_err(c, "inode is too large (%lld)", in validate_inode()
212 (long long)inode->i_size); in validate_inode()
216 if (ui->compr_type >= UBIFS_COMPR_TYPES_CNT) { in validate_inode()
217 ubifs_err(c, "unknown compression type %d", ui->compr_type); in validate_inode()
221 if (ui->xattr_names + ui->xattr_cnt > XATTR_LIST_MAX) in validate_inode()
224 if (ui->data_len < 0 || ui->data_len > UBIFS_MAX_INO_DATA) in validate_inode()
227 if (ui->xattr && !S_ISREG(inode->i_mode)) in validate_inode()
230 if (!ubifs_compr_present(ui->compr_type)) { in validate_inode()
231 ubifs_warn(c, "inode %lu uses '%s' compression, but it was not compiled in", in validate_inode()
232 inode->i_ino, ubifs_compr_name(ui->compr_type)); in validate_inode()
235 err = dbg_check_dir(c, inode); in validate_inode()
244 struct ubifs_info *c = sb->s_fs_info; in ubifs_iget() local
255 * U-Boot special handling of locked down inodes via recovery in ubifs_iget()
265 if (inodes_locked_down[i]->i_ino == inum) { in ubifs_iget()
278 return ERR_PTR(-ENOMEM); in ubifs_iget()
279 if (!(inode->i_state & I_NEW)) in ubifs_iget()
285 err = -ENOMEM; in ubifs_iget()
289 ino_key_init(c, &key, inode->i_ino); in ubifs_iget()
291 err = ubifs_tnc_lookup(c, &key, ino); in ubifs_iget()
295 inode->i_flags |= (S_NOCMTIME | S_NOATIME); in ubifs_iget()
296 set_nlink(inode, le32_to_cpu(ino->nlink)); in ubifs_iget()
297 i_uid_write(inode, le32_to_cpu(ino->uid)); in ubifs_iget()
298 i_gid_write(inode, le32_to_cpu(ino->gid)); in ubifs_iget()
299 inode->i_atime.tv_sec = (int64_t)le64_to_cpu(ino->atime_sec); in ubifs_iget()
300 inode->i_atime.tv_nsec = le32_to_cpu(ino->atime_nsec); in ubifs_iget()
301 inode->i_mtime.tv_sec = (int64_t)le64_to_cpu(ino->mtime_sec); in ubifs_iget()
302 inode->i_mtime.tv_nsec = le32_to_cpu(ino->mtime_nsec); in ubifs_iget()
303 inode->i_ctime.tv_sec = (int64_t)le64_to_cpu(ino->ctime_sec); in ubifs_iget()
304 inode->i_ctime.tv_nsec = le32_to_cpu(ino->ctime_nsec); in ubifs_iget()
305 inode->i_mode = le32_to_cpu(ino->mode); in ubifs_iget()
306 inode->i_size = le64_to_cpu(ino->size); in ubifs_iget()
308 ui->data_len = le32_to_cpu(ino->data_len); in ubifs_iget()
309 ui->flags = le32_to_cpu(ino->flags); in ubifs_iget()
310 ui->compr_type = le16_to_cpu(ino->compr_type); in ubifs_iget()
311 ui->creat_sqnum = le64_to_cpu(ino->creat_sqnum); in ubifs_iget()
312 ui->xattr_cnt = le32_to_cpu(ino->xattr_cnt); in ubifs_iget()
313 ui->xattr_size = le32_to_cpu(ino->xattr_size); in ubifs_iget()
314 ui->xattr_names = le32_to_cpu(ino->xattr_names); in ubifs_iget()
315 ui->synced_i_size = ui->ui_size = inode->i_size; in ubifs_iget()
317 ui->xattr = (ui->flags & UBIFS_XATTR_FL) ? 1 : 0; in ubifs_iget()
319 err = validate_inode(c, inode); in ubifs_iget()
324 switch (inode->i_mode & S_IFMT) { in ubifs_iget()
326 inode->i_mapping->a_ops = &ubifs_file_address_operations; in ubifs_iget()
327 inode->i_op = &ubifs_file_inode_operations; in ubifs_iget()
328 inode->i_fop = &ubifs_file_operations; in ubifs_iget()
329 if (ui->xattr) { in ubifs_iget()
330 ui->data = kmalloc(ui->data_len + 1, GFP_NOFS); in ubifs_iget()
331 if (!ui->data) { in ubifs_iget()
332 err = -ENOMEM; in ubifs_iget()
335 memcpy(ui->data, ino->data, ui->data_len); in ubifs_iget()
336 ((char *)ui->data)[ui->data_len] = '\0'; in ubifs_iget()
337 } else if (ui->data_len != 0) { in ubifs_iget()
343 inode->i_op = &ubifs_dir_inode_operations; in ubifs_iget()
344 inode->i_fop = &ubifs_dir_operations; in ubifs_iget()
345 if (ui->data_len != 0) { in ubifs_iget()
351 inode->i_op = &ubifs_symlink_inode_operations; in ubifs_iget()
352 if (ui->data_len <= 0 || ui->data_len > UBIFS_MAX_INO_DATA) { in ubifs_iget()
356 ui->data = kmalloc(ui->data_len + 1, GFP_NOFS); in ubifs_iget()
357 if (!ui->data) { in ubifs_iget()
358 err = -ENOMEM; in ubifs_iget()
361 memcpy(ui->data, ino->data, ui->data_len); in ubifs_iget()
362 ((char *)ui->data)[ui->data_len] = '\0'; in ubifs_iget()
363 inode->i_link = ui->data; in ubifs_iget()
371 ui->data = kmalloc(sizeof(union ubifs_dev_desc), GFP_NOFS); in ubifs_iget()
372 if (!ui->data) { in ubifs_iget()
373 err = -ENOMEM; in ubifs_iget()
377 dev = (union ubifs_dev_desc *)ino->data; in ubifs_iget()
378 if (ui->data_len == sizeof(dev->new)) in ubifs_iget()
379 rdev = new_decode_dev(le32_to_cpu(dev->new)); in ubifs_iget()
380 else if (ui->data_len == sizeof(dev->huge)) in ubifs_iget()
381 rdev = huge_decode_dev(le64_to_cpu(dev->huge)); in ubifs_iget()
386 memcpy(ui->data, ino->data, ui->data_len); in ubifs_iget()
387 inode->i_op = &ubifs_file_inode_operations; in ubifs_iget()
388 init_special_inode(inode, inode->i_mode, rdev); in ubifs_iget()
393 inode->i_op = &ubifs_file_inode_operations; in ubifs_iget()
394 init_special_inode(inode, inode->i_mode, 0); in ubifs_iget()
395 if (ui->data_len != 0) { in ubifs_iget()
405 if ((inode->i_mode & S_IFMT) == S_IFLNK) { in ubifs_iget()
406 if (ui->data_len <= 0 || ui->data_len > UBIFS_MAX_INO_DATA) { in ubifs_iget()
410 ui->data = kmalloc(ui->data_len + 1, GFP_NOFS); in ubifs_iget()
411 if (!ui->data) { in ubifs_iget()
412 err = -ENOMEM; in ubifs_iget()
415 memcpy(ui->data, ino->data, ui->data_len); in ubifs_iget()
416 ((char *)ui->data)[ui->data_len] = '\0'; in ubifs_iget()
428 ubifs_err(c, "inode %lu validation failed, error %d", inode->i_ino, err); in ubifs_iget()
429 ubifs_dump_node(c, ino); in ubifs_iget()
430 ubifs_dump_inode(c, inode); in ubifs_iget()
431 err = -EINVAL; in ubifs_iget()
435 ubifs_err(c, "failed to read inode %lu, error %d", inode->i_ino, err); in ubifs_iget()
449 sizeof(struct ubifs_inode) - sizeof(struct inode)); in ubifs_alloc_inode()
450 mutex_init(&ui->ui_mutex); in ubifs_alloc_inode()
451 spin_lock_init(&ui->ui_lock); in ubifs_alloc_inode()
452 return &ui->vfs_inode; in ubifs_alloc_inode()
467 kfree(ui->data); in ubifs_destroy_inode()
468 call_rcu(&inode->i_rcu, ubifs_i_callback); in ubifs_destroy_inode()
472 * Note, Linux write-back code calls this without 'i_mutex'.
477 struct ubifs_info *c = inode->i_sb->s_fs_info; in ubifs_write_inode() local
480 ubifs_assert(!ui->xattr); in ubifs_write_inode()
484 mutex_lock(&ui->ui_mutex); in ubifs_write_inode()
486 * Due to races between write-back forced by budgeting in ubifs_write_inode()
487 * (see 'sync_some_inodes()') and background write-back, the inode may in ubifs_write_inode()
492 if (!ui->dirty) { in ubifs_write_inode()
493 mutex_unlock(&ui->ui_mutex); in ubifs_write_inode()
502 inode->i_ino, (int)inode->i_mode, inode->i_nlink); in ubifs_write_inode()
503 if (inode->i_nlink) { in ubifs_write_inode()
504 err = ubifs_jnl_write_inode(c, inode); in ubifs_write_inode()
506 ubifs_err(c, "can't write inode %lu, error %d", in ubifs_write_inode()
507 inode->i_ino, err); in ubifs_write_inode()
509 err = dbg_check_inode_size(c, inode, ui->ui_size); in ubifs_write_inode()
512 ui->dirty = 0; in ubifs_write_inode()
513 mutex_unlock(&ui->ui_mutex); in ubifs_write_inode()
514 ubifs_release_dirty_inode_budget(c, ui); in ubifs_write_inode()
521 struct ubifs_info *c = inode->i_sb->s_fs_info; in ubifs_evict_inode() local
524 if (ui->xattr) in ubifs_evict_inode()
532 dbg_gen("inode %lu, mode %#x", inode->i_ino, (int)inode->i_mode); in ubifs_evict_inode()
533 ubifs_assert(!atomic_read(&inode->i_count)); in ubifs_evict_inode()
535 truncate_inode_pages_final(&inode->i_data); in ubifs_evict_inode()
537 if (inode->i_nlink) in ubifs_evict_inode()
543 ui->ui_size = inode->i_size = 0; in ubifs_evict_inode()
544 err = ubifs_jnl_delete_inode(c, inode); in ubifs_evict_inode()
550 ubifs_err(c, "can't delete inode %lu, error %d", in ubifs_evict_inode()
551 inode->i_ino, err); in ubifs_evict_inode()
554 if (ui->dirty) in ubifs_evict_inode()
555 ubifs_release_dirty_inode_budget(c, ui); in ubifs_evict_inode()
557 /* We've deleted something - clean the "no space" flags */ in ubifs_evict_inode()
558 c->bi.nospace = c->bi.nospace_rp = 0; in ubifs_evict_inode()
570 ubifs_assert(mutex_is_locked(&ui->ui_mutex)); in ubifs_dirty_inode()
571 if (!ui->dirty) { in ubifs_dirty_inode()
572 ui->dirty = 1; in ubifs_dirty_inode()
573 dbg_gen("inode %lu", inode->i_ino); in ubifs_dirty_inode()
580 struct ubifs_info *c = dentry->d_sb->s_fs_info; in ubifs_statfs() local
582 __le32 *uuid = (__le32 *)c->uuid; in ubifs_statfs()
584 free = ubifs_get_free_space(c); in ubifs_statfs()
588 buf->f_type = UBIFS_SUPER_MAGIC; in ubifs_statfs()
589 buf->f_bsize = UBIFS_BLOCK_SIZE; in ubifs_statfs()
590 buf->f_blocks = c->block_cnt; in ubifs_statfs()
591 buf->f_bfree = free >> UBIFS_BLOCK_SHIFT; in ubifs_statfs()
592 if (free > c->report_rp_size) in ubifs_statfs()
593 buf->f_bavail = (free - c->report_rp_size) >> UBIFS_BLOCK_SHIFT; in ubifs_statfs()
595 buf->f_bavail = 0; in ubifs_statfs()
596 buf->f_files = 0; in ubifs_statfs()
597 buf->f_ffree = 0; in ubifs_statfs()
598 buf->f_namelen = UBIFS_MAX_NLEN; in ubifs_statfs()
599 buf->f_fsid.val[0] = le32_to_cpu(uuid[0]) ^ le32_to_cpu(uuid[2]); in ubifs_statfs()
600 buf->f_fsid.val[1] = le32_to_cpu(uuid[1]) ^ le32_to_cpu(uuid[3]); in ubifs_statfs()
601 ubifs_assert(buf->f_bfree <= c->block_cnt); in ubifs_statfs()
607 struct ubifs_info *c = root->d_sb->s_fs_info; in ubifs_show_options() local
609 if (c->mount_opts.unmount_mode == 2) in ubifs_show_options()
611 else if (c->mount_opts.unmount_mode == 1) in ubifs_show_options()
614 if (c->mount_opts.bulk_read == 2) in ubifs_show_options()
616 else if (c->mount_opts.bulk_read == 1) in ubifs_show_options()
619 if (c->mount_opts.chk_data_crc == 2) in ubifs_show_options()
621 else if (c->mount_opts.chk_data_crc == 1) in ubifs_show_options()
624 if (c->mount_opts.override_compr) { in ubifs_show_options()
626 ubifs_compr_name(c->mount_opts.compr_type)); in ubifs_show_options()
635 struct ubifs_info *c = sb->s_fs_info; in ubifs_sync_fs() local
640 * '->sync_fs()' call, with non-zero @wait. in ubifs_sync_fs()
649 for (i = 0; i < c->jhead_cnt; i++) { in ubifs_sync_fs()
650 err = ubifs_wbuf_sync(&c->jheads[i].wbuf); in ubifs_sync_fs()
657 * synchronizing write-buffers would be enough. But committing makes in ubifs_sync_fs()
662 err = ubifs_run_commit(c); in ubifs_sync_fs()
666 return ubi_sync(c->vi.ubi_num); in ubifs_sync_fs()
671 * init_constants_early - initialize UBIFS constants.
672 * @c: UBIFS file-system description object
679 static int init_constants_early(struct ubifs_info *c) in init_constants_early() argument
681 if (c->vi.corrupted) { in init_constants_early()
682 ubifs_warn(c, "UBI volume is corrupted - read-only mode"); in init_constants_early()
683 c->ro_media = 1; in init_constants_early()
686 if (c->di.ro_mode) { in init_constants_early()
687 ubifs_msg(c, "read-only UBI device"); in init_constants_early()
688 c->ro_media = 1; in init_constants_early()
691 if (c->vi.vol_type == UBI_STATIC_VOLUME) { in init_constants_early()
692 ubifs_msg(c, "static UBI volume - read-only mode"); in init_constants_early()
693 c->ro_media = 1; in init_constants_early()
696 c->leb_cnt = c->vi.size; in init_constants_early()
697 c->leb_size = c->vi.usable_leb_size; in init_constants_early()
698 c->leb_start = c->di.leb_start; in init_constants_early()
699 c->half_leb_size = c->leb_size / 2; in init_constants_early()
700 c->min_io_size = c->di.min_io_size; in init_constants_early()
701 c->min_io_shift = fls(c->min_io_size) - 1; in init_constants_early()
702 c->max_write_size = c->di.max_write_size; in init_constants_early()
703 c->max_write_shift = fls(c->max_write_size) - 1; in init_constants_early()
705 if (c->leb_size < UBIFS_MIN_LEB_SZ) { in init_constants_early()
706 ubifs_err(c, "too small LEBs (%d bytes), min. is %d bytes", in init_constants_early()
707 c->leb_size, UBIFS_MIN_LEB_SZ); in init_constants_early()
708 return -EINVAL; in init_constants_early()
711 if (c->leb_cnt < UBIFS_MIN_LEB_CNT) { in init_constants_early()
712 ubifs_err(c, "too few LEBs (%d), min. is %d", in init_constants_early()
713 c->leb_cnt, UBIFS_MIN_LEB_CNT); in init_constants_early()
714 return -EINVAL; in init_constants_early()
717 if (!is_power_of_2(c->min_io_size)) { in init_constants_early()
718 ubifs_err(c, "bad min. I/O size %d", c->min_io_size); in init_constants_early()
719 return -EINVAL; in init_constants_early()
726 if (c->max_write_size < c->min_io_size || in init_constants_early()
727 c->max_write_size % c->min_io_size || in init_constants_early()
728 !is_power_of_2(c->max_write_size)) { in init_constants_early()
729 ubifs_err(c, "bad write buffer size %d for %d min. I/O unit", in init_constants_early()
730 c->max_write_size, c->min_io_size); in init_constants_early()
731 return -EINVAL; in init_constants_early()
735 * UBIFS aligns all node to 8-byte boundary, so to make function in in init_constants_early()
736 * io.c simpler, assume minimum I/O unit size to be 8 bytes if it is in init_constants_early()
739 if (c->min_io_size < 8) { in init_constants_early()
740 c->min_io_size = 8; in init_constants_early()
741 c->min_io_shift = 3; in init_constants_early()
742 if (c->max_write_size < c->min_io_size) { in init_constants_early()
743 c->max_write_size = c->min_io_size; in init_constants_early()
744 c->max_write_shift = c->min_io_shift; in init_constants_early()
748 c->ref_node_alsz = ALIGN(UBIFS_REF_NODE_SZ, c->min_io_size); in init_constants_early()
749 c->mst_node_alsz = ALIGN(UBIFS_MST_NODE_SZ, c->min_io_size); in init_constants_early()
755 c->ranges[UBIFS_PAD_NODE].len = UBIFS_PAD_NODE_SZ; in init_constants_early()
756 c->ranges[UBIFS_SB_NODE].len = UBIFS_SB_NODE_SZ; in init_constants_early()
757 c->ranges[UBIFS_MST_NODE].len = UBIFS_MST_NODE_SZ; in init_constants_early()
758 c->ranges[UBIFS_REF_NODE].len = UBIFS_REF_NODE_SZ; in init_constants_early()
759 c->ranges[UBIFS_TRUN_NODE].len = UBIFS_TRUN_NODE_SZ; in init_constants_early()
760 c->ranges[UBIFS_CS_NODE].len = UBIFS_CS_NODE_SZ; in init_constants_early()
762 c->ranges[UBIFS_INO_NODE].min_len = UBIFS_INO_NODE_SZ; in init_constants_early()
763 c->ranges[UBIFS_INO_NODE].max_len = UBIFS_MAX_INO_NODE_SZ; in init_constants_early()
764 c->ranges[UBIFS_ORPH_NODE].min_len = in init_constants_early()
766 c->ranges[UBIFS_ORPH_NODE].max_len = c->leb_size; in init_constants_early()
767 c->ranges[UBIFS_DENT_NODE].min_len = UBIFS_DENT_NODE_SZ; in init_constants_early()
768 c->ranges[UBIFS_DENT_NODE].max_len = UBIFS_MAX_DENT_NODE_SZ; in init_constants_early()
769 c->ranges[UBIFS_XENT_NODE].min_len = UBIFS_XENT_NODE_SZ; in init_constants_early()
770 c->ranges[UBIFS_XENT_NODE].max_len = UBIFS_MAX_XENT_NODE_SZ; in init_constants_early()
771 c->ranges[UBIFS_DATA_NODE].min_len = UBIFS_DATA_NODE_SZ; in init_constants_early()
772 c->ranges[UBIFS_DATA_NODE].max_len = UBIFS_MAX_DATA_NODE_SZ; in init_constants_early()
777 c->ranges[UBIFS_IDX_NODE].min_len = UBIFS_IDX_NODE_SZ + UBIFS_BRANCH_SZ; in init_constants_early()
782 c->ranges[UBIFS_IDX_NODE].max_len = INT_MAX; in init_constants_early()
785 * Initialize dead and dark LEB space watermarks. See gc.c for comments in init_constants_early()
788 c->dead_wm = ALIGN(MIN_WRITE_SZ, c->min_io_size); in init_constants_early()
789 c->dark_wm = ALIGN(UBIFS_MAX_NODE_SZ, c->min_io_size); in init_constants_early()
796 c->leb_overhead = c->leb_size % UBIFS_MAX_DATA_NODE_SZ; in init_constants_early()
798 /* Buffer size for bulk-reads */ in init_constants_early()
799 c->max_bu_buf_len = UBIFS_MAX_BULK_READ * UBIFS_MAX_DATA_NODE_SZ; in init_constants_early()
800 if (c->max_bu_buf_len > c->leb_size) in init_constants_early()
801 c->max_bu_buf_len = c->leb_size; in init_constants_early()
806 * bud_wbuf_callback - bud LEB write-buffer synchronization call-back.
807 * @c: UBIFS file-system description object
808 * @lnum: LEB the write-buffer was synchronized to
813 * write-buffer is synchronized. We need this to correctly maintain space
820 static int bud_wbuf_callback(struct ubifs_info *c, int lnum, int free, int pad) in bud_wbuf_callback() argument
822 return ubifs_update_one_lp(c, lnum, free, pad, 0, 0); in bud_wbuf_callback()
826 * init_constants_sb - initialize UBIFS constants.
827 * @c: UBIFS file-system description object
834 static int init_constants_sb(struct ubifs_info *c) in init_constants_sb() argument
839 c->main_bytes = (long long)c->main_lebs * c->leb_size; in init_constants_sb()
840 c->max_znode_sz = sizeof(struct ubifs_znode) + in init_constants_sb()
841 c->fanout * sizeof(struct ubifs_zbranch); in init_constants_sb()
843 tmp = ubifs_idx_node_sz(c, 1); in init_constants_sb()
844 c->ranges[UBIFS_IDX_NODE].min_len = tmp; in init_constants_sb()
845 c->min_idx_node_sz = ALIGN(tmp, 8); in init_constants_sb()
847 tmp = ubifs_idx_node_sz(c, c->fanout); in init_constants_sb()
848 c->ranges[UBIFS_IDX_NODE].max_len = tmp; in init_constants_sb()
849 c->max_idx_node_sz = ALIGN(tmp, 8); in init_constants_sb()
852 tmp = UBIFS_CS_NODE_SZ + UBIFS_REF_NODE_SZ * c->jhead_cnt; in init_constants_sb()
853 tmp = ALIGN(tmp, c->min_io_size); in init_constants_sb()
854 if (tmp > c->leb_size) { in init_constants_sb()
855 ubifs_err(c, "too small LEB size %d, at least %d needed", in init_constants_sb()
856 c->leb_size, tmp); in init_constants_sb()
857 return -EINVAL; in init_constants_sb()
864 tmp64 = c->max_bud_bytes + c->leb_size - 1; in init_constants_sb()
865 c->max_bud_cnt = div_u64(tmp64, c->leb_size); in init_constants_sb()
866 tmp = (c->ref_node_alsz * c->max_bud_cnt + c->leb_size - 1); in init_constants_sb()
867 tmp /= c->leb_size; in init_constants_sb()
869 if (c->log_lebs < tmp) { in init_constants_sb()
870 ubifs_err(c, "too small log %d LEBs, required min. %d LEBs", in init_constants_sb()
871 c->log_lebs, tmp); in init_constants_sb()
872 return -EINVAL; in init_constants_sb()
876 * When budgeting we assume worst-case scenarios when the pages are not in init_constants_sb()
880 * it is not included into 'c->bi.inode_budget'. in init_constants_sb()
882 c->bi.page_budget = UBIFS_MAX_DATA_NODE_SZ * UBIFS_BLOCKS_PER_PAGE; in init_constants_sb()
883 c->bi.inode_budget = UBIFS_INO_NODE_SZ; in init_constants_sb()
884 c->bi.dent_budget = UBIFS_MAX_DENT_NODE_SZ; in init_constants_sb()
888 * 'c->max_bud_bytes', UBIFS just blocks all writers and starts commit. in init_constants_sb()
893 c->bg_bud_bytes = (c->max_bud_bytes * 13) >> 4; in init_constants_sb()
901 tmp64 = (long long)(c->jhead_cnt + 1) * c->leb_size + 1; in init_constants_sb()
902 if (c->bg_bud_bytes < tmp64) in init_constants_sb()
903 c->bg_bud_bytes = tmp64; in init_constants_sb()
904 if (c->max_bud_bytes < tmp64 + c->leb_size) in init_constants_sb()
905 c->max_bud_bytes = tmp64 + c->leb_size; in init_constants_sb()
907 err = ubifs_calc_lpt_geom(c); in init_constants_sb()
912 c->idx_leb_size = c->leb_size - c->max_idx_node_sz; in init_constants_sb()
917 * init_constants_master - initialize UBIFS constants.
918 * @c: UBIFS file-system description object
924 static void init_constants_master(struct ubifs_info *c) in init_constants_master() argument
928 c->bi.min_idx_lebs = ubifs_calc_min_idx_lebs(c); in init_constants_master()
929 c->report_rp_size = ubifs_reported_space(c, c->rp_size); in init_constants_master()
940 tmp64 = c->main_lebs - 1 - 1 - MIN_INDEX_LEBS - c->jhead_cnt + 1; in init_constants_master()
941 tmp64 *= (long long)c->leb_size - c->leb_overhead; in init_constants_master()
942 tmp64 = ubifs_reported_space(c, tmp64); in init_constants_master()
943 c->block_cnt = tmp64 >> UBIFS_BLOCK_SHIFT; in init_constants_master()
947 * take_gc_lnum - reserve GC LEB.
948 * @c: UBIFS file-system description object
952 * space to zero, because lprops may contain out-of-date information if the
953 * file-system was un-mounted before it has been committed. This function
957 static int take_gc_lnum(struct ubifs_info *c) in take_gc_lnum() argument
961 if (c->gc_lnum == -1) { in take_gc_lnum()
962 ubifs_err(c, "no LEB for GC"); in take_gc_lnum()
963 return -EINVAL; in take_gc_lnum()
967 err = ubifs_change_one_lp(c, c->gc_lnum, c->leb_size, 0, in take_gc_lnum()
973 * alloc_wbufs - allocate write-buffers.
974 * @c: UBIFS file-system description object
976 * This helper function allocates and initializes UBIFS write-buffers. Returns
977 * zero in case of success and %-ENOMEM in case of failure.
979 static int alloc_wbufs(struct ubifs_info *c) in alloc_wbufs() argument
983 c->jheads = kcalloc(c->jhead_cnt, sizeof(struct ubifs_jhead), in alloc_wbufs()
985 if (!c->jheads) in alloc_wbufs()
986 return -ENOMEM; in alloc_wbufs()
989 for (i = 0; i < c->jhead_cnt; i++) { in alloc_wbufs()
990 INIT_LIST_HEAD(&c->jheads[i].buds_list); in alloc_wbufs()
991 err = ubifs_wbuf_init(c, &c->jheads[i].wbuf); in alloc_wbufs()
995 c->jheads[i].wbuf.sync_callback = &bud_wbuf_callback; in alloc_wbufs()
996 c->jheads[i].wbuf.jhead = i; in alloc_wbufs()
997 c->jheads[i].grouped = 1; in alloc_wbufs()
1004 c->jheads[GCHD].wbuf.no_timer = 1; in alloc_wbufs()
1005 c->jheads[GCHD].grouped = 0; in alloc_wbufs()
1011 * free_wbufs - free write-buffers.
1012 * @c: UBIFS file-system description object
1014 static void free_wbufs(struct ubifs_info *c) in free_wbufs() argument
1018 if (c->jheads) { in free_wbufs()
1019 for (i = 0; i < c->jhead_cnt; i++) { in free_wbufs()
1020 kfree(c->jheads[i].wbuf.buf); in free_wbufs()
1021 kfree(c->jheads[i].wbuf.inodes); in free_wbufs()
1023 kfree(c->jheads); in free_wbufs()
1024 c->jheads = NULL; in free_wbufs()
1029 * free_orphans - free orphans.
1030 * @c: UBIFS file-system description object
1032 static void free_orphans(struct ubifs_info *c) in free_orphans() argument
1036 while (c->orph_dnext) { in free_orphans()
1037 orph = c->orph_dnext; in free_orphans()
1038 c->orph_dnext = orph->dnext; in free_orphans()
1039 list_del(&orph->list); in free_orphans()
1043 while (!list_empty(&c->orph_list)) { in free_orphans()
1044 orph = list_entry(c->orph_list.next, struct ubifs_orphan, list); in free_orphans()
1045 list_del(&orph->list); in free_orphans()
1047 ubifs_err(c, "orphan list not empty at unmount"); in free_orphans()
1050 vfree(c->orph_buf); in free_orphans()
1051 c->orph_buf = NULL; in free_orphans()
1055 * free_buds - free per-bud objects.
1056 * @c: UBIFS file-system description object
1058 static void free_buds(struct ubifs_info *c) in free_buds() argument
1062 rbtree_postorder_for_each_entry_safe(bud, n, &c->buds, rb) in free_buds()
1067 * check_volume_empty - check if the UBI volume is empty.
1068 * @c: UBIFS file-system description object
1071 * mapped or not. The result of checking is stored in the @c->empty variable.
1075 static int check_volume_empty(struct ubifs_info *c) in check_volume_empty() argument
1079 c->empty = 1; in check_volume_empty()
1080 for (lnum = 0; lnum < c->leb_cnt; lnum++) { in check_volume_empty()
1081 err = ubifs_is_mapped(c, lnum); in check_volume_empty()
1085 c->empty = 0; in check_volume_empty()
1098 * Opt_fast_unmount: do not run a journal commit before un-mounting
1099 * Opt_norm_unmount: run a journal commit before un-mounting
1100 * Opt_bulk_read: enable bulk-reads
1101 * Opt_no_bulk_read: disable bulk-reads
1131 * parse_standard_option - parse a standard mount option.
1134 * Normally, standard mount options like "sync" are passed to file-systems as
1153 * ubifs_parse_options - parse mount parameters.
1154 * @c: UBIFS file-system description object
1156 * @is_remount: non-zero if this is FS re-mount
1161 static int ubifs_parse_options(struct ubifs_info *c, char *options, in ubifs_parse_options() argument
1180 * We accept them in order to be backward-compatible. But this in ubifs_parse_options()
1184 c->mount_opts.unmount_mode = 2; in ubifs_parse_options()
1187 c->mount_opts.unmount_mode = 1; in ubifs_parse_options()
1190 c->mount_opts.bulk_read = 2; in ubifs_parse_options()
1191 c->bulk_read = 1; in ubifs_parse_options()
1194 c->mount_opts.bulk_read = 1; in ubifs_parse_options()
1195 c->bulk_read = 0; in ubifs_parse_options()
1198 c->mount_opts.chk_data_crc = 2; in ubifs_parse_options()
1199 c->no_chk_data_crc = 0; in ubifs_parse_options()
1202 c->mount_opts.chk_data_crc = 1; in ubifs_parse_options()
1203 c->no_chk_data_crc = 1; in ubifs_parse_options()
1210 return -ENOMEM; in ubifs_parse_options()
1212 c->mount_opts.compr_type = UBIFS_COMPR_NONE; in ubifs_parse_options()
1214 c->mount_opts.compr_type = UBIFS_COMPR_LZO; in ubifs_parse_options()
1216 c->mount_opts.compr_type = UBIFS_COMPR_ZLIB; in ubifs_parse_options()
1218 ubifs_err(c, "unknown compressor \"%s\"", name); //FIXME: is c ready? in ubifs_parse_options()
1220 return -EINVAL; in ubifs_parse_options()
1223 c->mount_opts.override_compr = 1; in ubifs_parse_options()
1224 c->default_compr = c->mount_opts.compr_type; in ubifs_parse_options()
1230 struct super_block *sb = c->vfs_sb; in ubifs_parse_options()
1234 ubifs_err(c, "unrecognized mount option \"%s\" or missing value", in ubifs_parse_options()
1236 return -EINVAL; in ubifs_parse_options()
1238 sb->s_flags |= flag; in ubifs_parse_options()
1249 * destroy_journal - destroy journal data structures.
1250 * @c: UBIFS file-system description object
1255 static void destroy_journal(struct ubifs_info *c) in destroy_journal() argument
1257 while (!list_empty(&c->unclean_leb_list)) { in destroy_journal()
1260 ucleb = list_entry(c->unclean_leb_list.next, in destroy_journal()
1262 list_del(&ucleb->list); in destroy_journal()
1265 while (!list_empty(&c->old_buds)) { in destroy_journal()
1268 bud = list_entry(c->old_buds.next, struct ubifs_bud, list); in destroy_journal()
1269 list_del(&bud->list); in destroy_journal()
1272 ubifs_destroy_idx_gc(c); in destroy_journal()
1273 ubifs_destroy_size_tree(c); in destroy_journal()
1274 ubifs_tnc_close(c); in destroy_journal()
1275 free_buds(c); in destroy_journal()
1279 * bu_init - initialize bulk-read information.
1280 * @c: UBIFS file-system description object
1282 static void bu_init(struct ubifs_info *c) in bu_init() argument
1284 ubifs_assert(c->bulk_read == 1); in bu_init()
1286 if (c->bu.buf) in bu_init()
1290 c->bu.buf = kmalloc(c->max_bu_buf_len, GFP_KERNEL | __GFP_NOWARN); in bu_init()
1291 if (!c->bu.buf) { in bu_init()
1292 if (c->max_bu_buf_len > UBIFS_KMALLOC_OK) { in bu_init()
1293 c->max_bu_buf_len = UBIFS_KMALLOC_OK; in bu_init()
1297 /* Just disable bulk-read */ in bu_init()
1298 ubifs_warn(c, "cannot allocate %d bytes of memory for bulk-read, disabling it", in bu_init()
1299 c->max_bu_buf_len); in bu_init()
1300 c->mount_opts.bulk_read = 1; in bu_init()
1301 c->bulk_read = 0; in bu_init()
1308 * check_free_space - check if there is enough free space to mount.
1309 * @c: UBIFS file-system description object
1314 static int check_free_space(struct ubifs_info *c) in check_free_space() argument
1316 ubifs_assert(c->dark_wm > 0); in check_free_space()
1317 if (c->lst.total_free + c->lst.total_dirty < c->dark_wm) { in check_free_space()
1318 ubifs_err(c, "insufficient free space to mount in R/W mode"); in check_free_space()
1319 ubifs_dump_budg(c, &c->bi); in check_free_space()
1320 ubifs_dump_lprops(c); in check_free_space()
1321 return -ENOSPC; in check_free_space()
1328 * mount_ubifs - mount UBIFS file-system.
1329 * @c: UBIFS file-system description object
1334 static int mount_ubifs(struct ubifs_info *c) in mount_ubifs() argument
1340 c->ro_mount = !!(c->vfs_sb->s_flags & MS_RDONLY); in mount_ubifs()
1342 c->probing = !!(c->vfs_sb->s_flags & MS_SILENT); in mount_ubifs()
1344 if (!c->ro_mount) { in mount_ubifs()
1345 printf("UBIFS: only ro mode in U-Boot allowed.\n"); in mount_ubifs()
1346 return -EACCES; in mount_ubifs()
1350 err = init_constants_early(c); in mount_ubifs()
1354 err = ubifs_debugging_init(c); in mount_ubifs()
1358 err = check_volume_empty(c); in mount_ubifs()
1362 if (c->empty && (c->ro_mount || c->ro_media)) { in mount_ubifs()
1364 * This UBI volume is empty, and read-only, or the file system in mount_ubifs()
1365 * is mounted read-only - we cannot format it. in mount_ubifs()
1367 ubifs_err(c, "can't format empty UBI volume: read-only %s", in mount_ubifs()
1368 c->ro_media ? "UBI volume" : "mount"); in mount_ubifs()
1369 err = -EROFS; in mount_ubifs()
1373 if (c->ro_media && !c->ro_mount) { in mount_ubifs()
1374 ubifs_err(c, "cannot mount read-write - read-only media"); in mount_ubifs()
1375 err = -EROFS; in mount_ubifs()
1380 * The requirement for the buffer is that it should fit indexing B-tree in mount_ubifs()
1384 err = -ENOMEM; in mount_ubifs()
1385 c->bottom_up_buf = kmalloc(BOTTOM_UP_HEIGHT * sizeof(int), GFP_KERNEL); in mount_ubifs()
1386 if (!c->bottom_up_buf) in mount_ubifs()
1389 c->sbuf = vmalloc(c->leb_size); in mount_ubifs()
1390 if (!c->sbuf) in mount_ubifs()
1394 if (!c->ro_mount) { in mount_ubifs()
1395 c->ileb_buf = vmalloc(c->leb_size); in mount_ubifs()
1396 if (!c->ileb_buf) in mount_ubifs()
1401 if (c->bulk_read == 1) in mount_ubifs()
1402 bu_init(c); in mount_ubifs()
1405 if (!c->ro_mount) { in mount_ubifs()
1406 c->write_reserve_buf = kmalloc(COMPRESSED_DATA_NODE_BUF_SZ, in mount_ubifs()
1408 if (!c->write_reserve_buf) in mount_ubifs()
1413 c->mounting = 1; in mount_ubifs()
1415 err = ubifs_read_superblock(c); in mount_ubifs()
1419 c->probing = 0; in mount_ubifs()
1425 if (!ubifs_compr_present(c->default_compr)) { in mount_ubifs()
1426 ubifs_err(c, "'compressor \"%s\" is not compiled in", in mount_ubifs()
1427 ubifs_compr_name(c->default_compr)); in mount_ubifs()
1428 err = -ENOTSUPP; in mount_ubifs()
1432 err = init_constants_sb(c); in mount_ubifs()
1436 sz = ALIGN(c->max_idx_node_sz, c->min_io_size); in mount_ubifs()
1437 sz = ALIGN(sz + c->max_idx_node_sz, c->min_io_size); in mount_ubifs()
1438 c->cbuf = kmalloc(sz, GFP_NOFS); in mount_ubifs()
1439 if (!c->cbuf) { in mount_ubifs()
1440 err = -ENOMEM; in mount_ubifs()
1444 err = alloc_wbufs(c); in mount_ubifs()
1448 sprintf(c->bgt_name, BGT_NAME_PATTERN, c->vi.ubi_num, c->vi.vol_id); in mount_ubifs()
1450 if (!c->ro_mount) { in mount_ubifs()
1452 c->bgt = kthread_create(ubifs_bg_thread, c, "%s", c->bgt_name); in mount_ubifs()
1453 if (IS_ERR(c->bgt)) { in mount_ubifs()
1454 err = PTR_ERR(c->bgt); in mount_ubifs()
1455 c->bgt = NULL; in mount_ubifs()
1456 ubifs_err(c, "cannot spawn \"%s\", error %d", in mount_ubifs()
1457 c->bgt_name, err); in mount_ubifs()
1460 wake_up_process(c->bgt); in mount_ubifs()
1464 err = ubifs_read_master(c); in mount_ubifs()
1468 init_constants_master(c); in mount_ubifs()
1470 if ((c->mst_node->flags & cpu_to_le32(UBIFS_MST_DIRTY)) != 0) { in mount_ubifs()
1471 ubifs_msg(c, "recovery needed"); in mount_ubifs()
1472 c->need_recovery = 1; in mount_ubifs()
1476 if (c->need_recovery && !c->ro_mount) { in mount_ubifs()
1477 err = ubifs_recover_inl_heads(c, c->sbuf); in mount_ubifs()
1483 err = ubifs_lpt_init(c, 1, !c->ro_mount); in mount_ubifs()
1488 if (!c->ro_mount && c->space_fixup) { in mount_ubifs()
1489 err = ubifs_fixup_free_space(c); in mount_ubifs()
1494 if (!c->ro_mount && !c->need_recovery) { in mount_ubifs()
1499 c->mst_node->flags |= cpu_to_le32(UBIFS_MST_DIRTY); in mount_ubifs()
1500 err = ubifs_write_master(c); in mount_ubifs()
1506 err = dbg_check_idx_size(c, c->bi.old_idx_sz); in mount_ubifs()
1510 err = ubifs_replay_journal(c); in mount_ubifs()
1515 c->bi.min_idx_lebs = ubifs_calc_min_idx_lebs(c); in mount_ubifs()
1517 err = ubifs_mount_orphans(c, c->need_recovery, c->ro_mount); in mount_ubifs()
1521 if (!c->ro_mount) { in mount_ubifs()
1525 err = check_free_space(c); in mount_ubifs()
1530 lnum = c->lhead_lnum + 1; in mount_ubifs()
1531 if (lnum >= UBIFS_LOG_LNUM + c->log_lebs) in mount_ubifs()
1533 if (lnum == c->ltail_lnum) { in mount_ubifs()
1534 err = ubifs_consolidate_log(c); in mount_ubifs()
1539 if (c->need_recovery) { in mount_ubifs()
1540 err = ubifs_recover_size(c); in mount_ubifs()
1543 err = ubifs_rcvry_gc_commit(c); in mount_ubifs()
1547 err = take_gc_lnum(c); in mount_ubifs()
1553 * reboot, and it should be un-mapped. in mount_ubifs()
1555 err = ubifs_leb_unmap(c, c->gc_lnum); in mount_ubifs()
1560 err = dbg_check_lprops(c); in mount_ubifs()
1564 } else if (c->need_recovery) { in mount_ubifs()
1565 err = ubifs_recover_size(c); in mount_ubifs()
1570 * Even if we mount read-only, we have to set space in GC LEB in mount_ubifs()
1573 * re-mounting from R/O to R/W changes amount of free space. in mount_ubifs()
1575 err = take_gc_lnum(c); in mount_ubifs()
1582 list_add_tail(&c->infos_list, &ubifs_infos); in mount_ubifs()
1586 if (c->need_recovery) { in mount_ubifs()
1587 if (c->ro_mount) in mount_ubifs()
1588 ubifs_msg(c, "recovery deferred"); in mount_ubifs()
1590 c->need_recovery = 0; in mount_ubifs()
1591 ubifs_msg(c, "recovery completed"); in mount_ubifs()
1597 ubifs_assert(c->lst.taken_empty_lebs > 0); in mount_ubifs()
1600 ubifs_assert(c->lst.taken_empty_lebs > 0); in mount_ubifs()
1602 err = dbg_check_filesystem(c); in mount_ubifs()
1606 err = dbg_debugfs_init_fs(c); in mount_ubifs()
1610 c->mounting = 0; in mount_ubifs()
1612 ubifs_msg(c, "UBIFS: mounted UBI device %d, volume %d, name \"%s\"%s", in mount_ubifs()
1613 c->vi.ubi_num, c->vi.vol_id, c->vi.name, in mount_ubifs()
1614 c->ro_mount ? ", R/O mode" : ""); in mount_ubifs()
1615 x = (long long)c->main_lebs * c->leb_size; in mount_ubifs()
1616 y = (long long)c->log_lebs * c->leb_size + c->max_bud_bytes; in mount_ubifs()
1617 ubifs_msg(c, "LEB size: %d bytes (%d KiB), min./max. I/O unit sizes: %d bytes/%d bytes", in mount_ubifs()
1618 c->leb_size, c->leb_size >> 10, c->min_io_size, in mount_ubifs()
1619 c->max_write_size); in mount_ubifs()
1620 …ubifs_msg(c, "FS size: %lld bytes (%lld MiB, %d LEBs), journal size %lld bytes (%lld MiB, %d LEBs)… in mount_ubifs()
1621 x, x >> 20, c->main_lebs, in mount_ubifs()
1622 y, y >> 20, c->log_lebs + c->max_bud_cnt); in mount_ubifs()
1623 ubifs_msg(c, "reserved for root: %llu bytes (%llu KiB)", in mount_ubifs()
1624 c->report_rp_size, c->report_rp_size >> 10); in mount_ubifs()
1625 ubifs_msg(c, "media format: w%d/r%d (latest is w%d/r%d), UUID %pUB%s", in mount_ubifs()
1626 c->fmt_version, c->ro_compat_version, in mount_ubifs()
1627 UBIFS_FORMAT_VERSION, UBIFS_RO_COMPAT_VERSION, c->uuid, in mount_ubifs()
1628 c->big_lpt ? ", big LPT model" : ", small LPT model"); in mount_ubifs()
1630 dbg_gen("default compressor: %s", ubifs_compr_name(c->default_compr)); in mount_ubifs()
1632 c->jhead_cnt - NONDATA_JHEADS_CNT); in mount_ubifs()
1633 dbg_gen("log LEBs: %d (%d - %d)", in mount_ubifs()
1634 c->log_lebs, UBIFS_LOG_LNUM, c->log_last); in mount_ubifs()
1635 dbg_gen("LPT area LEBs: %d (%d - %d)", in mount_ubifs()
1636 c->lpt_lebs, c->lpt_first, c->lpt_last); in mount_ubifs()
1637 dbg_gen("orphan area LEBs: %d (%d - %d)", in mount_ubifs()
1638 c->orph_lebs, c->orph_first, c->orph_last); in mount_ubifs()
1639 dbg_gen("main area LEBs: %d (%d - %d)", in mount_ubifs()
1640 c->main_lebs, c->main_first, c->leb_cnt - 1); in mount_ubifs()
1641 dbg_gen("index LEBs: %d", c->lst.idx_lebs); in mount_ubifs()
1643 c->bi.old_idx_sz, c->bi.old_idx_sz >> 10, in mount_ubifs()
1644 c->bi.old_idx_sz >> 20); in mount_ubifs()
1645 dbg_gen("key hash type: %d", c->key_hash_type); in mount_ubifs()
1646 dbg_gen("tree fanout: %d", c->fanout); in mount_ubifs()
1647 dbg_gen("reserved GC LEB: %d", c->gc_lnum); in mount_ubifs()
1648 dbg_gen("max. znode size %d", c->max_znode_sz); in mount_ubifs()
1649 dbg_gen("max. index node size %d", c->max_idx_node_sz); in mount_ubifs()
1658 UBIFS_MAX_DENT_NODE_SZ, ubifs_idx_node_sz(c, c->fanout)); in mount_ubifs()
1659 dbg_gen("dead watermark: %d", c->dead_wm); in mount_ubifs()
1660 dbg_gen("dark watermark: %d", c->dark_wm); in mount_ubifs()
1661 dbg_gen("LEB overhead: %d", c->leb_overhead); in mount_ubifs()
1662 x = (long long)c->main_lebs * c->dark_wm; in mount_ubifs()
1666 c->max_bud_bytes, c->max_bud_bytes >> 10, in mount_ubifs()
1667 c->max_bud_bytes >> 20); in mount_ubifs()
1669 c->bg_bud_bytes, c->bg_bud_bytes >> 10, in mount_ubifs()
1670 c->bg_bud_bytes >> 20); in mount_ubifs()
1672 c->bud_bytes, c->bud_bytes >> 10, c->bud_bytes >> 20); in mount_ubifs()
1673 dbg_gen("max. seq. number: %llu", c->max_sqnum); in mount_ubifs()
1674 dbg_gen("commit number: %llu", c->cmt_no); in mount_ubifs()
1680 list_del(&c->infos_list); in mount_ubifs()
1683 free_orphans(c); in mount_ubifs()
1685 destroy_journal(c); in mount_ubifs()
1687 ubifs_lpt_free(c, 0); in mount_ubifs()
1689 kfree(c->mst_node); in mount_ubifs()
1690 kfree(c->rcvrd_mst_node); in mount_ubifs()
1691 if (c->bgt) in mount_ubifs()
1692 kthread_stop(c->bgt); in mount_ubifs()
1696 free_wbufs(c); in mount_ubifs()
1698 kfree(c->cbuf); in mount_ubifs()
1700 kfree(c->write_reserve_buf); in mount_ubifs()
1701 kfree(c->bu.buf); in mount_ubifs()
1702 vfree(c->ileb_buf); in mount_ubifs()
1703 vfree(c->sbuf); in mount_ubifs()
1704 kfree(c->bottom_up_buf); in mount_ubifs()
1705 ubifs_debugging_exit(c); in mount_ubifs()
1710 * ubifs_umount - un-mount UBIFS file-system.
1711 * @c: UBIFS file-system description object
1713 * Note, this function is called to free allocated resourced when un-mounting,
1719 static void ubifs_umount(struct ubifs_info *c) in ubifs_umount() argument
1721 void ubifs_umount(struct ubifs_info *c) in ubifs_umount()
1724 dbg_gen("un-mounting UBI device %d, volume %d", c->vi.ubi_num, in ubifs_umount()
1725 c->vi.vol_id); in ubifs_umount()
1727 dbg_debugfs_exit_fs(c); in ubifs_umount()
1729 list_del(&c->infos_list); in ubifs_umount()
1733 if (c->bgt) in ubifs_umount()
1734 kthread_stop(c->bgt); in ubifs_umount()
1736 destroy_journal(c); in ubifs_umount()
1738 free_wbufs(c); in ubifs_umount()
1739 free_orphans(c); in ubifs_umount()
1740 ubifs_lpt_free(c, 0); in ubifs_umount()
1742 kfree(c->cbuf); in ubifs_umount()
1743 kfree(c->rcvrd_mst_node); in ubifs_umount()
1744 kfree(c->mst_node); in ubifs_umount()
1745 kfree(c->write_reserve_buf); in ubifs_umount()
1746 kfree(c->bu.buf); in ubifs_umount()
1747 vfree(c->ileb_buf); in ubifs_umount()
1748 vfree(c->sbuf); in ubifs_umount()
1749 kfree(c->bottom_up_buf); in ubifs_umount()
1750 ubifs_debugging_exit(c); in ubifs_umount()
1752 ubi_close_volume(c->ubi); in ubifs_umount()
1753 mutex_unlock(&c->umount_mutex); in ubifs_umount()
1754 /* Finally free U-Boot's global copy of superblock */ in ubifs_umount()
1756 free(ubifs_sb->s_fs_info); in ubifs_umount()
1764 * ubifs_remount_rw - re-mount in read-write mode.
1765 * @c: UBIFS file-system description object
1767 * UBIFS avoids allocating many unnecessary resources when mounted in read-only
1768 * mode. This function allocates the needed resources and re-mounts UBIFS in
1769 * read-write mode.
1771 static int ubifs_remount_rw(struct ubifs_info *c) in ubifs_remount_rw() argument
1775 if (c->rw_incompat) { in ubifs_remount_rw()
1776 ubifs_err(c, "the file-system is not R/W-compatible"); in ubifs_remount_rw()
1777 …ubifs_msg(c, "on-flash format version is w%d/r%d, but software only supports up to version w%d/r%d… in ubifs_remount_rw()
1778 c->fmt_version, c->ro_compat_version, in ubifs_remount_rw()
1780 return -EROFS; in ubifs_remount_rw()
1783 mutex_lock(&c->umount_mutex); in ubifs_remount_rw()
1784 dbg_save_space_info(c); in ubifs_remount_rw()
1785 c->remounting_rw = 1; in ubifs_remount_rw()
1786 c->ro_mount = 0; in ubifs_remount_rw()
1788 if (c->space_fixup) { in ubifs_remount_rw()
1789 err = ubifs_fixup_free_space(c); in ubifs_remount_rw()
1794 err = check_free_space(c); in ubifs_remount_rw()
1798 if (c->old_leb_cnt != c->leb_cnt) { in ubifs_remount_rw()
1801 sup = ubifs_read_sb_node(c); in ubifs_remount_rw()
1806 sup->leb_cnt = cpu_to_le32(c->leb_cnt); in ubifs_remount_rw()
1807 err = ubifs_write_sb_node(c, sup); in ubifs_remount_rw()
1813 if (c->need_recovery) { in ubifs_remount_rw()
1814 ubifs_msg(c, "completing deferred recovery"); in ubifs_remount_rw()
1815 err = ubifs_write_rcvrd_mst_node(c); in ubifs_remount_rw()
1818 err = ubifs_recover_size(c); in ubifs_remount_rw()
1821 err = ubifs_clean_lebs(c, c->sbuf); in ubifs_remount_rw()
1824 err = ubifs_recover_inl_heads(c, c->sbuf); in ubifs_remount_rw()
1829 ubifs_assert(c->tot_orphans == 0); in ubifs_remount_rw()
1830 err = ubifs_clear_orphans(c); in ubifs_remount_rw()
1835 if (!(c->mst_node->flags & cpu_to_le32(UBIFS_MST_DIRTY))) { in ubifs_remount_rw()
1836 c->mst_node->flags |= cpu_to_le32(UBIFS_MST_DIRTY); in ubifs_remount_rw()
1837 err = ubifs_write_master(c); in ubifs_remount_rw()
1842 c->ileb_buf = vmalloc(c->leb_size); in ubifs_remount_rw()
1843 if (!c->ileb_buf) { in ubifs_remount_rw()
1844 err = -ENOMEM; in ubifs_remount_rw()
1848 c->write_reserve_buf = kmalloc(COMPRESSED_DATA_NODE_BUF_SZ, GFP_KERNEL); in ubifs_remount_rw()
1849 if (!c->write_reserve_buf) { in ubifs_remount_rw()
1850 err = -ENOMEM; in ubifs_remount_rw()
1854 err = ubifs_lpt_init(c, 0, 1); in ubifs_remount_rw()
1859 c->bgt = kthread_create(ubifs_bg_thread, c, "%s", c->bgt_name); in ubifs_remount_rw()
1860 if (IS_ERR(c->bgt)) { in ubifs_remount_rw()
1861 err = PTR_ERR(c->bgt); in ubifs_remount_rw()
1862 c->bgt = NULL; in ubifs_remount_rw()
1863 ubifs_err(c, "cannot spawn \"%s\", error %d", in ubifs_remount_rw()
1864 c->bgt_name, err); in ubifs_remount_rw()
1867 wake_up_process(c->bgt); in ubifs_remount_rw()
1869 c->orph_buf = vmalloc(c->leb_size); in ubifs_remount_rw()
1870 if (!c->orph_buf) { in ubifs_remount_rw()
1871 err = -ENOMEM; in ubifs_remount_rw()
1876 lnum = c->lhead_lnum + 1; in ubifs_remount_rw()
1877 if (lnum >= UBIFS_LOG_LNUM + c->log_lebs) in ubifs_remount_rw()
1879 if (lnum == c->ltail_lnum) { in ubifs_remount_rw()
1880 err = ubifs_consolidate_log(c); in ubifs_remount_rw()
1885 if (c->need_recovery) in ubifs_remount_rw()
1886 err = ubifs_rcvry_gc_commit(c); in ubifs_remount_rw()
1888 err = ubifs_leb_unmap(c, c->gc_lnum); in ubifs_remount_rw()
1892 dbg_gen("re-mounted read-write"); in ubifs_remount_rw()
1893 c->remounting_rw = 0; in ubifs_remount_rw()
1895 if (c->need_recovery) { in ubifs_remount_rw()
1896 c->need_recovery = 0; in ubifs_remount_rw()
1897 ubifs_msg(c, "deferred recovery completed"); in ubifs_remount_rw()
1902 * file-system in a state where the TNC and lprops has been in ubifs_remount_rw()
1904 * commit) were deferred. So the file-system was in in ubifs_remount_rw()
1905 * "non-committed" state. Now the file-system is in committed in ubifs_remount_rw()
1909 err = dbg_check_space_info(c); in ubifs_remount_rw()
1912 mutex_unlock(&c->umount_mutex); in ubifs_remount_rw()
1916 c->ro_mount = 1; in ubifs_remount_rw()
1917 vfree(c->orph_buf); in ubifs_remount_rw()
1918 c->orph_buf = NULL; in ubifs_remount_rw()
1919 if (c->bgt) { in ubifs_remount_rw()
1920 kthread_stop(c->bgt); in ubifs_remount_rw()
1921 c->bgt = NULL; in ubifs_remount_rw()
1923 free_wbufs(c); in ubifs_remount_rw()
1924 kfree(c->write_reserve_buf); in ubifs_remount_rw()
1925 c->write_reserve_buf = NULL; in ubifs_remount_rw()
1926 vfree(c->ileb_buf); in ubifs_remount_rw()
1927 c->ileb_buf = NULL; in ubifs_remount_rw()
1928 ubifs_lpt_free(c, 1); in ubifs_remount_rw()
1929 c->remounting_rw = 0; in ubifs_remount_rw()
1930 mutex_unlock(&c->umount_mutex); in ubifs_remount_rw()
1935 * ubifs_remount_ro - re-mount in read-only mode.
1936 * @c: UBIFS file-system description object
1941 static void ubifs_remount_ro(struct ubifs_info *c) in ubifs_remount_ro() argument
1945 ubifs_assert(!c->need_recovery); in ubifs_remount_ro()
1946 ubifs_assert(!c->ro_mount); in ubifs_remount_ro()
1948 mutex_lock(&c->umount_mutex); in ubifs_remount_ro()
1949 if (c->bgt) { in ubifs_remount_ro()
1950 kthread_stop(c->bgt); in ubifs_remount_ro()
1951 c->bgt = NULL; in ubifs_remount_ro()
1954 dbg_save_space_info(c); in ubifs_remount_ro()
1956 for (i = 0; i < c->jhead_cnt; i++) in ubifs_remount_ro()
1957 ubifs_wbuf_sync(&c->jheads[i].wbuf); in ubifs_remount_ro()
1959 c->mst_node->flags &= ~cpu_to_le32(UBIFS_MST_DIRTY); in ubifs_remount_ro()
1960 c->mst_node->flags |= cpu_to_le32(UBIFS_MST_NO_ORPHS); in ubifs_remount_ro()
1961 c->mst_node->gc_lnum = cpu_to_le32(c->gc_lnum); in ubifs_remount_ro()
1962 err = ubifs_write_master(c); in ubifs_remount_ro()
1964 ubifs_ro_mode(c, err); in ubifs_remount_ro()
1966 vfree(c->orph_buf); in ubifs_remount_ro()
1967 c->orph_buf = NULL; in ubifs_remount_ro()
1968 kfree(c->write_reserve_buf); in ubifs_remount_ro()
1969 c->write_reserve_buf = NULL; in ubifs_remount_ro()
1970 vfree(c->ileb_buf); in ubifs_remount_ro()
1971 c->ileb_buf = NULL; in ubifs_remount_ro()
1972 ubifs_lpt_free(c, 1); in ubifs_remount_ro()
1973 c->ro_mount = 1; in ubifs_remount_ro()
1974 err = dbg_check_space_info(c); in ubifs_remount_ro()
1976 ubifs_ro_mode(c, err); in ubifs_remount_ro()
1977 mutex_unlock(&c->umount_mutex); in ubifs_remount_ro()
1983 struct ubifs_info *c = sb->s_fs_info; in ubifs_put_super() local
1985 ubifs_msg(c, "un-mount UBI device %d", c->vi.ubi_num); in ubifs_put_super()
1992 if (!c->ro_error) { in ubifs_put_super()
1993 ubifs_assert(c->bi.idx_growth == 0); in ubifs_put_super()
1994 ubifs_assert(c->bi.dd_growth == 0); in ubifs_put_super()
1995 ubifs_assert(c->bi.data_growth == 0); in ubifs_put_super()
1999 * The 'c->umount_lock' prevents races between UBIFS memory shrinker in ubifs_put_super()
2000 * and file system un-mount. Namely, it prevents the shrinker from in ubifs_put_super()
2001 * picking this superblock for shrinking - it will be just skipped if in ubifs_put_super()
2004 mutex_lock(&c->umount_mutex); in ubifs_put_super()
2005 if (!c->ro_mount) { in ubifs_put_super()
2008 * not interfere with un-mounting and freeing resources. in ubifs_put_super()
2010 if (c->bgt) { in ubifs_put_super()
2011 kthread_stop(c->bgt); in ubifs_put_super()
2012 c->bgt = NULL; in ubifs_put_super()
2016 * On fatal errors c->ro_error is set to 1, in which case we do in ubifs_put_super()
2019 if (!c->ro_error) { in ubifs_put_super()
2022 /* Synchronize write-buffers */ in ubifs_put_super()
2023 for (i = 0; i < c->jhead_cnt; i++) in ubifs_put_super()
2024 ubifs_wbuf_sync(&c->jheads[i].wbuf); in ubifs_put_super()
2028 * orphans were killed - indicate this in the master in ubifs_put_super()
2031 c->mst_node->flags &= ~cpu_to_le32(UBIFS_MST_DIRTY); in ubifs_put_super()
2032 c->mst_node->flags |= cpu_to_le32(UBIFS_MST_NO_ORPHS); in ubifs_put_super()
2033 c->mst_node->gc_lnum = cpu_to_le32(c->gc_lnum); in ubifs_put_super()
2034 err = ubifs_write_master(c); in ubifs_put_super()
2041 ubifs_err(c, "failed to write master node, error %d", in ubifs_put_super()
2045 for (i = 0; i < c->jhead_cnt; i++) in ubifs_put_super()
2046 /* Make sure write-buffer timers are canceled */ in ubifs_put_super()
2047 hrtimer_cancel(&c->jheads[i].wbuf.timer); in ubifs_put_super()
2052 ubifs_umount(c); in ubifs_put_super()
2054 bdi_destroy(&c->bdi); in ubifs_put_super()
2055 ubi_close_volume(c->ubi); in ubifs_put_super()
2056 mutex_unlock(&c->umount_mutex); in ubifs_put_super()
2065 struct ubifs_info *c = sb->s_fs_info; in ubifs_remount_fs() local
2068 dbg_gen("old flags %#lx, new flags %#x", sb->s_flags, *flags); in ubifs_remount_fs()
2070 err = ubifs_parse_options(c, data, 1); in ubifs_remount_fs()
2072 ubifs_err(c, "invalid or unknown remount parameter"); in ubifs_remount_fs()
2076 if (c->ro_mount && !(*flags & MS_RDONLY)) { in ubifs_remount_fs()
2077 if (c->ro_error) { in ubifs_remount_fs()
2078 ubifs_msg(c, "cannot re-mount R/W due to prior errors"); in ubifs_remount_fs()
2079 return -EROFS; in ubifs_remount_fs()
2081 if (c->ro_media) { in ubifs_remount_fs()
2082 ubifs_msg(c, "cannot re-mount R/W - UBI volume is R/O"); in ubifs_remount_fs()
2083 return -EROFS; in ubifs_remount_fs()
2085 err = ubifs_remount_rw(c); in ubifs_remount_fs()
2088 } else if (!c->ro_mount && (*flags & MS_RDONLY)) { in ubifs_remount_fs()
2089 if (c->ro_error) { in ubifs_remount_fs()
2090 ubifs_msg(c, "cannot re-mount R/O due to prior errors"); in ubifs_remount_fs()
2091 return -EROFS; in ubifs_remount_fs()
2093 ubifs_remount_ro(c); in ubifs_remount_fs()
2096 if (c->bulk_read == 1) in ubifs_remount_fs()
2097 bu_init(c); in ubifs_remount_fs()
2099 dbg_gen("disable bulk-read"); in ubifs_remount_fs()
2100 kfree(c->bu.buf); in ubifs_remount_fs()
2101 c->bu.buf = NULL; in ubifs_remount_fs()
2104 ubifs_assert(c->lst.taken_empty_lebs > 0); in ubifs_remount_fs()
2127 * open_ubi - parse UBI device name string and open the UBI device.
2135 * o ubiX_Y - mount UBI device number X, volume Y;
2136 * o ubiY - mount UBI device number 0, volume Y;
2137 * o ubiX:NAME - mount UBI device X, volume with name NAME;
2138 * o ubi:NAME - mount UBI device 0, volume with name NAME.
2162 return ERR_PTR(-EINVAL); in open_ubi()
2169 return ERR_PTR(-EINVAL); in open_ubi()
2181 return ERR_PTR(-EINVAL); in open_ubi()
2189 return ERR_PTR(-EINVAL); in open_ubi()
2194 struct ubifs_info *c; in alloc_ubifs_info() local
2196 c = kzalloc(sizeof(struct ubifs_info), GFP_KERNEL); in alloc_ubifs_info()
2197 if (c) { in alloc_ubifs_info()
2198 spin_lock_init(&c->cnt_lock); in alloc_ubifs_info()
2199 spin_lock_init(&c->cs_lock); in alloc_ubifs_info()
2200 spin_lock_init(&c->buds_lock); in alloc_ubifs_info()
2201 spin_lock_init(&c->space_lock); in alloc_ubifs_info()
2202 spin_lock_init(&c->orphan_lock); in alloc_ubifs_info()
2203 init_rwsem(&c->commit_sem); in alloc_ubifs_info()
2204 mutex_init(&c->lp_mutex); in alloc_ubifs_info()
2205 mutex_init(&c->tnc_mutex); in alloc_ubifs_info()
2206 mutex_init(&c->log_mutex); in alloc_ubifs_info()
2207 mutex_init(&c->umount_mutex); in alloc_ubifs_info()
2208 mutex_init(&c->bu_mutex); in alloc_ubifs_info()
2209 mutex_init(&c->write_reserve_mutex); in alloc_ubifs_info()
2210 init_waitqueue_head(&c->cmt_wq); in alloc_ubifs_info()
2211 c->buds = RB_ROOT; in alloc_ubifs_info()
2212 c->old_idx = RB_ROOT; in alloc_ubifs_info()
2213 c->size_tree = RB_ROOT; in alloc_ubifs_info()
2214 c->orph_tree = RB_ROOT; in alloc_ubifs_info()
2215 INIT_LIST_HEAD(&c->infos_list); in alloc_ubifs_info()
2216 INIT_LIST_HEAD(&c->idx_gc); in alloc_ubifs_info()
2217 INIT_LIST_HEAD(&c->replay_list); in alloc_ubifs_info()
2218 INIT_LIST_HEAD(&c->replay_buds); in alloc_ubifs_info()
2219 INIT_LIST_HEAD(&c->uncat_list); in alloc_ubifs_info()
2220 INIT_LIST_HEAD(&c->empty_list); in alloc_ubifs_info()
2221 INIT_LIST_HEAD(&c->freeable_list); in alloc_ubifs_info()
2222 INIT_LIST_HEAD(&c->frdi_idx_list); in alloc_ubifs_info()
2223 INIT_LIST_HEAD(&c->unclean_leb_list); in alloc_ubifs_info()
2224 INIT_LIST_HEAD(&c->old_buds); in alloc_ubifs_info()
2225 INIT_LIST_HEAD(&c->orph_list); in alloc_ubifs_info()
2226 INIT_LIST_HEAD(&c->orph_new); in alloc_ubifs_info()
2227 c->no_chk_data_crc = 1; in alloc_ubifs_info()
2229 c->highest_inum = UBIFS_FIRST_INO; in alloc_ubifs_info()
2230 c->lhead_lnum = c->ltail_lnum = UBIFS_LOG_LNUM; in alloc_ubifs_info()
2232 ubi_get_volume_info(ubi, &c->vi); in alloc_ubifs_info()
2233 ubi_get_device_info(c->vi.ubi_num, &c->di); in alloc_ubifs_info()
2235 return c; in alloc_ubifs_info()
2240 struct ubifs_info *c = sb->s_fs_info; in ubifs_fill_super() local
2244 c->vfs_sb = sb; in ubifs_fill_super()
2246 /* Re-open the UBI device in read-write mode */ in ubifs_fill_super()
2247 c->ubi = ubi_open_volume(c->vi.ubi_num, c->vi.vol_id, UBI_READWRITE); in ubifs_fill_super()
2249 /* U-Boot read only mode */ in ubifs_fill_super()
2250 c->ubi = ubi_open_volume(c->vi.ubi_num, c->vi.vol_id, UBI_READONLY); in ubifs_fill_super()
2253 if (IS_ERR(c->ubi)) { in ubifs_fill_super()
2254 err = PTR_ERR(c->ubi); in ubifs_fill_super()
2260 * UBIFS provides 'backing_dev_info' in order to disable read-ahead. For in ubifs_fill_super()
2263 * but the read-ahead I/O as well i.e. completely pointless. in ubifs_fill_super()
2265 * Read-ahead will be disabled because @c->bdi.ra_pages is 0. in ubifs_fill_super()
2267 c->bdi.name = "ubifs", in ubifs_fill_super()
2268 c->bdi.capabilities = 0; in ubifs_fill_super()
2269 err = bdi_init(&c->bdi); in ubifs_fill_super()
2272 err = bdi_register(&c->bdi, NULL, "ubifs_%d_%d", in ubifs_fill_super()
2273 c->vi.ubi_num, c->vi.vol_id); in ubifs_fill_super()
2277 err = ubifs_parse_options(c, data, 0); in ubifs_fill_super()
2281 sb->s_bdi = &c->bdi; in ubifs_fill_super()
2283 sb->s_fs_info = c; in ubifs_fill_super()
2284 sb->s_magic = UBIFS_SUPER_MAGIC; in ubifs_fill_super()
2285 sb->s_blocksize = UBIFS_BLOCK_SIZE; in ubifs_fill_super()
2286 sb->s_blocksize_bits = UBIFS_BLOCK_SHIFT; in ubifs_fill_super()
2287 sb->s_maxbytes = c->max_inode_sz = key_max_inode_size(c); in ubifs_fill_super()
2288 if (c->max_inode_sz > MAX_LFS_FILESIZE) in ubifs_fill_super()
2289 sb->s_maxbytes = c->max_inode_sz = MAX_LFS_FILESIZE; in ubifs_fill_super()
2290 sb->s_op = &ubifs_super_operations; in ubifs_fill_super()
2292 sb->s_xattr = ubifs_xattr_handlers; in ubifs_fill_super()
2295 mutex_lock(&c->umount_mutex); in ubifs_fill_super()
2296 err = mount_ubifs(c); in ubifs_fill_super()
2310 sb->s_root = d_make_root(root); in ubifs_fill_super()
2311 if (!sb->s_root) { in ubifs_fill_super()
2312 err = -ENOMEM; in ubifs_fill_super()
2316 sb->s_root = NULL; in ubifs_fill_super()
2319 mutex_unlock(&c->umount_mutex); in ubifs_fill_super()
2323 ubifs_umount(c); in ubifs_fill_super()
2328 mutex_unlock(&c->umount_mutex); in ubifs_fill_super()
2331 bdi_destroy(&c->bdi); in ubifs_fill_super()
2334 ubi_close_volume(c->ubi); in ubifs_fill_super()
2342 struct ubifs_info *c = sb->s_fs_info; in sb_test() local
2344 return c->vi.cdev == c1->vi.cdev; in sb_test()
2349 sb->s_fs_info = data; in sb_set()
2360 err = -ENOMEM; in alloc_super()
2365 INIT_HLIST_NODE(&s->s_instances); in alloc_super()
2367 INIT_LIST_HEAD(&s->s_inodes); in alloc_super()
2368 s->s_time_gran = 1000000000; in alloc_super()
2369 s->s_flags = flags; in alloc_super()
2375 * sget - find or create a superblock
2398 hlist_for_each_entry(old, &type->fs_supers, s_instances) { in sget()
2404 up_write(&s->s_umount); in sget()
2416 return ERR_PTR(-ENOMEM); in sget()
2426 up_write(&s->s_umount); in sget()
2431 s->s_type = type; in sget()
2433 strlcpy(s->s_id, type->name, sizeof(s->s_id)); in sget()
2434 list_add_tail(&s->s_list, &super_blocks); in sget()
2435 hlist_add_head(&s->s_instances, &type->fs_supers); in sget()
2438 register_shrinker(&s->s_shrink); in sget()
2440 strncpy(s->s_id, type->name, sizeof(s->s_id)); in sget()
2452 struct ubifs_info *c; in ubifs_mount() local
2459 * Get UBI device number and volume ID. Mount it read-only so far in ubifs_mount()
2461 * read-write user at a time. in ubifs_mount()
2466 current->pid, name, (int)PTR_ERR(ubi)); in ubifs_mount()
2470 c = alloc_ubifs_info(ubi); in ubifs_mount()
2471 if (!c) { in ubifs_mount()
2472 err = -ENOMEM; in ubifs_mount()
2476 dbg_gen("opened ubi%d_%d", c->vi.ubi_num, c->vi.vol_id); in ubifs_mount()
2478 sb = sget(fs_type, sb_test, sb_set, flags, c); in ubifs_mount()
2481 kfree(c); in ubifs_mount()
2485 if (sb->s_root) { in ubifs_mount()
2486 struct ubifs_info *c1 = sb->s_fs_info; in ubifs_mount()
2487 kfree(c); in ubifs_mount()
2490 if (!!(flags & MS_RDONLY) != c1->ro_mount) { in ubifs_mount()
2491 err = -EBUSY; in ubifs_mount()
2499 sb->s_flags |= MS_ACTIVE | MS_NOATIME; in ubifs_mount()
2509 return dget(sb->s_root); in ubifs_mount()
2523 struct ubifs_info *c = s->s_fs_info; in kill_ubifs_super() local
2527 kfree(c); in kill_ubifs_super()
2545 inode_init_once(&ui->vfs_inode); in inode_slab_ctor()
2557 /* Make sure node sizes are 8-byte aligned */ in ubifs_init()
2595 * We use 2 bit wide bit-fields to store compression type, which should in ubifs_init()
2596 * be amended if more compressors are added. The bit-fields are: in ubifs_init()
2603 * We require that PAGE_CACHE_SIZE is greater-than-or-equal-to in ubifs_init()
2608 current->pid, (unsigned int)PAGE_CACHE_SIZE); in ubifs_init()
2609 return -EINVAL; in ubifs_init()
2618 return -ENOMEM; in ubifs_init()
2637 current->pid, err); in ubifs_init()
2683 MODULE_DESCRIPTION("UBIFS - UBI File System");
2694 ubifs_umount(ubifs_sb->s_fs_info); in uboot_ubifs_mount()
2697 * Mount in read-only mode in uboot_ubifs_mount()
2704 return -1; in uboot_ubifs_mount()