Re: [PATCH v10 03/14] exfat: add inode operations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday 15 January 2020 17:24:36 Namjae Jeon wrote:
> This adds the implementation of inode operations for exfat.
> 
> Signed-off-by: Namjae Jeon <namjae.jeon@xxxxxxxxxxx>
> Signed-off-by: Sungjong Seo <sj1557.seo@xxxxxxxxxxx>
> ---
>  fs/exfat/inode.c |  667 +++++++++++++++++++++
>  fs/exfat/namei.c | 1442 ++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 2109 insertions(+)
>  create mode 100644 fs/exfat/inode.c
>  create mode 100644 fs/exfat/namei.c
> 
> diff --git a/fs/exfat/inode.c b/fs/exfat/inode.c
> new file mode 100644
> index 000000000000..56cf09db1920
> --- /dev/null
> +++ b/fs/exfat/inode.c
> @@ -0,0 +1,667 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (C) 2012-2013 Samsung Electronics Co., Ltd.
> + */
> +
> +#include <linux/init.h>
> +#include <linux/buffer_head.h>
> +#include <linux/mpage.h>
> +#include <linux/bio.h>
> +#include <linux/blkdev.h>
> +#include <linux/time.h>
> +#include <linux/writeback.h>
> +#include <linux/uio.h>
> +#include <linux/random.h>
> +#include <linux/iversion.h>
> +
> +#include "exfat_raw.h"
> +#include "exfat_fs.h"
> +
> +static int __exfat_write_inode(struct inode *inode, int sync)
> +{
> +	int ret = -EIO;
> +	unsigned long long on_disk_size;
> +	struct exfat_dentry *ep, *ep2;
> +	struct exfat_entry_set_cache *es = NULL;
> +	struct super_block *sb = inode->i_sb;
> +	struct exfat_sb_info *sbi = EXFAT_SB(sb);
> +	struct exfat_inode_info *ei = EXFAT_I(inode);
> +	bool is_dir = (ei->type == TYPE_DIR) ? true : false;
> +
> +	if (inode->i_ino == EXFAT_ROOT_INO)
> +		return 0;
> +
> +	/*
> +	 * If the indode is already unlinked, there is no need for updating it.
> +	 */
> +	if (ei->dir.dir == DIR_DELETED)
> +		return 0;
> +
> +	if (is_dir && ei->dir.dir == sbi->root_dir && ei->entry == -1)
> +		return 0;
> +
> +	exfat_set_vol_flags(sb, VOL_DIRTY);
> +
> +	/* get the directory entry of given file or directory */
> +	es = exfat_get_dentry_set(sb, &(ei->dir), ei->entry, ES_ALL_ENTRIES,
> +		&ep);
> +	if (!es)
> +		return -EIO;
> +	ep2 = ep + 1;
> +
> +	ep->dentry.file.attr = cpu_to_le16(exfat_make_attr(inode));
> +
> +	/* set FILE_INFO structure using the acquired struct exfat_dentry */
> +	exfat_set_entry_time(sbi, &inode->i_ctime,
> +			&ep->dentry.file.create_time,
> +			&ep->dentry.file.create_date,
> +			&ep->dentry.file.create_tz);

And here is missing updating of create_time_ms entry too.

> +	exfat_set_entry_time(sbi, &inode->i_mtime,
> +			&ep->dentry.file.modify_time,
> +			&ep->dentry.file.modify_date,
> +			&ep->dentry.file.modify_tz);

And here modify_time_ms too.

> +	exfat_set_entry_time(sbi, &inode->i_atime,
> +			&ep->dentry.file.access_time,
> +			&ep->dentry.file.access_date,
> +			&ep->dentry.file.access_tz);
> +
> +	/* File size should be zero if there is no cluster allocated */
> +	on_disk_size = i_size_read(inode);
> +
> +	if (ei->start_clu == EXFAT_EOF_CLUSTER)
> +		on_disk_size = 0;
> +
> +	ep2->dentry.stream.valid_size = cpu_to_le64(on_disk_size);
> +	ep2->dentry.stream.size = ep2->dentry.stream.valid_size;
> +
> +	ret = exfat_update_dir_chksum_with_entry_set(sb, es, sync);
> +	kfree(es);
> +	return ret;
> +}

-- 
Pali Rohár
pali.rohar@xxxxxxxxx



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux