Rename vfs_load_quota_inode() to dquot_load_quota_inode() to be consistent with naming of other functions used for enabling quota accounting from filesystems. Also export the function and add some sanity checks to assure filesystems are calling the function properly.
Unified · Split
| @@ -2351,6 +2351,12 @@ int dquot_load_quota_sb(struct super_block *sb, int type, int format_id, · 2350 unmodified lines | |||
| 2351 | struct quota_info *dqopt = sb_dqopt(sb); | 2351 | struct quota_info *dqopt = sb_dqopt(sb); |
| 2352 | int error; | 2352 | int error; |
| 2353 | 2353 | ||
| 2354 | /* Just unsuspend quotas? */ | ||
| 2355 | BUG_ON(flags & DQUOT_SUSPENDED); | ||
| 2356 | /* s_umount should be held in exclusive mode */ | ||
| 2357 | if (WARN_ON_ONCE(down_read_trylock(&sb->s_umount))) | ||
| 2358 | up_read(&sb->s_umount); | ||
| 2359 | |||
| 2354 | if (!fmt) | 2360 | if (!fmt) |
| 2355 | return -ESRCH; | 2361 | return -ESRCH; |
| 2356 | if (!sb->s_op->quota_write || !sb->s_op->quota_read || | 2362 | if (!sb->s_op->quota_write || !sb->s_op->quota_read || |
| @@ -2417,10 +2423,10 @@ out_fmt: · 60 unmodified lines | |||
| 2417 | EXPORT_SYMBOL(dquot_load_quota_sb); | 2423 | EXPORT_SYMBOL(dquot_load_quota_sb); |
| 2418 | 2424 | ||
| 2419 | /* | 2425 | /* |
| 2420 | * Helper function to turn quotas on when we already have the inode of | 2426 | * More powerful function for turning on quotas on given quota inode allowing |
| 2421 | * quota file and no quota information is loaded. | 2427 | * setting of individual quota flags |
| 2422 | */ | 2428 | */ |
| 2423 | static int vfs_load_quota_inode(struct inode *inode, int type, int format_id, | 2429 | int dquot_load_quota_inode(struct inode *inode, int type, int format_id, |
| 2424 | unsigned int flags) | 2430 | unsigned int flags) |
| 2425 | { | 2431 | { |
| 2426 | int err; | 2432 | int err; |
| @@ -2433,6 +2439,7 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id, · 6 unmodified lines | |||
| 2433 | vfs_cleanup_quota_inode(inode->i_sb, type); | 2439 | vfs_cleanup_quota_inode(inode->i_sb, type); |
| 2434 | return err; | 2440 | return err; |
| 2435 | } | 2441 | } |
| 2442 | EXPORT_SYMBOL(dquot_load_quota_inode); | ||
| 2436 | 2443 | ||
| 2437 | /* Reenable quotas on remount RW */ | 2444 | /* Reenable quotas on remount RW */ |
| 2438 | int dquot_resume(struct super_block *sb, int type) | 2445 | int dquot_resume(struct super_block *sb, int type) |
| @@ -2479,7 +2486,7 @@ int dquot_quota_on(struct super_block *sb, int type, int format_id, · 40 unmodified lines | |||
| 2479 | if (path->dentry->d_sb != sb) | 2486 | if (path->dentry->d_sb != sb) |
| 2480 | error = -EXDEV; | 2487 | error = -EXDEV; |
| 2481 | else | 2488 | else |
| 2482 | error = vfs_load_quota_inode(d_inode(path->dentry), type, | 2489 | error = dquot_load_quota_inode(d_inode(path->dentry), type, |
| 2483 | format_id, DQUOT_USAGE_ENABLED | | 2490 | format_id, DQUOT_USAGE_ENABLED | |
| 2484 | DQUOT_LIMITS_ENABLED); | 2491 | DQUOT_LIMITS_ENABLED); |
| 2485 | return error; | 2492 | return error; |
| @@ -2517,7 +2524,7 @@ int dquot_enable(struct inode *inode, int type, int format_id, · 31 unmodified lines | |||
| 2517 | return 0; | 2524 | return 0; |
| 2518 | } | 2525 | } |
| 2519 | 2526 | ||
| 2520 | return vfs_load_quota_inode(inode, type, format_id, flags); | 2527 | return dquot_load_quota_inode(inode, type, format_id, flags); |
| 2521 | } | 2528 | } |
| 2522 | EXPORT_SYMBOL(dquot_enable); | 2529 | EXPORT_SYMBOL(dquot_enable); |
| 2523 | 2530 | ||
| @@ -2542,7 +2549,7 @@ int dquot_quota_on_mount(struct super_block *sb, char *qf_name, · 18 unmodified lines | |||
| 2542 | 2549 | ||
| 2543 | error = security_quota_on(dentry); | 2550 | error = security_quota_on(dentry); |
| 2544 | if (!error) | 2551 | if (!error) |
| 2545 | error = vfs_load_quota_inode(d_inode(dentry), type, format_id, | 2552 | error = dquot_load_quota_inode(d_inode(dentry), type, format_id, |
| 2546 | DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED); | 2553 | DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED); |
| 2547 | 2554 | ||
| 2548 | out: | 2555 | out: |
| @@ -91,6 +91,8 @@ int dquot_enable(struct inode *inode, int type, int format_id, · 90 unmodified lines | |||
| 91 | unsigned int flags); | 91 | unsigned int flags); |
| 92 | int dquot_load_quota_sb(struct super_block *sb, int type, int format_id, | 92 | int dquot_load_quota_sb(struct super_block *sb, int type, int format_id, |
| 93 | unsigned int flags); | 93 | unsigned int flags); |
| 94 | int dquot_load_quota_inode(struct inode *inode, int type, int format_id, | ||
| 95 | unsigned int flags); | ||
| 94 | int dquot_quota_on(struct super_block *sb, int type, int format_id, | 96 | int dquot_quota_on(struct super_block *sb, int type, int format_id, |
| 95 | const struct path *path); | 97 | const struct path *path); |
| 96 | int dquot_quota_on_mount(struct super_block *sb, char *qf_name, | 98 | int dquot_quota_on_mount(struct super_block *sb, char *qf_name, |