mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	bdi: convert bdi_debug_register to int
Convert bdi_debug_register to int and then do error handle for it. Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: weiping zhang <zhangweiping@didichuxing.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
		
							parent
							
								
									0192f17529
								
							
						
					
					
						commit
						97f0769793
					
				
					 1 changed files with 15 additions and 2 deletions
				
			
		| 
						 | 
					@ -113,11 +113,23 @@ static const struct file_operations bdi_debug_stats_fops = {
 | 
				
			||||||
	.release	= single_release,
 | 
						.release	= single_release,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void bdi_debug_register(struct backing_dev_info *bdi, const char *name)
 | 
					static int bdi_debug_register(struct backing_dev_info *bdi, const char *name)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						if (!bdi_debug_root)
 | 
				
			||||||
 | 
							return -ENOMEM;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bdi->debug_dir = debugfs_create_dir(name, bdi_debug_root);
 | 
						bdi->debug_dir = debugfs_create_dir(name, bdi_debug_root);
 | 
				
			||||||
 | 
						if (!bdi->debug_dir)
 | 
				
			||||||
 | 
							return -ENOMEM;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bdi->debug_stats = debugfs_create_file("stats", 0444, bdi->debug_dir,
 | 
						bdi->debug_stats = debugfs_create_file("stats", 0444, bdi->debug_dir,
 | 
				
			||||||
					       bdi, &bdi_debug_stats_fops);
 | 
										       bdi, &bdi_debug_stats_fops);
 | 
				
			||||||
 | 
						if (!bdi->debug_stats) {
 | 
				
			||||||
 | 
							debugfs_remove(bdi->debug_dir);
 | 
				
			||||||
 | 
							return -ENOMEM;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void bdi_debug_unregister(struct backing_dev_info *bdi)
 | 
					static void bdi_debug_unregister(struct backing_dev_info *bdi)
 | 
				
			||||||
| 
						 | 
					@ -129,9 +141,10 @@ static void bdi_debug_unregister(struct backing_dev_info *bdi)
 | 
				
			||||||
static inline void bdi_debug_init(void)
 | 
					static inline void bdi_debug_init(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
static inline void bdi_debug_register(struct backing_dev_info *bdi,
 | 
					static inline int bdi_debug_register(struct backing_dev_info *bdi,
 | 
				
			||||||
				      const char *name)
 | 
									      const char *name)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
static inline void bdi_debug_unregister(struct backing_dev_info *bdi)
 | 
					static inline void bdi_debug_unregister(struct backing_dev_info *bdi)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue