patch-2.1.102 linux/include/linux/quotaops.h

Next file: linux/include/linux/skbuff.h
Previous file: linux/include/linux/proc_fs.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.101/linux/include/linux/quotaops.h linux/include/linux/quotaops.h
@@ -37,108 +37,104 @@
 /*
  * Operations supported for diskquotas.
  */
-#define DQUOT_INIT(inode) \
-if (inode->i_sb && inode->i_sb->dq_op) { \
-	inode->i_sb->dq_op->initialize(inode, -1); \
-}
-
-#define DQUOT_DROP(inode) \
-if (IS_QUOTAINIT(inode)) { \
-	if (inode->i_sb && inode->i_sb->dq_op) \
-		inode->i_sb->dq_op->drop(inode); \
-}
-
-#define DQUOT_SAVE_DROP(inode) \
-if (IS_QUOTAINIT(inode)) { \
-	inode->i_lock = 1; \
-	if (inode->i_sb && inode->i_sb->dq_op) \
-		inode->i_sb->dq_op->drop(inode); \
-	unlock_inode(inode); \
-	goto we_slept; \
-}
-
-#define DQUOT_PREALLOC_BLOCK(sb, inode, nr) \
-if (sb->dq_op) { \
-	if (sb->dq_op->alloc_block(inode, fs_to_dq_blocks(nr, sb->s_blocksize), \
-	                           current->euid, 0) == NO_QUOTA) \
-		break; \
-}
-
-#define DQUOT_ALLOC_BLOCK(sb, inode, nr) \
-if (sb->dq_op) { \
-	if (sb->dq_op->alloc_block(inode, fs_to_dq_blocks(nr, sb->s_blocksize), \
-	                           current->euid, 1) == NO_QUOTA) { \
-		unlock_super (sb); \
-		*err = -EDQUOT; \
-		return 0; \
-	} \
-}
-
-#define DQUOT_ALLOC_INODE(sb, inode) \
-if (sb->dq_op) { \
-	sb->dq_op->initialize (inode, -1); \
-	if (sb->dq_op->alloc_inode (inode, 1, current->euid)) { \
-		sb->dq_op->drop (inode); \
-		inode->i_nlink = 0; \
-		iput (inode); \
-		*err = -EDQUOT; \
-		return NULL; \
-	} \
-	inode->i_flags |= S_QUOTA; \
-}
-
-#define DQUOT_FREE_BLOCK(sb, inode, nr) \
-if (sb->dq_op) { \
-	sb->dq_op->free_block(inode, fs_to_dq_blocks(nr, sb->s_blocksize)); \
-}
-
-#define DQUOT_FREE_INODE(sb, inode) \
-if (sb->dq_op) { \
-	sb->dq_op->free_inode(inode, 1); \
-}
-
-#define DQUOT_TRANSFER(dentry, iattr) \
-if (dentry->d_inode->i_sb->dq_op) { \
-	if (IS_QUOTAINIT(dentry->d_inode) == 0) \
-		dentry->d_inode->i_sb->dq_op->initialize(dentry->d_inode, -1); \
-	if (dentry->d_inode->i_sb->dq_op->transfer(dentry->d_inode, &iattr, 0, current->euid)) { \
-		error = -EDQUOT; \
-		goto out; \
-	} \
-	error = notify_change(dentry, &iattr); \
-	if (error) \
-		inode->i_sb->dq_op->transfer(dentry->d_inode, &iattr, 1, current->euid); \
-} else { \
-	error = notify_change(dentry, &iattr); \
+extern __inline__ void DQUOT_INIT(struct inode *inode)
+{
+	if (inode->i_sb && inode->i_sb->dq_op)
+		inode->i_sb->dq_op->initialize(inode, -1);
+}
+
+extern __inline__ void DQUOT_DROP(struct inode *inode)
+{
+	if (IS_QUOTAINIT(inode)) {
+		if (inode->i_sb && inode->i_sb->dq_op)
+			inode->i_sb->dq_op->drop(inode);
+	}
+}
+
+extern __inline__ int DQUOT_PREALLOC_BLOCK(struct super_block *sb, struct inode *inode, int nr)
+{
+	if (sb->dq_op) {
+		if (sb->dq_op->alloc_block(inode, fs_to_dq_blocks(nr, sb->s_blocksize),
+					   current->euid, 0) == NO_QUOTA)
+			return 1;
+	}
+	return 0;
+}
+
+extern __inline__ int DQUOT_ALLOC_BLOCK(struct super_block *sb, struct inode *inode, int nr)
+{
+	if (sb->dq_op) {
+		if (sb->dq_op->alloc_block(inode, fs_to_dq_blocks(nr, sb->s_blocksize),
+					   current->euid, 1) == NO_QUOTA)
+			return 1;
+	}
+	return 0;
+}
+
+extern __inline__ int DQUOT_ALLOC_INODE(struct super_block *sb, struct inode *inode)
+{
+	if (sb->dq_op) {
+		sb->dq_op->initialize (inode, -1);
+		if (sb->dq_op->alloc_inode (inode, 1, current->euid))
+			return 1;
+	}
+	inode->i_flags |= S_QUOTA;
+	return 0;
+}
+
+extern __inline__ void DQUOT_FREE_BLOCK(struct super_block *sb, struct inode *inode, int nr)
+{
+	if (sb->dq_op)
+		sb->dq_op->free_block(inode, fs_to_dq_blocks(nr, sb->s_blocksize));
+}
+
+extern __inline__ void DQUOT_FREE_INODE(struct super_block *sb, struct inode *inode)
+{
+	if (sb->dq_op)
+		sb->dq_op->free_inode(inode, 1);
+}
+
+extern __inline__ int DQUOT_TRANSFER(struct dentry *dentry, struct iattr *iattr)
+{
+	int error = -EDQUOT;
+
+	if (dentry->d_inode->i_sb->dq_op) {
+		if (IS_QUOTAINIT(dentry->d_inode) == 0)
+			dentry->d_inode->i_sb->dq_op->initialize(dentry->d_inode, -1);
+		if (dentry->d_inode->i_sb->dq_op->transfer(dentry->d_inode, iattr, 0, current->euid))
+			goto out;
+		error = notify_change(dentry, iattr);
+		if (error)
+			dentry->d_inode->i_sb->dq_op->transfer(dentry->d_inode, iattr, 1, current->euid);
+	} else {
+		error = notify_change(dentry, iattr);
+	}
+out:
+	return error;
 }
 
-#define DQUOT_SYNC(dev) \
-sync_dquots(dev, -1)
-
-#define DQUOT_OFF(dev) \
-quota_off(dev, -1)
+#define DQUOT_SYNC(dev)	sync_dquots(dev, -1)
+#define DQUOT_OFF(dev)	quota_off(dev, -1)
 
 #else
 
 /*
  * NO-OP when quota not configured.
  */
-#define DQUOT_INIT(inode)
-#define DQUOT_DROP(inode)
-#define DQUOT_SAVE_DROP(inode)
-#define DQUOT_PREALLOC_BLOCK(sb, inode, nr)
-#define DQUOT_ALLOC_BLOCK(sb, inode, nr)
-#define DQUOT_ALLOC_INODE(sb, inode)
-#define DQUOT_FREE_BLOCK(sb, inode, nr)
-#define DQUOT_FREE_INODE(sb, inode)
-#define DQUOT_SYNC(dev)
-#define DQUOT_OFF(dev)
+#define DQUOT_INIT(inode)			do { } while(0)
+#define DQUOT_DROP(inode)			do { } while(0)
+#define DQUOT_PREALLOC_BLOCK(sb, inode, nr)	(0)
+#define DQUOT_ALLOC_BLOCK(sb, inode, nr)	(0)
+#define DQUOT_ALLOC_INODE(sb, inode)		(0)
+#define DQUOT_FREE_BLOCK(sb, inode, nr)		do { } while(0)
+#define DQUOT_FREE_INODE(sb, inode)		do { } while(0)
+#define DQUOT_SYNC(dev)				do { } while(0)
+#define DQUOT_OFF(dev)				do { } while(0)
 
 /*
  * Special case expands to a simple notify_change.
  */
-#define DQUOT_TRANSFER(dentry, iattr) \
-error = notify_change(dentry, &iattr)
+#define DQUOT_TRANSFER(dentry, iattr) notify_change(dentry, iattr)
 
 #endif /* CONFIG_QUOTA */
 #endif /* _LINUX_QUOTAOPS_ */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov