diff options
-rw-r--r-- | fs/xfs/xfs_dquot.c | 31 | ||||
-rw-r--r-- | fs/xfs/xfs_dquot.h | 25 | ||||
-rw-r--r-- | fs/xfs/xfs_dquot_item.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_qm.c | 2 |
4 files changed, 25 insertions, 35 deletions
diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c index 9aef727a48b2..13eef1f92d20 100644 --- a/fs/xfs/xfs_dquot.c +++ b/fs/xfs/xfs_dquot.c | |||
@@ -1257,40 +1257,17 @@ xfs_qm_dqflush( | |||
1257 | 1257 | ||
1258 | } | 1258 | } |
1259 | 1259 | ||
1260 | int | ||
1261 | xfs_qm_dqlock_nowait( | ||
1262 | xfs_dquot_t *dqp) | ||
1263 | { | ||
1264 | return mutex_trylock(&dqp->q_qlock); | ||
1265 | } | ||
1266 | |||
1267 | void | ||
1268 | xfs_dqlock( | ||
1269 | xfs_dquot_t *dqp) | ||
1270 | { | ||
1271 | mutex_lock(&dqp->q_qlock); | ||
1272 | } | ||
1273 | |||
1274 | void | 1260 | void |
1275 | xfs_dqunlock( | 1261 | xfs_dqunlock( |
1276 | xfs_dquot_t *dqp) | 1262 | xfs_dquot_t *dqp) |
1277 | { | 1263 | { |
1278 | mutex_unlock(&(dqp->q_qlock)); | 1264 | xfs_dqunlock_nonotify(dqp); |
1279 | if (dqp->q_logitem.qli_dquot == dqp) { | 1265 | if (dqp->q_logitem.qli_dquot == dqp) { |
1280 | /* Once was dqp->q_mount, but might just have been cleared */ | ||
1281 | xfs_trans_unlocked_item(dqp->q_logitem.qli_item.li_ailp, | 1266 | xfs_trans_unlocked_item(dqp->q_logitem.qli_item.li_ailp, |
1282 | (xfs_log_item_t*)&(dqp->q_logitem)); | 1267 | &dqp->q_logitem.qli_item); |
1283 | } | 1268 | } |
1284 | } | 1269 | } |
1285 | 1270 | ||
1286 | |||
1287 | void | ||
1288 | xfs_dqunlock_nonotify( | ||
1289 | xfs_dquot_t *dqp) | ||
1290 | { | ||
1291 | mutex_unlock(&(dqp->q_qlock)); | ||
1292 | } | ||
1293 | |||
1294 | /* | 1271 | /* |
1295 | * Lock two xfs_dquot structures. | 1272 | * Lock two xfs_dquot structures. |
1296 | * | 1273 | * |
@@ -1370,7 +1347,7 @@ xfs_qm_dqpurge( | |||
1370 | * Block on the flush lock after nudging dquot buffer, | 1347 | * Block on the flush lock after nudging dquot buffer, |
1371 | * if it is incore. | 1348 | * if it is incore. |
1372 | */ | 1349 | */ |
1373 | xfs_qm_dqflock_pushbuf_wait(dqp); | 1350 | xfs_dqflock_pushbuf_wait(dqp); |
1374 | } | 1351 | } |
1375 | 1352 | ||
1376 | /* | 1353 | /* |
@@ -1427,7 +1404,7 @@ xfs_qm_dqpurge( | |||
1427 | * wait on the flush lock. | 1404 | * wait on the flush lock. |
1428 | */ | 1405 | */ |
1429 | void | 1406 | void |
1430 | xfs_qm_dqflock_pushbuf_wait( | 1407 | xfs_dqflock_pushbuf_wait( |
1431 | xfs_dquot_t *dqp) | 1408 | xfs_dquot_t *dqp) |
1432 | { | 1409 | { |
1433 | xfs_mount_t *mp = dqp->q_mount; | 1410 | xfs_mount_t *mp = dqp->q_mount; |
diff --git a/fs/xfs/xfs_dquot.h b/fs/xfs/xfs_dquot.h index 34b7e945dbfa..0b5d2ae92028 100644 --- a/fs/xfs/xfs_dquot.h +++ b/fs/xfs/xfs_dquot.h | |||
@@ -102,6 +102,21 @@ static inline void xfs_dqfunlock(xfs_dquot_t *dqp) | |||
102 | complete(&dqp->q_flush); | 102 | complete(&dqp->q_flush); |
103 | } | 103 | } |
104 | 104 | ||
105 | static inline int xfs_dqlock_nowait(struct xfs_dquot *dqp) | ||
106 | { | ||
107 | return mutex_trylock(&dqp->q_qlock); | ||
108 | } | ||
109 | |||
110 | static inline void xfs_dqlock(struct xfs_dquot *dqp) | ||
111 | { | ||
112 | mutex_lock(&dqp->q_qlock); | ||
113 | } | ||
114 | |||
115 | static inline void xfs_dqunlock_nonotify(struct xfs_dquot *dqp) | ||
116 | { | ||
117 | mutex_unlock(&dqp->q_qlock); | ||
118 | } | ||
119 | |||
105 | #define XFS_DQ_IS_LOCKED(dqp) (mutex_is_locked(&((dqp)->q_qlock))) | 120 | #define XFS_DQ_IS_LOCKED(dqp) (mutex_is_locked(&((dqp)->q_qlock))) |
106 | #define XFS_DQ_IS_DIRTY(dqp) ((dqp)->dq_flags & XFS_DQ_DIRTY) | 121 | #define XFS_DQ_IS_DIRTY(dqp) ((dqp)->dq_flags & XFS_DQ_DIRTY) |
107 | #define XFS_QM_ISUDQ(dqp) ((dqp)->dq_flags & XFS_DQ_USER) | 122 | #define XFS_QM_ISUDQ(dqp) ((dqp)->dq_flags & XFS_DQ_USER) |
@@ -120,8 +135,6 @@ extern void xfs_qm_dqdestroy(xfs_dquot_t *); | |||
120 | extern int xfs_qm_dqflush(xfs_dquot_t *, uint); | 135 | extern int xfs_qm_dqflush(xfs_dquot_t *, uint); |
121 | extern int xfs_qm_dqpurge(xfs_dquot_t *); | 136 | extern int xfs_qm_dqpurge(xfs_dquot_t *); |
122 | extern void xfs_qm_dqunpin_wait(xfs_dquot_t *); | 137 | extern void xfs_qm_dqunpin_wait(xfs_dquot_t *); |
123 | extern int xfs_qm_dqlock_nowait(xfs_dquot_t *); | ||
124 | extern void xfs_qm_dqflock_pushbuf_wait(xfs_dquot_t *dqp); | ||
125 | extern void xfs_qm_adjust_dqtimers(xfs_mount_t *, | 138 | extern void xfs_qm_adjust_dqtimers(xfs_mount_t *, |
126 | xfs_disk_dquot_t *); | 139 | xfs_disk_dquot_t *); |
127 | extern void xfs_qm_adjust_dqlimits(xfs_mount_t *, | 140 | extern void xfs_qm_adjust_dqlimits(xfs_mount_t *, |
@@ -129,9 +142,9 @@ extern void xfs_qm_adjust_dqlimits(xfs_mount_t *, | |||
129 | extern int xfs_qm_dqget(xfs_mount_t *, xfs_inode_t *, | 142 | extern int xfs_qm_dqget(xfs_mount_t *, xfs_inode_t *, |
130 | xfs_dqid_t, uint, uint, xfs_dquot_t **); | 143 | xfs_dqid_t, uint, uint, xfs_dquot_t **); |
131 | extern void xfs_qm_dqput(xfs_dquot_t *); | 144 | extern void xfs_qm_dqput(xfs_dquot_t *); |
132 | extern void xfs_dqlock(xfs_dquot_t *); | 145 | |
133 | extern void xfs_dqlock2(xfs_dquot_t *, xfs_dquot_t *); | 146 | extern void xfs_dqlock2(struct xfs_dquot *, struct xfs_dquot *); |
134 | extern void xfs_dqunlock(xfs_dquot_t *); | 147 | extern void xfs_dqunlock(struct xfs_dquot *); |
135 | extern void xfs_dqunlock_nonotify(xfs_dquot_t *); | 148 | extern void xfs_dqflock_pushbuf_wait(struct xfs_dquot *dqp); |
136 | 149 | ||
137 | #endif /* __XFS_DQUOT_H__ */ | 150 | #endif /* __XFS_DQUOT_H__ */ |
diff --git a/fs/xfs/xfs_dquot_item.c b/fs/xfs/xfs_dquot_item.c index 3956e1bb7c07..34baeae45265 100644 --- a/fs/xfs/xfs_dquot_item.c +++ b/fs/xfs/xfs_dquot_item.c | |||
@@ -236,7 +236,7 @@ xfs_qm_dquot_logitem_trylock( | |||
236 | if (atomic_read(&dqp->q_pincount) > 0) | 236 | if (atomic_read(&dqp->q_pincount) > 0) |
237 | return XFS_ITEM_PINNED; | 237 | return XFS_ITEM_PINNED; |
238 | 238 | ||
239 | if (!xfs_qm_dqlock_nowait(dqp)) | 239 | if (!xfs_dqlock_nowait(dqp)) |
240 | return XFS_ITEM_LOCKED; | 240 | return XFS_ITEM_LOCKED; |
241 | 241 | ||
242 | if (!xfs_dqflock_nowait(dqp)) { | 242 | if (!xfs_dqflock_nowait(dqp)) { |
diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c index fc60ec21289b..6535c4e5f875 100644 --- a/fs/xfs/xfs_qm.c +++ b/fs/xfs/xfs_qm.c | |||
@@ -443,7 +443,7 @@ again: | |||
443 | * out immediately. We'll be able to acquire | 443 | * out immediately. We'll be able to acquire |
444 | * the flush lock when the I/O completes. | 444 | * the flush lock when the I/O completes. |
445 | */ | 445 | */ |
446 | xfs_qm_dqflock_pushbuf_wait(dqp); | 446 | xfs_dqflock_pushbuf_wait(dqp); |
447 | } | 447 | } |
448 | /* | 448 | /* |
449 | * Let go of the mplist lock. We don't want to hold it | 449 | * Let go of the mplist lock. We don't want to hold it |