diff options
-rw-r--r-- | fs/xfs/linux-2.6/xfs_buf.c | 32 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_buf.h | 9 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_trace.h | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_buf_item.c | 13 |
4 files changed, 9 insertions, 47 deletions
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c index 4b2177f5b223..efce8abb375c 100644 --- a/fs/xfs/linux-2.6/xfs_buf.c +++ b/fs/xfs/linux-2.6/xfs_buf.c | |||
@@ -896,36 +896,6 @@ xfs_buf_unlock( | |||
896 | trace_xfs_buf_unlock(bp, _RET_IP_); | 896 | trace_xfs_buf_unlock(bp, _RET_IP_); |
897 | } | 897 | } |
898 | 898 | ||
899 | |||
900 | /* | ||
901 | * Pinning Buffer Storage in Memory | ||
902 | * Ensure that no attempt to force a buffer to disk will succeed. | ||
903 | */ | ||
904 | void | ||
905 | xfs_buf_pin( | ||
906 | xfs_buf_t *bp) | ||
907 | { | ||
908 | trace_xfs_buf_pin(bp, _RET_IP_); | ||
909 | atomic_inc(&bp->b_pin_count); | ||
910 | } | ||
911 | |||
912 | void | ||
913 | xfs_buf_unpin( | ||
914 | xfs_buf_t *bp) | ||
915 | { | ||
916 | trace_xfs_buf_unpin(bp, _RET_IP_); | ||
917 | |||
918 | if (atomic_dec_and_test(&bp->b_pin_count)) | ||
919 | wake_up_all(&bp->b_waiters); | ||
920 | } | ||
921 | |||
922 | int | ||
923 | xfs_buf_ispin( | ||
924 | xfs_buf_t *bp) | ||
925 | { | ||
926 | return atomic_read(&bp->b_pin_count); | ||
927 | } | ||
928 | |||
929 | STATIC void | 899 | STATIC void |
930 | xfs_buf_wait_unpin( | 900 | xfs_buf_wait_unpin( |
931 | xfs_buf_t *bp) | 901 | xfs_buf_t *bp) |
@@ -1803,7 +1773,7 @@ xfs_buf_delwri_split( | |||
1803 | trace_xfs_buf_delwri_split(bp, _RET_IP_); | 1773 | trace_xfs_buf_delwri_split(bp, _RET_IP_); |
1804 | ASSERT(bp->b_flags & XBF_DELWRI); | 1774 | ASSERT(bp->b_flags & XBF_DELWRI); |
1805 | 1775 | ||
1806 | if (!xfs_buf_ispin(bp) && !xfs_buf_cond_lock(bp)) { | 1776 | if (!XFS_BUF_ISPINNED(bp) && !xfs_buf_cond_lock(bp)) { |
1807 | if (!force && | 1777 | if (!force && |
1808 | time_before(jiffies, bp->b_queuetime + age)) { | 1778 | time_before(jiffies, bp->b_queuetime + age)) { |
1809 | xfs_buf_unlock(bp); | 1779 | xfs_buf_unlock(bp); |
diff --git a/fs/xfs/linux-2.6/xfs_buf.h b/fs/xfs/linux-2.6/xfs_buf.h index 5fbecefa5dfd..2a9749a3a762 100644 --- a/fs/xfs/linux-2.6/xfs_buf.h +++ b/fs/xfs/linux-2.6/xfs_buf.h | |||
@@ -258,11 +258,6 @@ static inline int xfs_buf_geterror(xfs_buf_t *bp) | |||
258 | /* Buffer Utility Routines */ | 258 | /* Buffer Utility Routines */ |
259 | extern xfs_caddr_t xfs_buf_offset(xfs_buf_t *, size_t); | 259 | extern xfs_caddr_t xfs_buf_offset(xfs_buf_t *, size_t); |
260 | 260 | ||
261 | /* Pinning Buffer Storage in Memory */ | ||
262 | extern void xfs_buf_pin(xfs_buf_t *); | ||
263 | extern void xfs_buf_unpin(xfs_buf_t *); | ||
264 | extern int xfs_buf_ispin(xfs_buf_t *); | ||
265 | |||
266 | /* Delayed Write Buffer Routines */ | 261 | /* Delayed Write Buffer Routines */ |
267 | extern void xfs_buf_delwri_dequeue(xfs_buf_t *); | 262 | extern void xfs_buf_delwri_dequeue(xfs_buf_t *); |
268 | extern void xfs_buf_delwri_promote(xfs_buf_t *); | 263 | extern void xfs_buf_delwri_promote(xfs_buf_t *); |
@@ -351,7 +346,7 @@ extern void xfs_buf_terminate(void); | |||
351 | #define XFS_BUF_SET_VTYPE(bp, type) do { } while (0) | 346 | #define XFS_BUF_SET_VTYPE(bp, type) do { } while (0) |
352 | #define XFS_BUF_SET_REF(bp, ref) do { } while (0) | 347 | #define XFS_BUF_SET_REF(bp, ref) do { } while (0) |
353 | 348 | ||
354 | #define XFS_BUF_ISPINNED(bp) xfs_buf_ispin(bp) | 349 | #define XFS_BUF_ISPINNED(bp) atomic_read(&((bp)->b_pin_count)) |
355 | 350 | ||
356 | #define XFS_BUF_VALUSEMA(bp) xfs_buf_lock_value(bp) | 351 | #define XFS_BUF_VALUSEMA(bp) xfs_buf_lock_value(bp) |
357 | #define XFS_BUF_CPSEMA(bp) (xfs_buf_cond_lock(bp) == 0) | 352 | #define XFS_BUF_CPSEMA(bp) (xfs_buf_cond_lock(bp) == 0) |
@@ -370,8 +365,6 @@ static inline void xfs_buf_relse(xfs_buf_t *bp) | |||
370 | xfs_buf_rele(bp); | 365 | xfs_buf_rele(bp); |
371 | } | 366 | } |
372 | 367 | ||
373 | #define xfs_bpin(bp) xfs_buf_pin(bp) | ||
374 | #define xfs_bunpin(bp) xfs_buf_unpin(bp) | ||
375 | #define xfs_biodone(bp) xfs_buf_ioend(bp, 0) | 368 | #define xfs_biodone(bp) xfs_buf_ioend(bp, 0) |
376 | 369 | ||
377 | #define xfs_biomove(bp, off, len, data, rw) \ | 370 | #define xfs_biomove(bp, off, len, data, rw) \ |
diff --git a/fs/xfs/linux-2.6/xfs_trace.h b/fs/xfs/linux-2.6/xfs_trace.h index 302820690904..0aea6d5f705a 100644 --- a/fs/xfs/linux-2.6/xfs_trace.h +++ b/fs/xfs/linux-2.6/xfs_trace.h | |||
@@ -317,8 +317,6 @@ DEFINE_BUF_EVENT(xfs_buf_init); | |||
317 | DEFINE_BUF_EVENT(xfs_buf_free); | 317 | DEFINE_BUF_EVENT(xfs_buf_free); |
318 | DEFINE_BUF_EVENT(xfs_buf_hold); | 318 | DEFINE_BUF_EVENT(xfs_buf_hold); |
319 | DEFINE_BUF_EVENT(xfs_buf_rele); | 319 | DEFINE_BUF_EVENT(xfs_buf_rele); |
320 | DEFINE_BUF_EVENT(xfs_buf_pin); | ||
321 | DEFINE_BUF_EVENT(xfs_buf_unpin); | ||
322 | DEFINE_BUF_EVENT(xfs_buf_iodone); | 320 | DEFINE_BUF_EVENT(xfs_buf_iodone); |
323 | DEFINE_BUF_EVENT(xfs_buf_iorequest); | 321 | DEFINE_BUF_EVENT(xfs_buf_iorequest); |
324 | DEFINE_BUF_EVENT(xfs_buf_bawrite); | 322 | DEFINE_BUF_EVENT(xfs_buf_bawrite); |
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c index 60e063d96f8d..f53327a19e0d 100644 --- a/fs/xfs/xfs_buf_item.c +++ b/fs/xfs/xfs_buf_item.c | |||
@@ -359,14 +359,13 @@ xfs_buf_item_format( | |||
359 | 359 | ||
360 | /* | 360 | /* |
361 | * This is called to pin the buffer associated with the buf log item in memory | 361 | * This is called to pin the buffer associated with the buf log item in memory |
362 | * so it cannot be written out. Simply call bpin() on the buffer to do this. | 362 | * so it cannot be written out. |
363 | * | 363 | * |
364 | * We also always take a reference to the buffer log item here so that the bli | 364 | * We also always take a reference to the buffer log item here so that the bli |
365 | * is held while the item is pinned in memory. This means that we can | 365 | * is held while the item is pinned in memory. This means that we can |
366 | * unconditionally drop the reference count a transaction holds when the | 366 | * unconditionally drop the reference count a transaction holds when the |
367 | * transaction is completed. | 367 | * transaction is completed. |
368 | */ | 368 | */ |
369 | |||
370 | STATIC void | 369 | STATIC void |
371 | xfs_buf_item_pin( | 370 | xfs_buf_item_pin( |
372 | struct xfs_log_item *lip) | 371 | struct xfs_log_item *lip) |
@@ -378,15 +377,15 @@ xfs_buf_item_pin( | |||
378 | ASSERT((bip->bli_flags & XFS_BLI_LOGGED) || | 377 | ASSERT((bip->bli_flags & XFS_BLI_LOGGED) || |
379 | (bip->bli_flags & XFS_BLI_STALE)); | 378 | (bip->bli_flags & XFS_BLI_STALE)); |
380 | 379 | ||
381 | atomic_inc(&bip->bli_refcount); | ||
382 | trace_xfs_buf_item_pin(bip); | 380 | trace_xfs_buf_item_pin(bip); |
383 | xfs_bpin(bip->bli_buf); | 381 | |
382 | atomic_inc(&bip->bli_refcount); | ||
383 | atomic_inc(&bip->bli_buf->b_pin_count); | ||
384 | } | 384 | } |
385 | 385 | ||
386 | /* | 386 | /* |
387 | * This is called to unpin the buffer associated with the buf log | 387 | * This is called to unpin the buffer associated with the buf log |
388 | * item which was previously pinned with a call to xfs_buf_item_pin(). | 388 | * item which was previously pinned with a call to xfs_buf_item_pin(). |
389 | * Just call bunpin() on the buffer to do this. | ||
390 | * | 389 | * |
391 | * Also drop the reference to the buf item for the current transaction. | 390 | * Also drop the reference to the buf item for the current transaction. |
392 | * If the XFS_BLI_STALE flag is set and we are the last reference, | 391 | * If the XFS_BLI_STALE flag is set and we are the last reference, |
@@ -414,7 +413,9 @@ xfs_buf_item_unpin( | |||
414 | trace_xfs_buf_item_unpin(bip); | 413 | trace_xfs_buf_item_unpin(bip); |
415 | 414 | ||
416 | freed = atomic_dec_and_test(&bip->bli_refcount); | 415 | freed = atomic_dec_and_test(&bip->bli_refcount); |
417 | xfs_bunpin(bp); | 416 | |
417 | if (atomic_dec_and_test(&bp->b_pin_count)) | ||
418 | wake_up_all(&bp->b_waiters); | ||
418 | 419 | ||
419 | if (freed && stale) { | 420 | if (freed && stale) { |
420 | ASSERT(bip->bli_flags & XFS_BLI_STALE); | 421 | ASSERT(bip->bli_flags & XFS_BLI_STALE); |