Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F166615989
D50134.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
916 B
Referenced Files
None
Subscribers
None
D50134.id.diff
View Options
Index: sys/dev/mpi3mr/mpi3mr.h
===================================================================
--- sys/dev/mpi3mr/mpi3mr.h
+++ sys/dev/mpi3mr/mpi3mr.h
@@ -900,6 +900,21 @@
return (i + j);
}
+static __inline void
+mpi3mr_atomic_dec_if_not_zero(mpi3mr_atomic_t *counter)
+{
+ int count;
+
+ count = mpi3mr_atomic_read(counter);
+ for (;;) {
+ if (count == 0)
+ break;
+
+ if (atomic_fcmpset_int(&counter->val, &count, count - 1))
+ break;
+ }
+}
+
#define MPI3MR_DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
void
Index: sys/dev/mpi3mr/mpi3mr_app.c
===================================================================
--- sys/dev/mpi3mr/mpi3mr_app.c
+++ sys/dev/mpi3mr/mpi3mr_app.c
@@ -1193,7 +1193,7 @@
out_failed:
if (tgtdev)
- mpi3mr_atomic_dec(&tgtdev->block_io);
+ mpi3mr_atomic_dec_if_not_zero(&tgtdev->block_io);
sc->ioctl_cmds.is_senseprst = 0;
sc->ioctl_cmds.sensebuf = NULL;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Aug 15, 9:35 PM (2 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
36803418
Default Alt Text
D50134.id.diff (916 B)
Attached To
Mode
D50134: mpi3mr: Add atomic decrement-if-not-zero helper
Attached
Detach File
Event Timeline
Log In to Comment