Skip to contentSkip to conversation

quota: code cleanup for __dquot_alloc_space()

PATCH In review Chengguang Xu 2 participants 2 messages Mar 20, 2019 Diskquota

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 quota: code cleanup for __dquot_alloc_space()

Replace (flags & DQUOT_SPACE_RESERVE) with
variable reserve.

---
 fs/quota/dquot.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/quota/dquot.c +2 -2
index fc20e06c56ba..00de508f9d2e 100644
@@ -1663,7 +1663,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags)
 	for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
 		if (!dquots[cnt])
 			continue;
-		if (flags & DQUOT_SPACE_RESERVE) {
+		if (reserve) {
 			ret = dquot_add_space(dquots[cnt], 0, number, flags,
 					      &warn[cnt]);
 		} else {
@@ -1676,7 +1676,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags)
 				if (!dquots[cnt])
 					continue;
 				spin_lock(&dquots[cnt]->dq_dqb_lock);
-				if (flags & DQUOT_SPACE_RESERVE) {
+				if (reserve) {
 					dquots[cnt]->dq_dqb.dqb_rsvspace -=
 									number;
 				} else {

--
2.20.1

#1 lore raw
Quoted 4 lines · Chengguang Xu

Replace (flags & DQUOT_SPACE_RESERVE) with
variable reserve.

Thanks. I've added the patch to my tree.

Honza

Quoted 30 lines
---
 fs/quota/dquot.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/quota/dquot.c +2 -3
index fc20e06c56ba..00de508f9d2e 100644
@@ -1663,7 +1663,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags)
 	for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
 		if (!dquots[cnt])
 			continue;
-		if (flags & DQUOT_SPACE_RESERVE) {
+		if (reserve) {
 			ret = dquot_add_space(dquots[cnt], 0, number, flags,
 					      &warn[cnt]);
 		} else {
@@ -1676,7 +1676,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags)
 				if (!dquots[cnt])
 					continue;
 				spin_lock(&dquots[cnt]->dq_dqb_lock);
-				if (flags & DQUOT_SPACE_RESERVE) {
+				if (reserve) {
 					dquots[cnt]->dq_dqb.dqb_rsvspace -=
 									number;
 				} else {
--

2.20.1

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR