firmware/br-ext-chip-goke/board/gk7205v200/kernel/patches/00_fs-fat-file.c.patch

73 lines
1.9 KiB
Diff

--- linux-4.9.37/fs/fat/file.c 2017-07-12 16:42:41.000000000 +0300
+++ linux-4.9.y/fs/fat/file.c 2021-06-07 13:01:34.000000000 +0300
@@ -167,8 +167,17 @@
return res ? res : err;
}
+#ifdef CONFIG_GOKE_MC
+int fat_file_flush(struct file *file, fl_owner_t id)
+{
+ struct address_space * mapping = file->f_mapping;
+ struct inode *inode = mapping->host;
+ inode->i_sb->s_op->write_inode(inode, NULL);
+ return 0;
+}
+#endif
const struct file_operations fat_file_operations = {
.llseek = generic_file_llseek,
.read_iter = generic_file_read_iter,
@@ -182,6 +191,9 @@
.fsync = fat_file_fsync,
.splice_read = generic_file_splice_read,
.fallocate = fat_fallocate,
+#ifdef CONFIG_GOKE_MC
+ .flush = fat_file_flush,
+#endif
};
static int fat_cont_expand(struct inode *inode, loff_t size)
@@ -431,7 +443,13 @@
/* use a default check */
return 0;
}
-
+#ifdef CONFIG_GOKE_MC
+void reset_mmu_private(struct inode *inode, loff_t offset)
+{
+ MSDOS_I(inode)->mmu_private = offset;
+ inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC;
+}
+#endif
#define TIMES_SET_FLAGS (ATTR_MTIME_SET | ATTR_ATIME_SET | ATTR_TIMES_SET)
/* valid file mode bits */
#define FAT_VALID_MODE (S_IFREG | S_IFDIR | S_IRWXUGO)
@@ -464,6 +482,7 @@
* hole before it. XXX: this is no longer true with new truncate
* sequence.
*/
+#ifndef CONFIG_GOKE_MC
if (attr->ia_valid & ATTR_SIZE) {
inode_dio_wait(inode);
@@ -474,7 +493,7 @@
attr->ia_valid &= ~ATTR_SIZE;
}
}
-
+#endif
if (((attr->ia_valid & ATTR_UID) &&
(!uid_eq(attr->ia_uid, sbi->options.fs_uid))) ||
((attr->ia_valid & ATTR_GID) &&
@@ -504,6 +523,9 @@
goto out;
down_write(&MSDOS_I(inode)->truncate_lock);
truncate_setsize(inode, attr->ia_size);
+#ifdef CONFIG_GOKE_MC
+ reset_mmu_private(inode, attr->ia_size);
+#endif
fat_truncate_blocks(inode, attr->ia_size);
up_write(&MSDOS_I(inode)->truncate_lock);
}