Add hook for UBI bakvol in ubifs layer.

open/close bakvol operation in ubifs mount.

Signed-off-by: Bean Huo <[email protected]>
---
 fs/ubifs/super.c | 6 ++++++
 fs/ubifs/ubifs.h | 1 +
 2 files changed, 7 insertions(+)

diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 9547a278..f3bf548 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -1463,6 +1463,8 @@ static int mount_ubifs(struct ubifs_info *c)
        dbg_gen("max. seq. number:    %llu", c->max_sqnum);
        dbg_gen("commit number:       %llu", c->cmt_no);
 
+       init_bakvol(c->ubi, 1);
+
        return 0;
 
 out_infos:
@@ -1774,6 +1776,10 @@ static void ubifs_put_super(struct super_block *sb)
         * the mutex is locked.
         */
        mutex_lock(&c->umount_mutex);
+
+       /* Disable ubi MLC power loss backup function */
+       init_bakvol(c->ubi, 0);
+
        if (!c->ro_mount) {
                /*
                 * First of all kill the background thread to make sure it does
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index de75902..4af2d5a 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -1479,6 +1479,7 @@ extern const struct inode_operations 
ubifs_dir_inode_operations;
 extern const struct inode_operations ubifs_symlink_inode_operations;
 extern struct backing_dev_info ubifs_backing_dev_info;
 extern struct ubifs_compressor *ubifs_compressors[UBIFS_COMPR_TYPES_CNT];
+extern void init_bakvol(struct ubi_volume_desc *desc, uint8_t choice);
 
 /* io.c */
 void ubifs_ro_mode(struct ubifs_info *c, int err);
-- 
1.9.1

Reply via email to