mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	f2fs: reserve nid resource for quota sysfile
During mkfs, quota sysfiles have already occupied nid resource, it needs to adjust remaining available nid count in kernel side. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
		
							parent
							
								
									ace52288ed
								
							
						
					
					
						commit
						292c196a36
					
				
					 4 changed files with 13 additions and 10 deletions
				
			
		| 
						 | 
				
			
			@ -49,14 +49,7 @@ static void update_general_status(struct f2fs_sb_info *sbi)
 | 
			
		|||
	si->ndirty_imeta = get_pages(sbi, F2FS_DIRTY_IMETA);
 | 
			
		||||
	si->ndirty_dirs = sbi->ndirty_inode[DIR_INODE];
 | 
			
		||||
	si->ndirty_files = sbi->ndirty_inode[FILE_INODE];
 | 
			
		||||
 | 
			
		||||
	si->nquota_files = 0;
 | 
			
		||||
	if (f2fs_sb_has_quota_ino(sbi->sb)) {
 | 
			
		||||
		for (i = 0; i < MAXQUOTAS; i++) {
 | 
			
		||||
			if (f2fs_qf_ino(sbi->sb, i))
 | 
			
		||||
				si->nquota_files++;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	si->nquota_files = sbi->nquota_files;
 | 
			
		||||
	si->ndirty_all = sbi->ndirty_inode[DIRTY_META];
 | 
			
		||||
	si->inmem_pages = get_pages(sbi, F2FS_INMEM_PAGES);
 | 
			
		||||
	si->aw_cnt = atomic_read(&sbi->aw_cnt);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1101,6 +1101,8 @@ struct f2fs_sb_info {
 | 
			
		|||
	block_t reserved_blocks;		/* configurable reserved blocks */
 | 
			
		||||
	block_t current_reserved_blocks;	/* current reserved blocks */
 | 
			
		||||
 | 
			
		||||
	unsigned int nquota_files;		/* # of quota sysfile */
 | 
			
		||||
 | 
			
		||||
	u32 s_next_generation;			/* for NFS support */
 | 
			
		||||
 | 
			
		||||
	/* # of pages, see count_type */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2661,7 +2661,7 @@ static int init_node_manager(struct f2fs_sb_info *sbi)
 | 
			
		|||
 | 
			
		||||
	/* not used nids: 0, node, meta, (and root counted as valid node) */
 | 
			
		||||
	nm_i->available_nids = nm_i->max_nid - sbi->total_valid_node_count -
 | 
			
		||||
							F2FS_RESERVED_NODE_NUM;
 | 
			
		||||
				sbi->nquota_files - F2FS_RESERVED_NODE_NUM;
 | 
			
		||||
	nm_i->nid_cnt[FREE_NID] = 0;
 | 
			
		||||
	nm_i->nid_cnt[PREALLOC_NID] = 0;
 | 
			
		||||
	nm_i->nat_cnt = 0;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1008,7 +1008,8 @@ static int f2fs_statfs(struct dentry *dentry, struct kstatfs *buf)
 | 
			
		|||
	buf->f_bavail = user_block_count - valid_user_blocks(sbi) -
 | 
			
		||||
						sbi->current_reserved_blocks;
 | 
			
		||||
 | 
			
		||||
	avail_node_count = sbi->total_node_count - F2FS_RESERVED_NODE_NUM;
 | 
			
		||||
	avail_node_count = sbi->total_node_count - sbi->nquota_files -
 | 
			
		||||
						F2FS_RESERVED_NODE_NUM;
 | 
			
		||||
 | 
			
		||||
	if (avail_node_count > user_block_count) {
 | 
			
		||||
		buf->f_files = user_block_count;
 | 
			
		||||
| 
						 | 
				
			
			@ -2462,6 +2463,13 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
 | 
			
		|||
	else
 | 
			
		||||
		sb->s_qcop = &f2fs_quotactl_ops;
 | 
			
		||||
	sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP | QTYPE_MASK_PRJ;
 | 
			
		||||
 | 
			
		||||
	if (f2fs_sb_has_quota_ino(sbi->sb)) {
 | 
			
		||||
		for (i = 0; i < MAXQUOTAS; i++) {
 | 
			
		||||
			if (f2fs_qf_ino(sbi->sb, i))
 | 
			
		||||
				sbi->nquota_files++;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	sb->s_op = &f2fs_sops;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue