]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - include/linux/quotaops.h
quota: move unmount handling into the filesystem
[mirror_ubuntu-artful-kernel.git] / include / linux / quotaops.h
index e6fa7acce2900a5bd6862a4bf9703a87cd30a0bd..cfa2abb1b6d1797d6ee7152912a1f088cf07b785 100644 (file)
@@ -14,6 +14,14 @@ static inline struct quota_info *sb_dqopt(struct super_block *sb)
        return &sb->s_dquot;
 }
 
+/* i_mutex must being held */
+static inline bool is_quota_modification(struct inode *inode, struct iattr *ia)
+{
+       return (ia->ia_valid & ATTR_SIZE && ia->ia_size != inode->i_size) ||
+               (ia->ia_valid & ATTR_UID && ia->ia_uid != inode->i_uid) ||
+               (ia->ia_valid & ATTR_GID && ia->ia_gid != inode->i_gid);
+}
+
 #if defined(CONFIG_QUOTA)
 
 /*
@@ -42,6 +50,14 @@ int dquot_alloc_inode(const struct inode *inode);
 int dquot_claim_space_nodirty(struct inode *inode, qsize_t number);
 void dquot_free_inode(const struct inode *inode);
 
+int dquot_disable(struct super_block *sb, int type, unsigned int flags);
+/* Suspend quotas on remount RO */
+static inline int dquot_suspend(struct super_block *sb, int type)
+{
+       return dquot_disable(sb, type, DQUOT_SUSPENDED);
+}
+int dquot_resume(struct super_block *sb, int type);
+
 int dquot_commit(struct dquot *dquot);
 int dquot_acquire(struct dquot *dquot);
 int dquot_release(struct dquot *dquot);
@@ -59,15 +75,16 @@ int vfs_quota_on_path(struct super_block *sb, int type, int format_id,
 int vfs_quota_on_mount(struct super_block *sb, char *qf_name,
        int format_id, int type);
 int vfs_quota_off(struct super_block *sb, int type, int remount);
-int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags);
 int vfs_quota_sync(struct super_block *sb, int type, int wait);
 int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
 int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
-int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di);
-int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di);
+int vfs_get_dqblk(struct super_block *sb, int type, qid_t id,
+               struct fs_disk_quota *di);
+int vfs_set_dqblk(struct super_block *sb, int type, qid_t id,
+               struct fs_disk_quota *di);
 
+int __dquot_transfer(struct inode *inode, struct dquot **transfer_to);
 int dquot_transfer(struct inode *inode, struct iattr *iattr);
-int vfs_dq_quota_on_remount(struct super_block *sb);
 
 static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type)
 {
@@ -139,16 +156,6 @@ extern const struct quotactl_ops vfs_quotactl_ops;
 #define sb_dquot_ops (&dquot_operations)
 #define sb_quotactl_ops (&vfs_quotactl_ops)
 
-/* Cannot be called inside a transaction */
-static inline int vfs_dq_off(struct super_block *sb, int remount)
-{
-       int ret = -ENOSYS;
-
-       if (sb->s_qcop && sb->s_qcop->quota_off)
-               ret = sb->s_qcop->quota_off(sb, -1, remount);
-       return ret;
-}
-
 #else
 
 static inline int sb_has_quota_usage_enabled(struct super_block *sb, int type)
@@ -215,16 +222,6 @@ static inline void dquot_free_inode(const struct inode *inode)
 {
 }
 
-static inline int vfs_dq_off(struct super_block *sb, int remount)
-{
-       return 0;
-}
-
-static inline int vfs_dq_quota_on_remount(struct super_block *sb)
-{
-       return 0;
-}
-
 static inline int dquot_transfer(struct inode *inode, struct iattr *iattr)
 {
        return 0;
@@ -251,6 +248,22 @@ static inline int dquot_claim_space_nodirty(struct inode *inode, qsize_t number)
        return 0;
 }
 
+static inline int dquot_disable(struct super_block *sb, int type,
+               unsigned int flags)
+{
+       return 0;
+}
+
+static inline int dquot_suspend(struct super_block *sb, int type)
+{
+       return 0;
+}
+
+static inline int dquot_resume(struct super_block *sb, int type)
+{
+       return 0;
+}
+
 #define dquot_file_open                generic_file_open
 
 #endif /* CONFIG_QUOTA */