linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: jaegeuk@kernel.org
Cc: linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, Chao Yu <yuchao0@huawei.com>
Subject: [PATCH v2 3/3] f2fs-tools: support project quota
Date: Wed, 19 Jul 2017 00:23:21 +0800	[thread overview]
Message-ID: <20170718162321.14673-2-chao@kernel.org> (raw)
In-Reply-To: <20170718162321.14673-1-chao@kernel.org>

From: Chao Yu <yuchao0@huawei.com>

This patch introduce a new option 'project_quota' for enabling project
quota functionality during mkfs.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
v2:
 - rebases codes
 - use '-O project_quota' option instead of '-p' for enabling project quota.
 fsck/mount.c            | 4 ++++
 include/f2fs_fs.h       | 4 ++++
 mkfs/f2fs_format.c      | 1 +
 mkfs/f2fs_format_main.c | 2 ++
 4 files changed, 11 insertions(+)

diff --git a/fsck/mount.c b/fsck/mount.c
index f41709e..0453f64 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -90,6 +90,7 @@ void print_inode_info(struct f2fs_inode *inode, int name)
 
 	DISP_u16(inode, i_extra_isize);
 	DISP_u16(inode, i_padding);
+	DISP_u32(inode, i_projid);
 
 	DISP_u32(inode, i_addr[ofs]);		/* Pointers to data blocks */
 	DISP_u32(inode, i_addr[ofs + 1]);	/* Pointers to data blocks */
@@ -287,6 +288,9 @@ void print_sb_state(struct f2fs_super_block *sb)
 	if (f & cpu_to_le32(F2FS_FEATURE_EXTRA_ATTR)) {
 		MSG(0, "%s", " extra attribute");
 	}
+	if (f & cpu_to_le32(F2FS_FEATURE_PRJQUOTA)) {
+		MSG(0, "%s", " project quota");
+	}
 	MSG(0, "\n");
 	MSG(0, "Info: superblock encrypt level = %d, salt = ",
 					sb->encryption_level);
diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
index 85e1a8c..d6ac712 100644
--- a/include/f2fs_fs.h
+++ b/include/f2fs_fs.h
@@ -471,6 +471,7 @@ enum {
 #define F2FS_FEATURE_ENCRYPT	0x0001
 #define F2FS_FEATURE_BLKZONED	0x0002
 #define F2FS_FEATURE_EXTRA_ATTR	0x0004
+#define F2FS_FEATURE_PRJQUOTA	0x0008
 
 #define MAX_VOLUME_NAME		512
 
@@ -623,6 +624,8 @@ struct f2fs_extent {
 	(offsetof(struct f2fs_inode, i_extra_end) -	\
 	offsetof(struct f2fs_inode, i_extra_isize))	\
 
+#define	F2FS_DEF_PROJID		0	/* default project ID */
+
 #define MAX_INLINE_DATA(node) (sizeof(__le32) *				\
 				(DEF_ADDRS_PER_INODE_INLINE_XATTR -	\
 				get_extra_isize(node) -			\
@@ -678,6 +681,7 @@ struct f2fs_inode {
 		struct {
 			__le16 i_extra_isize;	/* extra inode attribute size */
 			__le16 i_padding;	/* padding */
+			__le32 i_projid;	/* project id */
 			__le32 i_extra_end[0];	/* for attribute size calculation */
 		};
 		__le32 i_addr[DEF_ADDRS_PER_INODE];	/* Pointers to data blocks */
diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
index acfb56d..25b2ac5 100644
--- a/mkfs/f2fs_format.c
+++ b/mkfs/f2fs_format.c
@@ -927,6 +927,7 @@ static int f2fs_write_root_inode(void)
 		raw_node->i.i_inline = F2FS_EXTRA_ATTR;
 		raw_node->i.i_extra_isize =
 				cpu_to_le16(F2FS_TOTAL_EXTRA_ATTR_SIZE);
+		raw_node->i.i_projid = cpu_to_le32(F2FS_DEF_PROJID);
 	}
 
 	data_blk_nor = get_sb(main_blkaddr) +
diff --git a/mkfs/f2fs_format_main.c b/mkfs/f2fs_format_main.c
index 1a75a6f..04e18a9 100644
--- a/mkfs/f2fs_format_main.c
+++ b/mkfs/f2fs_format_main.c
@@ -82,6 +82,8 @@ static void parse_feature(const char *features)
 		c.feature |= cpu_to_le32(F2FS_FEATURE_ENCRYPT);
 	} else if (!strcmp(features, "extra_attr")) {
 		c.feature |= cpu_to_le32(F2FS_FEATURE_EXTRA_ATTR);
+	} else if (!strcmp(features, "project_quota")) {
+		c.feature |= cpu_to_le32(F2FS_FEATURE_PRJQUOTA);
 	} else {
 		MSG(0, "Error: Wrong features\n");
 		mkfs_usage();
-- 
2.13.0.90.g1eb437020

      reply	other threads:[~2017-07-18 16:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-18 16:23 [PATCH v2 2/3] f2fs-tools: enhance on-disk inode structure scalability Chao Yu
2017-07-18 16:23 ` Chao Yu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170718162321.14673-2-chao@kernel.org \
    --to=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yuchao0@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).