From c5164261bdd06e2c189ad9001e1b34f4a9b645fe Mon Sep 17 00:00:00 2001 From: Karsten Keil Date: Wed, 3 Sep 2003 01:58:46 -0700 Subject: [PATCH] ISDN bugfixes part 1 Here is the first part of ISDN bugfixes for 2.6. It should make ISDN work again with most controllers. More fixes follow after more testing. --- include/linux/isdn.h | 9 +++++---- include/linux/isdn/capilli.h | 2 +- include/linux/usb.h | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) (limited to 'include/linux') diff --git a/include/linux/isdn.h b/include/linux/isdn.h index ecd0f5394e9e..35a2ef6e2452 100644 --- a/include/linux/isdn.h +++ b/include/linux/isdn.h @@ -258,13 +258,13 @@ typedef struct { * variables. Of course, we need to check skb_headroom prior to * any access. */ -typedef struct isdn_audio_skb { +typedef struct _isdnaudio_header { unsigned short dle_count; unsigned char lock; -} isdn_audio_skb; +} isdnaudio_header; -#define ISDN_AUDIO_SKB_DLECOUNT(skb) (((isdn_audio_skb*)skb->head)->dle_count) -#define ISDN_AUDIO_SKB_LOCK(skb) (((isdn_audio_skb*)skb->head)->lock) +#define ISDN_AUDIO_SKB_DLECOUNT(skb) (((isdnaudio_header*)skb->head)->dle_count) +#define ISDN_AUDIO_SKB_LOCK(skb) (((isdnaudio_header*)skb->head)->lock) #endif /* Private data of AT-command-interpreter */ @@ -291,6 +291,7 @@ typedef struct atemu { /* Private data (similar to async_struct in ) */ typedef struct modem_info { int magic; + struct module *owner; int flags; /* defined in tty.h */ int x_char; /* xon/xoff character */ int mcr; /* Modem control register */ diff --git a/include/linux/isdn/capilli.h b/include/linux/isdn/capilli.h index cf501356aba4..d4747a9cee9c 100644 --- a/include/linux/isdn/capilli.h +++ b/include/linux/isdn/capilli.h @@ -54,7 +54,7 @@ struct capi_ctr { int count, int *eof, struct capi_ctr *card); /* filled in before calling ready callback */ - u8 manu[CAPI_MANUFACTURER_LEN]; /* CAPI_GET_MANUFACTURER */ + u8 manu[CAPI_MANUFACTURER_LEN]; /* CAPI_GET_MANUFACTURER */ capi_version version; /* CAPI_GET_VERSION */ capi_profile profile; /* CAPI_GET_PROFILE */ u8 serial[CAPI_SERIAL_LEN]; /* CAPI_GET_SERIAL */ diff --git a/include/linux/usb.h b/include/linux/usb.h index 471c37f5188b..a20b33d953aa 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -329,7 +329,7 @@ static inline int usb_make_path (struct usb_device *dev, char *buf, size_t size) { int actual; actual = snprintf (buf, size, "usb-%s-%s", dev->bus->bus_name, dev->devpath); - return (actual >= size) ? -1 : actual; + return (actual >= (int)size) ? -1 : actual; } /*-------------------------------------------------------------------------*/ -- cgit v1.2.3 From 56928c850640733f7368c2ed2293cd26b6eea772 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Wed, 3 Sep 2003 11:11:51 -0700 Subject: [PATCH] Fix rtc symbol clash and HPET config problems The new HPET RTC emulation code uses a function in rtc.c, get_rtc_time(). So that function was made non-static. Problem is, the same function name is used elsewhere by some architectures, so there will be linkage problems. And rtc_get_time() is used too, so I renamed it to rtc_get_rtc_time(). Also, the HPET code was setting CONFIG_HPET_EMULATE_RTC by hand in a header file. Fix it to use the Kconfig system properly. --- arch/i386/Kconfig | 3 +++ arch/i386/kernel/time_hpet.c | 3 +-- drivers/char/rtc.c | 7 +++---- include/asm-i386/hpet.h | 5 ++--- include/linux/rtc.h | 1 + 5 files changed, 10 insertions(+), 9 deletions(-) (limited to 'include/linux') diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig index fa32ee149abc..928c42588f10 100644 --- a/arch/i386/Kconfig +++ b/arch/i386/Kconfig @@ -419,6 +419,9 @@ config HPET_TIMER Choose N to continue using the legacy 8254 timer. +config HPET_EMULATE_RTC + def_bool HPET_TIMER && RTC=y + config SMP bool "Symmetric multi-processing support" ---help--- diff --git a/arch/i386/kernel/time_hpet.c b/arch/i386/kernel/time_hpet.c index 7c0d0e7407a0..3ea82f9731f4 100644 --- a/arch/i386/kernel/time_hpet.c +++ b/arch/i386/kernel/time_hpet.c @@ -187,7 +187,6 @@ __setup("hpet=", hpet_setup); #include extern irqreturn_t rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs); -extern void get_rtc_time(struct rtc_time *rtc_tm); #define DEFAULT_RTC_INT_FREQ 64 #define RTC_NUM_INTS 1 @@ -354,7 +353,7 @@ irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs) hpet_rtc_timer_reinit(); if (UIE_on | AIE_on) { - get_rtc_time(&curr_time); + rtc_get_rtc_time(&curr_time); } if (UIE_on) { if (curr_time.tm_sec != prev_update_sec) { diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c index 309a173c821d..166002b12674 100644 --- a/drivers/char/rtc.c +++ b/drivers/char/rtc.c @@ -137,7 +137,6 @@ static int rtc_ioctl(struct inode *inode, struct file *file, static unsigned int rtc_poll(struct file *file, poll_table *wait); #endif -void get_rtc_time (struct rtc_time *rtc_tm); static void get_rtc_alm_time (struct rtc_time *alm_tm); #if RTC_IRQ static void rtc_dropped_irq(unsigned long data); @@ -482,7 +481,7 @@ static int rtc_do_ioctl(unsigned int cmd, unsigned long arg, int kernel) } case RTC_RD_TIME: /* Read the time/date from RTC */ { - get_rtc_time(&wtime); + rtc_get_rtc_time(&wtime); break; } case RTC_SET_TIME: /* Set the RTC */ @@ -1119,7 +1118,7 @@ static int rtc_proc_output (char *buf) p = buf; - get_rtc_time(&tm); + rtc_get_rtc_time(&tm); /* * There is no way to tell if the luser has the RTC set for local @@ -1206,7 +1205,7 @@ static inline unsigned char rtc_is_updating(void) return uip; } -void get_rtc_time(struct rtc_time *rtc_tm) +void rtc_get_rtc_time(struct rtc_time *rtc_tm) { unsigned long uip_watchdog = jiffies; unsigned char ctrl; diff --git a/include/asm-i386/hpet.h b/include/asm-i386/hpet.h index 8890ea1fdb4e..ffc472ff5418 100644 --- a/include/asm-i386/hpet.h +++ b/include/asm-i386/hpet.h @@ -102,8 +102,7 @@ extern int is_hpet_capable(void); extern int hpet_readl(unsigned long a); extern void hpet_writel(unsigned long d, unsigned long a); -#ifdef CONFIG_RTC -#define CONFIG_HPET_EMULATE_RTC 1 +#ifdef CONFIG_HPET_EMULATE_RTC extern int hpet_mask_rtc_irq_bit(unsigned long bit_mask); extern int hpet_set_rtc_irq_bit(unsigned long bit_mask); extern int hpet_set_alarm_time(unsigned char hrs, unsigned char min, unsigned char sec); @@ -111,6 +110,6 @@ extern int hpet_set_periodic_freq(unsigned long freq); extern int hpet_rtc_dropped_irq(void); extern int hpet_rtc_timer_init(void); extern irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs); -#endif /* CONFIG_RTC */ +#endif /* CONFIG_HPET_EMULATE_RTC */ #endif /* CONFIG_HPET_TIMER */ #endif /* _I386_HPET_H */ diff --git a/include/linux/rtc.h b/include/linux/rtc.h index 27c38b240736..e1aaf1fac8e0 100644 --- a/include/linux/rtc.h +++ b/include/linux/rtc.h @@ -101,6 +101,7 @@ typedef struct rtc_task { int rtc_register(rtc_task_t *task); int rtc_unregister(rtc_task_t *task); int rtc_control(rtc_task_t *t, unsigned int cmd, unsigned long arg); +void rtc_get_rtc_time(struct rtc_time *rtc_tm); #endif /* __KERNEL__ */ -- cgit v1.2.3 From 55308a20138c3ea39a0882265f255c5b0f931f20 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Wed, 3 Sep 2003 11:12:33 -0700 Subject: [PATCH] more slab page checking Add checks for kfree() of a page which was allocated with __alloc_pages(), and for free_pages() of a page which was allocated with kmalloc(). --- include/linux/page-flags.h | 2 ++ mm/page_alloc.c | 1 + mm/slab.c | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) (limited to 'include/linux') diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index d4fd6bb3ca43..006fde0295d5 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -191,6 +191,8 @@ extern void get_full_page_state(struct page_state *ret); #define PageSlab(page) test_bit(PG_slab, &(page)->flags) #define SetPageSlab(page) set_bit(PG_slab, &(page)->flags) #define ClearPageSlab(page) clear_bit(PG_slab, &(page)->flags) +#define TestClearPageSlab(page) test_and_clear_bit(PG_slab, &(page)->flags) +#define TestSetPageSlab(page) test_and_set_bit(PG_slab, &(page)->flags) #ifdef CONFIG_HIGHMEM #define PageHighMem(page) test_bit(PG_highmem, &(page)->flags) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 453f291437ab..2ac25b6c141f 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -220,6 +220,7 @@ static inline void free_pages_check(const char *function, struct page *page) 1 << PG_locked | 1 << PG_active | 1 << PG_reclaim | + 1 << PG_slab | 1 << PG_writeback ))) bad_page(function, page); if (PageDirty(page)) diff --git a/mm/slab.c b/mm/slab.c index 6093193d0456..f54d4e83c7f3 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -787,7 +787,8 @@ static inline void kmem_freepages (kmem_cache_t *cachep, void *addr) * vm_scan(). Shouldn't be a worry. */ while (i--) { - ClearPageSlab(page); + if (!TestClearPageSlab(page)) + BUG(); page++; } sub_page_state(nr_slab, nr_freed); -- cgit v1.2.3 From 5eebb6f205162c0a7b0075e8d86453f81994aa2f Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Wed, 3 Sep 2003 11:12:43 -0700 Subject: [PATCH] might_sleep() improvements From: Mitchell Blank Jr This patch makes the following improvements to might_sleep(): o Add a "might_sleep_if()" macro for when we might sleep only if some condition is met. It's a bit tidier, and has an unlikely() in it. o Add might_sleep checks to skb_share_check() and skb_unshare() which sometimes need to allocate memory. o Make all architectures call might_sleep() in both down() and down_interruptible(). Before only ppc, ppc64, and i386 did this check. (sh did the check on down() but not down_interruptible()) --- arch/sparc64/kernel/semaphore.c | 2 ++ include/asm-alpha/semaphore.h | 8 ++++++-- include/asm-arm/semaphore.h | 4 ++-- include/asm-arm26/semaphore.h | 4 ++-- include/asm-cris/semaphore.h | 2 ++ include/asm-h8300/semaphore.h | 2 ++ include/asm-ia64/semaphore.h | 2 ++ include/asm-m68k/semaphore.h | 4 ++-- include/asm-m68knommu/semaphore.h | 4 ++-- include/asm-mips/semaphore.h | 2 ++ include/asm-parisc/semaphore.h | 4 ++-- include/asm-s390/semaphore.h | 2 ++ include/asm-sh/semaphore.h | 1 + include/asm-sparc/semaphore.h | 2 ++ include/asm-v850/semaphore.h | 2 ++ include/asm-x86_64/semaphore.h | 2 ++ include/linux/kernel.h | 2 ++ include/linux/skbuff.h | 2 ++ mm/page_alloc.c | 3 +-- mm/rmap.c | 3 +-- mm/slab.c | 3 +-- 21 files changed, 42 insertions(+), 18 deletions(-) (limited to 'include/linux') diff --git a/arch/sparc64/kernel/semaphore.c b/arch/sparc64/kernel/semaphore.c index 4ce2f9369019..a9e66d666ceb 100644 --- a/arch/sparc64/kernel/semaphore.c +++ b/arch/sparc64/kernel/semaphore.c @@ -110,6 +110,7 @@ static void __down(struct semaphore * sem) void down(struct semaphore *sem) { + might_sleep(); /* This atomically does: * old_val = sem->count; * new_val = sem->count - 1; @@ -219,6 +220,7 @@ int down_interruptible(struct semaphore *sem) { int ret = 0; + might_sleep(); /* This atomically does: * old_val = sem->count; * new_val = sem->count - 1; diff --git a/include/asm-alpha/semaphore.h b/include/asm-alpha/semaphore.h index ab26cfbaddbf..a363f018a35f 100644 --- a/include/asm-alpha/semaphore.h +++ b/include/asm-alpha/semaphore.h @@ -88,14 +88,18 @@ extern void __up_wakeup(struct semaphore *); static inline void __down(struct semaphore *sem) { - long count = atomic_dec_return(&sem->count); + long count; + might_sleep(); + count = atomic_dec_return(&sem->count); if (unlikely(count < 0)) __down_failed(sem); } static inline int __down_interruptible(struct semaphore *sem) { - long count = atomic_dec_return(&sem->count); + long count; + might_sleep(); + count = atomic_dec_return(&sem->count); if (unlikely(count < 0)) return __down_failed_interruptible(sem); return 0; diff --git a/include/asm-arm/semaphore.h b/include/asm-arm/semaphore.h index 656120edc11b..76284ff21f49 100644 --- a/include/asm-arm/semaphore.h +++ b/include/asm-arm/semaphore.h @@ -88,7 +88,7 @@ static inline void down(struct semaphore * sem) #if WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif - + might_sleep(); __down_op(sem, __down_failed); } @@ -101,7 +101,7 @@ static inline int down_interruptible (struct semaphore * sem) #if WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif - + might_sleep(); return __down_op_ret(sem, __down_interruptible_failed); } diff --git a/include/asm-arm26/semaphore.h b/include/asm-arm26/semaphore.h index a7d94526309d..49946274a67b 100644 --- a/include/asm-arm26/semaphore.h +++ b/include/asm-arm26/semaphore.h @@ -84,7 +84,7 @@ static inline void down(struct semaphore * sem) #if WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif - + might_sleep(); __down_op(sem, __down_failed); } @@ -97,7 +97,7 @@ static inline int down_interruptible (struct semaphore * sem) #if WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif - + might_sleep(); return __down_op_ret(sem, __down_interruptible_failed); } diff --git a/include/asm-cris/semaphore.h b/include/asm-cris/semaphore.h index 011a3bdc9ca7..d0821f6cef7f 100644 --- a/include/asm-cris/semaphore.h +++ b/include/asm-cris/semaphore.h @@ -79,6 +79,7 @@ extern inline void down(struct semaphore * sem) #if WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif + might_sleep(); /* atomically decrement the semaphores count, and if its negative, we wait */ local_save_flags(flags); @@ -104,6 +105,7 @@ extern inline int down_interruptible(struct semaphore * sem) #if WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif + might_sleep(); /* atomically decrement the semaphores count, and if its negative, we wait */ local_save_flags(flags); diff --git a/include/asm-h8300/semaphore.h b/include/asm-h8300/semaphore.h index 962f5eb32d16..62e6e9ce669e 100644 --- a/include/asm-h8300/semaphore.h +++ b/include/asm-h8300/semaphore.h @@ -90,6 +90,7 @@ static inline void down(struct semaphore * sem) #if WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif + might_sleep(); count = &(sem->count); __asm__ __volatile__( @@ -117,6 +118,7 @@ static inline int down_interruptible(struct semaphore * sem) #if WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif + might_sleep(); count = &(sem->count); __asm__ __volatile__( diff --git a/include/asm-ia64/semaphore.h b/include/asm-ia64/semaphore.h index dd0eade35495..44165a637add 100644 --- a/include/asm-ia64/semaphore.h +++ b/include/asm-ia64/semaphore.h @@ -73,6 +73,7 @@ down (struct semaphore *sem) #if WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif + might_sleep(); if (atomic_dec_return(&sem->count) < 0) __down(sem); } @@ -89,6 +90,7 @@ down_interruptible (struct semaphore * sem) #if WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif + might_sleep(); if (atomic_dec_return(&sem->count) < 0) ret = __down_interruptible(sem); return ret; diff --git a/include/asm-m68k/semaphore.h b/include/asm-m68k/semaphore.h index 8581f361c52d..cc844ef36a83 100644 --- a/include/asm-m68k/semaphore.h +++ b/include/asm-m68k/semaphore.h @@ -89,7 +89,7 @@ extern inline void down(struct semaphore * sem) #if WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif - + might_sleep(); __asm__ __volatile__( "| atomic down operation\n\t" "subql #1,%0@\n\t" @@ -112,7 +112,7 @@ extern inline int down_interruptible(struct semaphore * sem) #if WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif - + might_sleep(); __asm__ __volatile__( "| atomic interruptible down operation\n\t" "subql #1,%1@\n\t" diff --git a/include/asm-m68knommu/semaphore.h b/include/asm-m68knommu/semaphore.h index 4720a09e6191..f85d311bc2d8 100644 --- a/include/asm-m68knommu/semaphore.h +++ b/include/asm-m68knommu/semaphore.h @@ -88,7 +88,7 @@ extern inline void down(struct semaphore * sem) #if WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif - + might_sleep(); __asm__ __volatile__( "| atomic down operation\n\t" "movel %0, %%a1\n\t" @@ -108,7 +108,7 @@ extern inline int down_interruptible(struct semaphore * sem) #if WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif - + might_sleep(); __asm__ __volatile__( "| atomic down operation\n\t" "movel %1, %%a1\n\t" diff --git a/include/asm-mips/semaphore.h b/include/asm-mips/semaphore.h index 34fc00d60460..a867bb1014be 100644 --- a/include/asm-mips/semaphore.h +++ b/include/asm-mips/semaphore.h @@ -88,6 +88,7 @@ static inline void down(struct semaphore * sem) #if WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif + might_sleep(); if (atomic_dec_return(&sem->count) < 0) __down(sem); } @@ -103,6 +104,7 @@ static inline int down_interruptible(struct semaphore * sem) #if WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif + might_sleep(); if (atomic_dec_return(&sem->count) < 0) ret = __down_interruptible(sem); return ret; diff --git a/include/asm-parisc/semaphore.h b/include/asm-parisc/semaphore.h index 80686a7ab250..f01554398f1a 100644 --- a/include/asm-parisc/semaphore.h +++ b/include/asm-parisc/semaphore.h @@ -84,7 +84,7 @@ extern __inline__ void down(struct semaphore * sem) #if WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif - + might_sleep(); spin_lock_irq(&sem->sentry); if (sem->count > 0) { sem->count--; @@ -100,7 +100,7 @@ extern __inline__ int down_interruptible(struct semaphore * sem) #if WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif - + might_sleep(); spin_lock_irq(&sem->sentry); if (sem->count > 0) { sem->count--; diff --git a/include/asm-s390/semaphore.h b/include/asm-s390/semaphore.h index 474abcd85b34..5720dea2459f 100644 --- a/include/asm-s390/semaphore.h +++ b/include/asm-s390/semaphore.h @@ -60,6 +60,7 @@ asmlinkage void __up(struct semaphore * sem); static inline void down(struct semaphore * sem) { + might_sleep(); if (atomic_dec_return(&sem->count) < 0) __down(sem); } @@ -68,6 +69,7 @@ static inline int down_interruptible(struct semaphore * sem) { int ret = 0; + might_sleep(); if (atomic_dec_return(&sem->count) < 0) ret = __down_interruptible(sem); return ret; diff --git a/include/asm-sh/semaphore.h b/include/asm-sh/semaphore.h index 2ba0930035f6..dc8955e3448c 100644 --- a/include/asm-sh/semaphore.h +++ b/include/asm-sh/semaphore.h @@ -107,6 +107,7 @@ static inline int down_interruptible(struct semaphore * sem) CHECK_MAGIC(sem->__magic); #endif + might_sleep(); if (atomic_dec_return(&sem->count) < 0) ret = __down_interruptible(sem); return ret; diff --git a/include/asm-sparc/semaphore.h b/include/asm-sparc/semaphore.h index cf3135b928a0..0e6122ae3058 100644 --- a/include/asm-sparc/semaphore.h +++ b/include/asm-sparc/semaphore.h @@ -71,6 +71,7 @@ static inline void down(struct semaphore * sem) #if WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif + might_sleep(); ptr = &(sem->count.counter); increment = 1; @@ -107,6 +108,7 @@ static inline int down_interruptible(struct semaphore * sem) #if WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif + might_sleep(); ptr = &(sem->count.counter); increment = 1; diff --git a/include/asm-v850/semaphore.h b/include/asm-v850/semaphore.h index 0d6560f3ba98..c514062bb69e 100644 --- a/include/asm-v850/semaphore.h +++ b/include/asm-v850/semaphore.h @@ -57,6 +57,7 @@ extern void __up (struct semaphore * sem); extern inline void down (struct semaphore * sem) { + might_sleep(); if (atomic_dec_return (&sem->count) < 0) __down (sem); } @@ -64,6 +65,7 @@ extern inline void down (struct semaphore * sem) extern inline int down_interruptible (struct semaphore * sem) { int ret = 0; + might_sleep(); if (atomic_dec_return (&sem->count) < 0) ret = __down_interruptible (sem); return ret; diff --git a/include/asm-x86_64/semaphore.h b/include/asm-x86_64/semaphore.h index 6f42c7af790b..5fe25482facc 100644 --- a/include/asm-x86_64/semaphore.h +++ b/include/asm-x86_64/semaphore.h @@ -118,6 +118,7 @@ static inline void down(struct semaphore * sem) #if WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif + might_sleep(); __asm__ __volatile__( "# atomic down operation\n\t" @@ -144,6 +145,7 @@ static inline int down_interruptible(struct semaphore * sem) #if WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif + might_sleep(); __asm__ __volatile__( "# atomic interruptible down operation\n\t" diff --git a/include/linux/kernel.h b/include/linux/kernel.h index b0aebfeda888..b2d17ea0dac0 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -52,8 +52,10 @@ struct completion; #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP void __might_sleep(char *file, int line); #define might_sleep() __might_sleep(__FILE__, __LINE__) +#define might_sleep_if(cond) do { if (unlikely(cond)) might_sleep(); } while (0) #else #define might_sleep() do {} while(0) +#define might_sleep_if(cond) do {} while (0) #endif extern struct notifier_block *panic_notifier_list; diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index a372186cb6d6..4b5f057f8bfb 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -389,6 +389,7 @@ static inline int skb_shared(struct sk_buff *skb) */ static inline struct sk_buff *skb_share_check(struct sk_buff *skb, int pri) { + might_sleep_if(pri & __GFP_WAIT); if (skb_shared(skb)) { struct sk_buff *nskb = skb_clone(skb, pri); kfree_skb(skb); @@ -419,6 +420,7 @@ static inline struct sk_buff *skb_share_check(struct sk_buff *skb, int pri) */ static inline struct sk_buff *skb_unshare(struct sk_buff *skb, int pri) { + might_sleep_if(pri & __GFP_WAIT); if (skb_cloned(skb)) { struct sk_buff *nskb = skb_copy(skb, pri); kfree_skb(skb); /* Free our shared copy */ diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 2ac25b6c141f..4051a19b0ab5 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -543,8 +543,7 @@ __alloc_pages(unsigned int gfp_mask, unsigned int order, int do_retry; struct reclaim_state reclaim_state; - if (wait) - might_sleep(); + might_sleep_if(wait); cold = 0; if (gfp_mask & __GFP_COLD) diff --git a/mm/rmap.c b/mm/rmap.c index 06377cb9c907..c4434f218e4d 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -503,8 +503,7 @@ struct pte_chain *pte_chain_alloc(int gfp_flags) struct pte_chain *ret; struct pte_chain **pte_chainp; - if (gfp_flags & __GFP_WAIT) - might_sleep(); + might_sleep_if(gfp_flags & __GFP_WAIT); pte_chainp = &get_cpu_var(local_pte_chain); if (*pte_chainp) { diff --git a/mm/slab.c b/mm/slab.c index f54d4e83c7f3..34b62ca48429 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -1814,8 +1814,7 @@ alloc_done: static inline void cache_alloc_debugcheck_before(kmem_cache_t *cachep, int flags) { - if (flags & __GFP_WAIT) - might_sleep(); + might_sleep_if(flags & __GFP_WAIT); #if DEBUG kmem_flagcheck(cachep, flags); #endif -- cgit v1.2.3 From e46674c847e156b1d4f485120a3d92fcaa5ce6e5 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Wed, 3 Sep 2003 11:12:53 -0700 Subject: [PATCH] MODULE_ALIAS() in block devices From: Rusty Russell Previously, default aliases were hardwired into modutils. Now they should be inside the modules, using MODULE_ALIAS() (they will be overridden by any user alias). --- drivers/block/floppy.c | 2 ++ drivers/block/xd.c | 4 ++-- drivers/cdrom/aztcd.c | 1 + drivers/cdrom/cdu31a.c | 1 + drivers/cdrom/cm206.c | 2 +- drivers/cdrom/gscd.c | 1 + drivers/cdrom/mcd.c | 1 + drivers/cdrom/mcdx.c | 1 + drivers/cdrom/optcd.c | 1 + drivers/cdrom/sbpcd.c | 3 +++ drivers/cdrom/sjcd.c | 1 + drivers/cdrom/sonycd535.c | 1 + include/linux/blkdev.h | 9 ++++++++- 13 files changed, 24 insertions(+), 4 deletions(-) (limited to 'include/linux') diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 10566621eb81..b25acb42542e 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -4607,3 +4607,5 @@ MODULE_LICENSE("GPL"); __setup ("floppy=", floppy_setup); module_init(floppy_init) #endif + +MODULE_ALIAS_BLOCKDEV_MAJOR(FLOPPY_MAJOR); diff --git a/drivers/block/xd.c b/drivers/block/xd.c index 8b4972feca71..dc06ce7adfa6 100644 --- a/drivers/block/xd.c +++ b/drivers/block/xd.c @@ -1103,5 +1103,5 @@ __setup ("xd_geo=", xd_manual_geo_init); #endif /* MODULE */ -module_init(xd_init) - +module_init(xd_init); +MODULE_ALIAS_BLOCKDEV_MAJOR(XT_DISK_MAJOR); diff --git a/drivers/cdrom/aztcd.c b/drivers/cdrom/aztcd.c index 969945a7bdb4..8503b193aea5 100644 --- a/drivers/cdrom/aztcd.c +++ b/drivers/cdrom/aztcd.c @@ -2499,3 +2499,4 @@ static int azt_bcd2bin(unsigned char bcd) } MODULE_LICENSE("GPL"); +MODULE_ALIAS_BLOCKDEV_MAJOR(AZTECH_CDROM_MAJOR); diff --git a/drivers/cdrom/cdu31a.c b/drivers/cdrom/cdu31a.c index 379b454684dd..5a30990de102 100644 --- a/drivers/cdrom/cdu31a.c +++ b/drivers/cdrom/cdu31a.c @@ -3500,3 +3500,4 @@ module_init(cdu31a_init); module_exit(cdu31a_exit); MODULE_LICENSE("GPL"); +MODULE_ALIAS_BLOCKDEV_MAJOR(CDU31A_CDROM_MAJOR); diff --git a/drivers/cdrom/cm206.c b/drivers/cdrom/cm206.c index 22464a5fd19a..c462db3b81ce 100644 --- a/drivers/cdrom/cm206.c +++ b/drivers/cdrom/cm206.c @@ -1616,7 +1616,7 @@ static int __init cm206_setup(char *s) __setup("cm206=", cm206_setup); #endif /* !MODULE */ - +MODULE_ALIAS_BLOCKDEV_MAJOR(CM206_CDROM_MAJOR); /* * Local variables: diff --git a/drivers/cdrom/gscd.c b/drivers/cdrom/gscd.c index b24979c1104b..111f020de66e 100644 --- a/drivers/cdrom/gscd.c +++ b/drivers/cdrom/gscd.c @@ -1029,3 +1029,4 @@ MODULE_AUTHOR("Oliver Raupach "); MODULE_LICENSE("GPL"); module_init(gscd_init); module_exit(gscd_exit); +MODULE_ALIAS_BLOCKDEV_MAJOR(GOLDSTAR_CDROM_MAJOR); diff --git a/drivers/cdrom/mcd.c b/drivers/cdrom/mcd.c index e17822236df4..33b35e30e619 100644 --- a/drivers/cdrom/mcd.c +++ b/drivers/cdrom/mcd.c @@ -1559,3 +1559,4 @@ module_exit(mcd_exit); MODULE_AUTHOR("Martin Harriss"); MODULE_LICENSE("GPL"); +MODULE_ALIAS_BLOCKDEV_MAJOR(MITSUMI_CDROM_MAJOR); diff --git a/drivers/cdrom/mcdx.c b/drivers/cdrom/mcdx.c index 70719df8305d..ba4700ddbb0f 100644 --- a/drivers/cdrom/mcdx.c +++ b/drivers/cdrom/mcdx.c @@ -1970,3 +1970,4 @@ static int mcdx_setattentuator(struct s_drive_stuff *stuffp, } MODULE_LICENSE("GPL"); +MODULE_ALIAS_BLOCKDEV_MAJOR(MITSUMI_X_CDROM_MAJOR); diff --git a/drivers/cdrom/optcd.c b/drivers/cdrom/optcd.c index c435e22f9fde..7e9758fe7045 100644 --- a/drivers/cdrom/optcd.c +++ b/drivers/cdrom/optcd.c @@ -2102,3 +2102,4 @@ module_init(optcd_init); module_exit(optcd_exit); MODULE_LICENSE("GPL"); +MODULE_ALIAS_BLOCKDEV_MAJOR(OPTICS_CDROM_MAJOR); diff --git a/drivers/cdrom/sbpcd.c b/drivers/cdrom/sbpcd.c index c57a5d82fef1..df865505d369 100644 --- a/drivers/cdrom/sbpcd.c +++ b/drivers/cdrom/sbpcd.c @@ -5954,6 +5954,9 @@ static int sbpcd_media_changed(struct cdrom_device_info *cdi, int disc_nr) } MODULE_LICENSE("GPL"); +/* FIXME: Old modules.conf claims MATSUSHITA_CDROM2_MAJOR and CDROM3, but + AFAICT this doesn't support those majors, so why? --RR 30 Jul 2003 */ +MODULE_ALIAS_BLOCKDEV_MAJOR(MATSUSHITA_CDROM_MAJOR); /*==========================================================================*/ /* diff --git a/drivers/cdrom/sjcd.c b/drivers/cdrom/sjcd.c index ae6a8237d063..1c8362764e1a 100644 --- a/drivers/cdrom/sjcd.c +++ b/drivers/cdrom/sjcd.c @@ -1813,3 +1813,4 @@ module_init(sjcd_init); module_exit(sjcd_exit); MODULE_LICENSE("GPL"); +MODULE_ALIAS_BLOCKDEV_MAJOR(SANYO_CDROM_MAJOR); diff --git a/drivers/cdrom/sonycd535.c b/drivers/cdrom/sonycd535.c index 2422038cc059..1467c9311000 100644 --- a/drivers/cdrom/sonycd535.c +++ b/drivers/cdrom/sonycd535.c @@ -1684,3 +1684,4 @@ module_exit(sony535_exit); MODULE_LICENSE("GPL"); +MODULE_ALIAS_BLOCKDEV_MAJOR(CDU535_CDROM_MAJOR); diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 99dbf0d24eaf..9c7e6d86e810 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -12,6 +12,8 @@ #include #include #include +#include +#include #include @@ -671,6 +673,11 @@ void kblockd_flush(void); } \ ) #endif - + +#define MODULE_ALIAS_BLOCKDEV(major,minor) \ + MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor)) +#define MODULE_ALIAS_BLOCKDEV_MAJOR(major) \ + MODULE_ALIAS("block-major-" __stringify(major) "-*") + #endif -- cgit v1.2.3 From 95759639ef09fc2439cd092cb8ee6e067aac6220 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Wed, 3 Sep 2003 11:13:04 -0700 Subject: [PATCH] MODULE_ALIAS() in char devices From: Rusty Russell Previously, default aliases were hardwired into modutils. Now they should be inside the modules, using MODULE_ALIAS() (they will be overridden by any user alias). --- arch/i386/kernel/apm.c | 2 +- drivers/char/agp/backend.c | 1 + drivers/char/agp/frontend.c | 1 - drivers/char/busmouse.c | 1 + drivers/char/lp.c | 1 + drivers/char/nvram.c | 1 + drivers/char/rtc.c | 1 + drivers/char/watchdog/wdt.c | 2 ++ drivers/media/video/bttv-driver.c | 1 + drivers/net/ppp_generic.c | 1 + drivers/net/tun.c | 1 + include/linux/device.h | 5 +++++ include/linux/miscdevice.h | 5 +++++ 13 files changed, 21 insertions(+), 2 deletions(-) (limited to 'include/linux') diff --git a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c index 94ff91ebe2e0..6651e1941eaa 100644 --- a/arch/i386/kernel/apm.c +++ b/arch/i386/kernel/apm.c @@ -2080,4 +2080,4 @@ MODULE_PARM_DESC(idle_period, MODULE_PARM(smp, "i"); MODULE_PARM_DESC(smp, "Set this to enable APM use on an SMP platform. Use with caution on older systems"); - +MODULE_ALIAS_MISCDEV(APM_MINOR_DEV); diff --git a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c index 0ba95771e9e1..8280faa7ee9e 100644 --- a/drivers/char/agp/backend.c +++ b/drivers/char/agp/backend.c @@ -331,6 +331,7 @@ __setup("agp=", agp_setup); MODULE_AUTHOR("Dave Jones "); MODULE_DESCRIPTION("AGP GART driver"); MODULE_LICENSE("GPL and additional rights"); +MODULE_ALIAS_MISCDEV(AGPGART_MINOR); module_init(agp_init); module_exit(agp_exit); diff --git a/drivers/char/agp/frontend.c b/drivers/char/agp/frontend.c index 6ff8d157fc6d..ef1fa6db9570 100644 --- a/drivers/char/agp/frontend.c +++ b/drivers/char/agp/frontend.c @@ -1097,4 +1097,3 @@ void agp_frontend_cleanup(void) { misc_deregister(&agp_miscdev); } - diff --git a/drivers/char/busmouse.c b/drivers/char/busmouse.c index 126d77f8a215..b0416f721054 100644 --- a/drivers/char/busmouse.c +++ b/drivers/char/busmouse.c @@ -452,4 +452,5 @@ EXPORT_SYMBOL(busmouse_add_buttons); EXPORT_SYMBOL(register_busmouse); EXPORT_SYMBOL(unregister_busmouse); +MODULE_ALIAS_MISCDEV(BUSMOUSE_MINOR); MODULE_LICENSE("GPL"); diff --git a/drivers/char/lp.c b/drivers/char/lp.c index 46be7a8ac3d3..56ffc3965d76 100644 --- a/drivers/char/lp.c +++ b/drivers/char/lp.c @@ -965,4 +965,5 @@ __setup("lp=", lp_setup); module_init(lp_init_module); module_exit(lp_cleanup_module); +MODULE_ALIAS("char-major-" __stringify(LP_MAJOR)); MODULE_LICENSE("GPL"); diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c index 96daf9d5d80e..7b6ee59edf08 100644 --- a/drivers/char/nvram.c +++ b/drivers/char/nvram.c @@ -923,3 +923,4 @@ EXPORT_SYMBOL(__nvram_check_checksum); EXPORT_SYMBOL(nvram_check_checksum); EXPORT_SYMBOL(__nvram_set_checksum); EXPORT_SYMBOL(nvram_set_checksum); +MODULE_ALIAS_MISCDEV(NVRAM_MINOR); diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c index 166002b12674..fcdc4eb0b9ac 100644 --- a/drivers/char/rtc.c +++ b/drivers/char/rtc.c @@ -1345,3 +1345,4 @@ static void set_rtc_irq_bit(unsigned char bit) MODULE_AUTHOR("Paul Gortmaker"); MODULE_LICENSE("GPL"); +MODULE_ALIAS_MISCDEV(RTC_MINOR); diff --git a/drivers/char/watchdog/wdt.c b/drivers/char/watchdog/wdt.c index e1760847f6d3..989a5a89a2ab 100644 --- a/drivers/char/watchdog/wdt.c +++ b/drivers/char/watchdog/wdt.c @@ -579,4 +579,6 @@ module_exit(wdt_exit); MODULE_AUTHOR("Alan Cox"); MODULE_DESCRIPTION("Driver for ISA ICS watchdog cards (WDT500/501)"); +MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); +MODULE_ALIAS_MISCDEV(TEMP_MINOR); MODULE_LICENSE("GPL"); diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c index 76f91782da48..3f3ef3025c13 100644 --- a/drivers/media/video/bttv-driver.c +++ b/drivers/media/video/bttv-driver.c @@ -115,6 +115,7 @@ MODULE_PARM(v4l2,"i"); MODULE_DESCRIPTION("bttv - v4l/v4l2 driver module for bt848/878 based cards"); MODULE_AUTHOR("Ralph Metzler & Marcus Metzler & Gerd Knorr"); MODULE_LICENSE("GPL"); +MODULE_ALIAS_CHARDEV_MAJOR(VIDEO_MAJOR); /* kernel args */ #ifndef MODULE diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index c96dbc2bd150..6b30d5f28c10 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c @@ -2670,3 +2670,4 @@ EXPORT_SYMBOL(ppp_unregister_compressor); EXPORT_SYMBOL(all_ppp_units); /* for debugging */ EXPORT_SYMBOL(all_channels); /* for debugging */ MODULE_LICENSE("GPL"); +MODULE_ALIAS_CHARDEV_MAJOR(PPP_MAJOR); diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 860e53b4d696..784a41d78ebf 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -640,3 +640,4 @@ void tun_cleanup(void) module_init(tun_init); module_exit(tun_cleanup); MODULE_LICENSE("GPL"); +MODULE_ALIAS_MISCDEV(TUN_MINOR); diff --git a/include/linux/device.h b/include/linux/device.h index 8d6266f2e3c3..96043c0f46c5 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -398,4 +398,9 @@ extern void firmware_unregister(struct subsystem *); #define dev_warn(dev, format, arg...) \ dev_printk(KERN_WARNING , dev , format , ## arg) +/* Create alias, so I can be autoloaded. */ +#define MODULE_ALIAS_CHARDEV(major,minor) \ + MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor)) +#define MODULE_ALIAS_CHARDEV_MAJOR(major) \ + MODULE_ALIAS("char-major-" __stringify(major) "-*") #endif /* _DEVICE_H_ */ diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h index 159f8ab3df80..23b095889111 100644 --- a/include/linux/miscdevice.h +++ b/include/linux/miscdevice.h @@ -1,5 +1,7 @@ #ifndef _LINUX_MISCDEVICE_H #define _LINUX_MISCDEVICE_H +#include +#include #define BUSMOUSE_MINOR 0 #define PSMOUSE_MINOR 1 @@ -48,4 +50,7 @@ struct miscdevice extern int misc_register(struct miscdevice * misc); extern int misc_deregister(struct miscdevice * misc); +#define MODULE_ALIAS_MISCDEV(minor) \ + MODULE_ALIAS("char-major-" __stringify(MISC_MAJOR) \ + "-" __stringify(minor)) #endif -- cgit v1.2.3 From 046dbb49a01786e2c7dd1432c15f76f66385e264 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Wed, 3 Sep 2003 11:13:12 -0700 Subject: [PATCH] Remove percpufication of in_flight counter in From: Ravikiran G Thirumalai The routine disk_round_stats showed up considerably under oprofile for high disk io load (four processes doing dd to the same disk (different partitions) on a 4 way). This is because the counter in_flight which is per-cpu right now gets read every time disk_round_stats gets called. Per cpu counters like disk statistics improve write speed, but reads are slow (since all cpus' local counter values have to be read and summed up). Considering the fact that in_flight counter is modified post disk_round_stats (which reads the in_flight counter) it is better not to per-cpu this counter. Following patch does just that. Below is the profile comparison before and after the change. This was on a 4 way PIII Xeon, 1G ram, 2.6.0-test4-mm2. Before: c010aa60 2910109 92.2249 poll_idle c0275340 23208 0.73549 __copy_to_user_ll c02753b0 11191 0.354657 __copy_from_user_ll c0114aa0 7168 0.227163 mark_offset_tsc c011ad10 6767 0.214455 schedule c011a2b0 6741 0.213631 load_balance c0138890 6710 0.212648 __generic_file_aio_write_nolock c011d302 4683 0.14841 .text.lock.sched c02e4b50 4533 0.143656 ahc_linux_isr c029cec0 3582 0.113518 disk_round_stats c0119b40 3509 0.111205 try_to_wake_up c029d320 3306 0.104771 __make_request c01567d0 3300 0.104581 __block_write_full_page c0156c00 3299 0.104549 __block_prepare_write After: c010aa60 2777940 92.1302 poll_idle c0275340 23479 0.778679 __copy_to_user_ll c02753b0 10943 0.362924 __copy_from_user_ll c0114aa0 7022 0.232884 mark_offset_tsc c0138890 6988 0.231757 __generic_file_aio_write_nolock c011ad10 6607 0.219121 schedule c011d302 5771 0.191395 .text.lock.sched c02e4a60 4458 0.147849 ahc_linux_isr c011a2b0 3921 0.13004 load_balance c01567d0 3569 0.118366 __block_write_full_page c029d2a0 3540 0.117404 __make_request ... c029ceb0 311 0.0103143 disk_round_stats c011d5b0 299 0.00991631 remove_wait_queue --- drivers/block/genhd.c | 4 ++-- drivers/block/ll_rw_blk.c | 10 +++++----- include/linux/genhd.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'include/linux') diff --git a/drivers/block/genhd.c b/drivers/block/genhd.c index 16a58ad04008..0cbabe9103d4 100644 --- a/drivers/block/genhd.c +++ b/drivers/block/genhd.c @@ -372,7 +372,7 @@ static ssize_t disk_stats_read(struct gendisk * disk, char *page) disk_stat_read(disk, write_merges), (unsigned long long)disk_stat_read(disk, write_sectors), jiffies_to_msec(disk_stat_read(disk, write_ticks)), - disk_stat_read(disk, in_flight), + disk->in_flight, jiffies_to_msec(disk_stat_read(disk, io_ticks)), jiffies_to_msec(disk_stat_read(disk, time_in_queue))); } @@ -492,7 +492,7 @@ static int diskstats_show(struct seq_file *s, void *v) disk_stat_read(gp, writes), disk_stat_read(gp, write_merges), (unsigned long long)disk_stat_read(gp, write_sectors), jiffies_to_msec(disk_stat_read(gp, write_ticks)), - disk_stat_read(gp, in_flight), + gp->in_flight, jiffies_to_msec(disk_stat_read(gp, io_ticks)), jiffies_to_msec(disk_stat_read(gp, time_in_queue))); diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c index c403ba8429b3..c57d8d0f42c2 100644 --- a/drivers/block/ll_rw_blk.c +++ b/drivers/block/ll_rw_blk.c @@ -1660,7 +1660,7 @@ void drive_stat_acct(struct request *rq, int nr_sectors, int new_io) } if (new_io) { disk_round_stats(rq->rq_disk); - disk_stat_inc(rq->rq_disk, in_flight); + rq->rq_disk->in_flight++; } } @@ -1704,10 +1704,10 @@ void disk_round_stats(struct gendisk *disk) unsigned long now = jiffies; disk_stat_add(disk, time_in_queue, - disk_stat_read(disk, in_flight) * (now - disk->stamp)); + disk->in_flight * (now - disk->stamp)); disk->stamp = now; - if (disk_stat_read(disk, in_flight)) + if (disk->in_flight) disk_stat_add(disk, io_ticks, (now - disk->stamp_idle)); disk->stamp_idle = now; } @@ -1819,7 +1819,7 @@ static int attempt_merge(request_queue_t *q, struct request *req, if (req->rq_disk) { disk_round_stats(req->rq_disk); - disk_stat_dec(req->rq_disk, in_flight); + req->rq_disk->in_flight--; } __blk_put_request(q, next); @@ -2480,7 +2480,7 @@ void end_that_request_last(struct request *req) break; } disk_round_stats(disk); - disk_stat_dec(disk, in_flight); + disk->in_flight--; } __blk_put_request(req->q, req); /* Do this LAST! The structure may be freed immediately afterwards */ diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 460ef0362ab5..13e0933ccbc7 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -75,7 +75,6 @@ struct disk_stats { unsigned read_merges, write_merges; unsigned read_ticks, write_ticks; unsigned io_ticks; - int in_flight; unsigned time_in_queue; }; @@ -101,6 +100,7 @@ struct gendisk { unsigned sync_io; /* RAID */ unsigned long stamp, stamp_idle; + int in_flight; #ifdef CONFIG_SMP struct disk_stats *dkstats; #else -- cgit v1.2.3