aboutsummaryrefslogtreecommitdiffstats
path: root/fs/aio.c
diff options
context:
space:
mode:
authorBenjamin LaHaise <bcrl@kvack.org>2014-07-14 13:14:27 -0400
committerBenjamin LaHaise <bcrl@kvack.org>2014-07-14 13:14:27 -0400
commit6e830d53717cf3d5c30c1afce3773ef97e436cd9 (patch)
tree9376a0424b8f9fff12d107aa2498e775da20e85d /fs/aio.c
parent855ef0dec7271ff7be7381feaaf3f4aed80bd503 (diff)
parent263782c1c95bbddbb022dc092fd89a36bb8d5577 (diff)
Merge ../aio-fixes
Diffstat (limited to 'fs/aio.c')
-rw-r--r--fs/aio.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/aio.c b/fs/aio.c
index c1d8c480c138..8216aa0c7539 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -812,16 +812,20 @@ void exit_aio(struct mm_struct *mm)
812static void put_reqs_available(struct kioctx *ctx, unsigned nr) 812static void put_reqs_available(struct kioctx *ctx, unsigned nr)
813{ 813{
814 struct kioctx_cpu *kcpu; 814 struct kioctx_cpu *kcpu;
815 unsigned long flags;
815 816
816 preempt_disable(); 817 preempt_disable();
817 kcpu = this_cpu_ptr(ctx->cpu); 818 kcpu = this_cpu_ptr(ctx->cpu);
818 819
820 local_irq_save(flags);
819 kcpu->reqs_available += nr; 821 kcpu->reqs_available += nr;
822
820 while (kcpu->reqs_available >= ctx->req_batch * 2) { 823 while (kcpu->reqs_available >= ctx->req_batch * 2) {
821 kcpu->reqs_available -= ctx->req_batch; 824 kcpu->reqs_available -= ctx->req_batch;
822 atomic_add(ctx->req_batch, &ctx->reqs_available); 825 atomic_add(ctx->req_batch, &ctx->reqs_available);
823 } 826 }
824 827
828 local_irq_restore(flags);
825 preempt_enable(); 829 preempt_enable();
826} 830}
827 831
@@ -829,10 +833,12 @@ static bool get_reqs_available(struct kioctx *ctx)
829{ 833{
830 struct kioctx_cpu *kcpu; 834 struct kioctx_cpu *kcpu;
831 bool ret = false; 835 bool ret = false;
836 unsigned long flags;
832 837
833 preempt_disable(); 838 preempt_disable();
834 kcpu = this_cpu_ptr(ctx->cpu); 839 kcpu = this_cpu_ptr(ctx->cpu);
835 840
841 local_irq_save(flags);
836 if (!kcpu->reqs_available) { 842 if (!kcpu->reqs_available) {
837 int old, avail = atomic_read(&ctx->reqs_available); 843 int old, avail = atomic_read(&ctx->reqs_available);
838 844
@@ -851,6 +857,7 @@ static bool get_reqs_available(struct kioctx *ctx)
851 ret = true; 857 ret = true;
852 kcpu->reqs_available--; 858 kcpu->reqs_available--;
853out: 859out:
860 local_irq_restore(flags);
854 preempt_enable(); 861 preempt_enable();
855 return ret; 862 return ret;
856} 863}