md: move headers out of include/linux/raid/
PATCH 1/1 md: move headers out of include/linux/raid/
Move the headers with the local structures for the disciplines and bitmap.h into drivers/md/ so that they are more easily grepable for hacking and not far away. md.h is left where it is for now as there are some uses from the outside.
drivers/md/bitmap.c +1 -1
@@ -27,7 +27,7 @@#include <linux/mount.h> #include <linux/buffer_head.h> #include <linux/raid/md.h> -#include <linux/raid/bitmap.h> +#include "bitmap.h" /* debug macros */
drivers/md/bitmap.h new file +288 -0
288 lines not on this page · raw message
drivers/md/linear.c +1 -1
@@ -16,7 +16,7 @@Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/raid/linear.h> +#include "linear.h" /* * find which device holds a particular offset
drivers/md/linear.h new file +31 -0
@@ -0,0 +1,31 @@ +#ifndef _LINEAR_H +#define _LINEAR_H + +#include <linux/raid/md.h> + +struct dev_info { +mdk_rdev_t *rdev; +sector_t num_sectors; +sector_t start_sector; +}; + +typedef struct dev_info dev_info_t ; + +struct linear_private_data +{ +struct linear_private_data *prev;/* earlier version */ +dev_info_t **hash_table; +sector_t spacing; +sector_t array_sectors; +int sector_shift;/* shift before dividing +* by spacing +*/ +dev_info_t disks[0 ]; +}; + + +typedef struct linear_private_data linear_conf_t ; + +#define mddev_to_conf (mddev) ((linear_conf_t *) mddev->private) + +#endif
drivers/md/md.c +1 -1
@@ -34,7 +34,6 @@#include <linux/kthread.h> #include <linux/raid/md.h> -#include <linux/raid/bitmap.h> #include <linux/sysctl.h> #include <linux/buffer_head.h> /* for invalidate_bdev */ #include <linux/poll.h>
@@ -45,6 +44,7 @@#include <linux/reboot.h> #include <linux/file.h> #include <linux/delay.h> +#include "bitmap.h" /* 63 partitions with the alternate major number (mdp) */ #define MdpMinorShift 6
drivers/md/raid1.c +2 -2
@@ -33,8 +33,8 @@#include "dm-bio-list.h" #include <linux/delay.h> -#include <linux/raid/raid1.h> -#include <linux/raid/bitmap.h> +#include "raid1.h" +#include "bitmap.h" #define DEBUG 0#if DEBUG
drivers/md/raid10.c +2 -2
@@ -20,8 +20,8 @@#include "dm-bio-list.h" #include <linux/delay.h> -#include <linux/raid/raid10.h> -#include <linux/raid/bitmap.h> +#include "raid10.h" +#include "bitmap.h" /* * RAID10 provides a combination of RAID0 and RAID1 functionality.
drivers/md/raid5.c +2 -3
@@ -44,10 +44,9 @@*/ #include <linux/kthread.h> -#include "raid6.h" - -#include <linux/raid/bitmap.h> #include <linux/async_tx.h> +#include "raid6.h" +#include "bitmap.h" /* * Stripe cache
include/linux/raid/bitmap.h deleted +0 -288
288 lines not on this page · raw message
include/linux/raid/linear.h deleted +0 -31
@@ -1,31 +0,0 @@ -#ifndef _LINEAR_H -#define _LINEAR_H - -#include <linux/raid/md.h> - -struct dev_info { -mdk_rdev_t *rdev; -sector_t num_sectors; -sector_t start_sector; -}; - -typedef struct dev_info dev_info_t ; - -struct linear_private_data -{ -struct linear_private_data *prev;/* earlier version */ -dev_info_t **hash_table; -sector_t spacing; -sector_t array_sectors; -int sector_shift;/* shift before dividing -* by spacing -*/ -dev_info_t disks[0 ]; -}; - - -typedef struct linear_private_data linear_conf_t ; - -#define mddev_to_conf (mddev) ((linear_conf_t *) mddev->private) - -#endif
drivers/md/multipath.c +1 -1
@@ -19,7 +19,7 @@* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/raid/multipath.h> +#include "multipath.h" #define MAX_WORK_PER_DISK 128
drivers/md/multipath.h new file +42 -0
42 lines not on this page · raw message
include/linux/raid/multipath.h deleted +0 -42
42 lines not on this page · raw message
drivers/md/raid0.c +1 -1
@@ -18,7 +18,7 @@Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/raid/raid0.h> +#include "raid0.h" static void raid0_unplug (struct request_queue *q) {
drivers/md/raid0.h new file +30 -0
@@ -0,0 +1,30 @@ +#ifndef _RAID0_H +#define _RAID0_H + +#include <linux/raid/md.h> + +struct strip_zone +{ +sector_t zone_start;/* Zone offset in md_dev (in sectors) */ +sector_t dev_start;/* Zone offset in real dev (in sectors) */ +sector_t sectors;/* Zone size in sectors */ +int nb_dev;/* # of devices attached to the zone */ +mdk_rdev_t **dev;/* Devices attached to the zone */ +}; + +struct raid0_private_data +{ +struct strip_zone **hash_table;/* Table of indexes into strip_zone */ +struct strip_zone *strip_zone; +mdk_rdev_t **devlist;/* lists of rdevs, pointed to by strip_zone->dev */ +int nr_strip_zones; + +sector_t spacing; +int sector_shift;/* shift this before divide by spacing */ +}; + +typedef struct raid0_private_data raid0_conf_t ; + +#define mddev_to_conf (mddev) ((raid0_conf_t *) mddev->private) + +#endif
drivers/md/raid1.h new file +134 -0
134 lines not on this page · raw message
drivers/md/raid10.h new file +123 -0
123 lines not on this page · raw message
include/linux/raid/raid0.h deleted +0 -30
@@ -1,30 +0,0 @@ -#ifndef _RAID0_H -#define _RAID0_H - -#include <linux/raid/md.h> - -struct strip_zone -{ -sector_t zone_start;/* Zone offset in md_dev (in sectors) */ -sector_t dev_start;/* Zone offset in real dev (in sectors) */ -sector_t sectors;/* Zone size in sectors */ -int nb_dev;/* # of devices attached to the zone */ -mdk_rdev_t **dev;/* Devices attached to the zone */ -}; - -struct raid0_private_data -{ -struct strip_zone **hash_table;/* Table of indexes into strip_zone */ -struct strip_zone *strip_zone; -mdk_rdev_t **devlist;/* lists of rdevs, pointed to by strip_zone->dev */ -int nr_strip_zones; - -sector_t spacing; -int sector_shift;/* shift this before divide by spacing */ -}; - -typedef struct raid0_private_data raid0_conf_t ; - -#define mddev_to_conf (mddev) ((raid0_conf_t *) mddev->private) - -#endif
include/linux/raid/raid1.h deleted +0 -134
134 lines not on this page · raw message
include/linux/raid/raid10.h deleted +0 -123
123 lines not on this page · raw message
drivers/md/raid6.h +1 -1
@@ -19,7 +19,7 @@#define RAID6_USE_EMPTY_ZERO_PAGE 0#include <linux/raid/md.h> -#include <linux/raid/raid5.h> +#include "raid5.h" typedef raid5_conf_t raid6_conf_t ;/* Same configuration */
drivers/md/raid5.h new file +402 -0
402 lines not on this page · raw message
include/linux/raid/raid5.h deleted +0 -402
402 lines not on this page · raw message
Quoted 5 lines · On Tuesday March 3, [email protected] wrote:
Move the headers with the local structures for the disciplines and
bitmap.hintodrivers/md/so that they are more easily grepable for hacking and not far away.md.his left where it is for now as there are some uses from the outside.
I really like this, thanks. I much prefer having the includes with the C files where they are truly local.
I've added a few patches to move md_k.h into drivers/md as well. I'll include them below for reference.
Thanks,
NeilBrown
From d87d4c82e921ed4aa7d458027bac66a9e18cd48f Mon Sep 17 00:00:00 2001
From: NeilBrown <[email protected]>
Date: Thu, 5 Mar 2009 13:15:51 +1100
Subject: [PATCH 1/4] md: move LEVEL_* definition from md_k.h to md_u.h
.. as they are part of the user-space interface.
--- include/linux/raid/md_k.h | 10 ---------- include/linux/raid/md_u.h | 11 +++++++++++ 2 files changed, 11 insertions(+), 10 deletions(-)
include/linux/raid/md_k.h +0 -10
@@ -20,16 +20,6 @@#ifdef CONFIG_BLOCK -#define LEVEL_MULTIPATH (-4) -#define LEVEL_LINEAR (-1) -#define LEVEL_FAULTY (-5) - -/* we need a value for 'no level specified' and 0 -* means 'raid0', so we need something else. This is -* for internal use only -*/ -#define LEVEL_NONE (-1000000) -#define MaxSector (~(sector_t)0)typedef struct mddev_s mddev_t ;
include/linux/raid/md_u.h +11 -0
@@ -85,6 +85,17 @@ typedef struct mdu_array_info_s { } mdu_array_info_t; +/* non-obvious values for 'level' */ +#define LEVEL_MULTIPATH (-4) +#define LEVEL_LINEAR (-1) +#define LEVEL_FAULTY (-5) + +/* we need a value for 'no level specified' and 0 +* means 'raid0', so we need something else. This is +* for internal use only +*/ +#define LEVEL_NONE (-1000000) + typedef struct mdu_disk_info_s { /* * configuration/status of one particular disk
Signature · 16 lines
1.6.1.3 From 41dccc10f5bf63984379562c3b84e56c33003c71 Mon Sep 17 00:00:00 2001 From: NeilBrown <[email protected]> Date: Thu, 5 Mar 2009 13:16:39 +1100 Subject: [PATCH 2/4] md: move extern function definition from md.h to md_k.h because they really are kernel-internal definition. This will make it possible to move md_k.h into drivers/md/ Signed-off-by: NeilBrown <[email protected]> --- include/linux/raid/md.h | 22 ---------------------- include/linux/raid/md_k.h | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 22 deletions(-)
include/linux/raid/md.h +0 -22
@@ -54,28 +54,6 @@extern int mdp_major; -extern int register_md_personality (struct mdk_personality *p); -extern int unregister_md_personality (struct mdk_personality *p); -extern mdk_thread_t *md_register_thread (void (*run) (mddev_t *mddev), -mddev_t *mddev,const char *name); -extern void md_unregister_thread (mdk_thread_t *thread); -extern void md_wakeup_thread (mdk_thread_t *thread); -extern void md_check_recovery (mddev_t *mddev); -extern void md_write_start (mddev_t *mddev,struct bio *bi); -extern void md_write_end (mddev_t *mddev); -extern void md_done_sync (mddev_t *mddev,int blocks,int ok); -extern void md_error (mddev_t *mddev,mdk_rdev_t *rdev); - -extern void md_super_write (mddev_t *mddev,mdk_rdev_t *rdev, -sector_t sector,int size,struct page *page); -extern void md_super_wait (mddev_t *mddev); -extern int sync_page_io (struct block_device *bdev,sector_t sector,int size, -struct page *page,int rw); -extern void md_do_sync (mddev_t *mddev); -extern void md_new_event (mddev_t *mddev); -extern int md_allow_write (mddev_t *mddev); -extern void md_wait_for_blocked_rdev (mdk_rdev_t *rdev,mddev_t *mddev); -#endif /* CONFIG_MD */ #endif
include/linux/raid/md_k.h +22 -0
@@ -390,3 +390,25 @@ static inline void safe_put_page(struct page *p)#endif /* CONFIG_BLOCK */ #endif + +extern int register_md_personality (struct mdk_personality *p); +extern int unregister_md_personality (struct mdk_personality *p); +extern mdk_thread_t *md_register_thread (void (*run) (mddev_t *mddev), +mddev_t *mddev,const char *name); +extern void md_unregister_thread (mdk_thread_t *thread); +extern void md_wakeup_thread (mdk_thread_t *thread); +extern void md_check_recovery (mddev_t *mddev); +extern void md_write_start (mddev_t *mddev,struct bio *bi); +extern void md_write_end (mddev_t *mddev); +extern void md_done_sync (mddev_t *mddev,int blocks,int ok); +extern void md_error (mddev_t *mddev,mdk_rdev_t *rdev); + +extern void md_super_write (mddev_t *mddev,mdk_rdev_t *rdev, +sector_t sector,int size,struct page *page); +extern void md_super_wait (mddev_t *mddev); +extern int sync_page_io (struct block_device *bdev,sector_t sector,int size, +struct page *page,int rw); +extern void md_do_sync (mddev_t *mddev); +extern void md_new_event (mddev_t *mddev); +extern int md_allow_write (mddev_t *mddev); +extern void md_wait_for_blocked_rdev (mdk_rdev_t *rdev,mddev_t *mddev);
Signature · 32 lines
1.6.1.3 From c8ef31f0afb1933a3c6a1d185b12e6809c42ce43 Mon Sep 17 00:00:00 2001 From: NeilBrown <[email protected]> Date: Thu, 5 Mar 2009 13:34:23 +1100 Subject: [PATCH 3/4] md: move lots of #include lines out of .h files and into .c This makes the includes more explicit, and is preparation for moving md_k.h to drivers/md/ Signed-off-by: NeilBrown <[email protected]> --- drivers/md/bitmap.c | 2 ++ drivers/md/faulty.c | 3 +++ drivers/md/linear.c | 4 ++++ drivers/md/linear.h | 2 -- drivers/md/md.c | 5 +++++ drivers/md/multipath.c | 4 ++++ drivers/md/multipath.h | 2 -- drivers/md/raid0.c | 4 ++++ drivers/md/raid0.h | 2 -- drivers/md/raid1.c | 5 ++++- drivers/md/raid1.h | 2 -- drivers/md/raid10.c | 6 ++++-- drivers/md/raid10.h | 2 -- drivers/md/raid5.c | 4 ++++ drivers/md/raid5.h | 1 - drivers/md/raid6.h | 3 ++- include/linux/raid/md.h | 4 ---- init/do_mounts.h | 1 + 18 files changed, 37 insertions(+), 19 deletions(-)
drivers/md/bitmap.c +2 -0
@@ -16,6 +16,7 @@* wait if count gets too high, wake when it drops to half. */ +#include <linux/blkdev.h> #include <linux/module.h> #include <linux/errno.h> #include <linux/slab.h>
@@ -27,6 +28,7 @@#include <linux/mount.h> #include <linux/buffer_head.h> #include <linux/raid/md.h> +#include <linux/raid/md_k.h> #include "bitmap.h" /* debug macros */
drivers/md/faulty.c +3 -0
@@ -62,7 +62,10 @@#define ModeShift 5#define MaxFault 50 +#include <linux/blkdev.h> #include <linux/raid/md.h> +#include <linux/raid/md_k.h> +#include <linux/seq_file.h> static void faulty_fail (struct bio *bio,int error)
drivers/md/linear.c +4 -0
@@ -16,6 +16,10 @@Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <linux/blkdev.h> +#include <linux/raid/md.h> +#include <linux/raid/md_k.h> +#include <linux/seq_file.h> #include "linear.h" /*
drivers/md/linear.h +0 -2
@@ -1,8 +1,6 @@ #ifndef _LINEAR_H #define _LINEAR_H -#include <linux/raid/md.h> - struct dev_info { mdk_rdev_t *rdev; sector_t num_sectors;
drivers/md/md.c +5 -0
@@ -33,8 +33,10 @@*/ #include <linux/kthread.h> +#include <linux/blkdev.h> #include <linux/raid/md.h> #include <linux/sysctl.h> +#include <linux/seq_file.h> #include <linux/buffer_head.h> /* for invalidate_bdev */ #include <linux/poll.h> #include <linux/ctype.h>
@@ -44,6 +46,9 @@#include <linux/reboot.h> #include <linux/file.h> #include <linux/delay.h> +#include <linux/raid/md_k.h> +#include <linux/raid/md_p.h> +#include <linux/raid/md_u.h> #include "bitmap.h" /* 63 partitions with the alternate major number (mdp) */
drivers/md/multipath.c +4 -0
@@ -19,6 +19,10 @@* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <linux/blkdev.h> +#include <linux/raid/md.h> +#include <linux/raid/md_k.h> +#include <linux/seq_file.h> #include "multipath.h" #define MAX_WORK_PER_DISK 128
drivers/md/multipath.h +0 -2
@@ -1,8 +1,6 @@#ifndef _MULTIPATH_H#define _MULTIPATH_H -#include <linux/raid/md.h> -struct multipath_info {mdk_rdev_t *rdev; };
drivers/md/raid0.c +4 -0
@@ -18,6 +18,10 @@Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <linux/blkdev.h> +#include <linux/raid/md.h> +#include <linux/raid/md_k.h> +#include <linux/seq_file.h> #include "raid0.h" static void raid0_unplug (struct request_queue *q)
drivers/md/raid0.h +0 -2
@@ -1,8 +1,6 @@ #ifndef _RAID0_H #define _RAID0_H -#include <linux/raid/md.h> - struct strip_zone { sector_t zone_start; /* Zone offset in md_dev (in sectors) */
drivers/md/raid1.c +4 -1
@@ -31,8 +31,11 @@* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "dm-bio-list.h" #include <linux/delay.h> +#include <linux/blkdev.h> +#include <linux/raid/md.h> +#include <linux/raid/md_k.h> +#include <linux/seq_file.h> #include "raid1.h" #include "bitmap.h"
drivers/md/raid1.h +0 -2
@@ -1,8 +1,6 @@#ifndef _RAID1_H#define _RAID1_H -#include <linux/raid/md.h> -typedef struct mirror_info mirror_info_t ; struct mirror_info {
drivers/md/raid10.c +4 -2
@@ -18,8 +18,10 @@* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "dm-bio-list.h" -#include <linux/delay.h> +#include <linux/blkdev.h> +#include <linux/raid/md.h> +#include <linux/raid/md_k.h> +#include <linux/seq_file.h> #include "raid10.h" #include "bitmap.h"
drivers/md/raid10.h +0 -2
@@ -1,8 +1,6 @@#ifndef _RAID10_H#define _RAID10_H -#include <linux/raid/md.h> -typedef struct mirror_info mirror_info_t ; struct mirror_info {
drivers/md/raid5.c +4 -0
@@ -43,8 +43,12 @@* miss any bits. */ +#include <linux/blkdev.h> +#include <linux/raid/md.h> +#include <linux/raid/md_k.h> #include <linux/kthread.h> #include <linux/async_tx.h> +#include <linux/seq_file.h> #include "raid6.h" #include "bitmap.h"
drivers/md/raid5.h +0 -1
@@ -1,7 +1,6 @@#ifndef _RAID5_H#define _RAID5_H -#include <linux/raid/md.h> #include <linux/raid/xor.h> /*
drivers/md/raid6.h +2 -1
@@ -17,8 +17,9 @@/* Set to 1 to use kernel-wide empty_zero_page */ #define RAID6_USE_EMPTY_ZERO_PAGE 0 - +#include <linux/blkdev.h> #include <linux/raid/md.h> +#include <linux/raid/md_k.h> #include "raid5.h" typedef raid5_conf_t raid6_conf_t ;/* Same configuration */
include/linux/raid/md.h +0 -4
@@ -18,9 +18,6 @@#ifndef _MD_H#define _MD_H -#include <linux/blkdev.h> -#include <linux/seq_file.h> -/* * 'md_p.h' holds the 'physical' layout of RAID devices * 'md_u.h' holds the user <=> kernel API
@@ -30,7 +27,6 @@#include <linux/raid/md_p.h> #include <linux/raid/md_u.h> -#include <linux/raid/md_k.h> #ifdef CONFIG_MD
init/do_mounts.h +1 -0
@@ -1,4 +1,5 @@#include <linux/kernel.h> +#include <linux/blkdev.h> #include <linux/init.h> #include <linux/syscalls.h> #include <linux/unistd.h>
Signature · 25 lines
1.6.1.3 From cf43f54136ccb85de844243b5c6ef1ef1c7ad196 Mon Sep 17 00:00:00 2001 From: NeilBrown <[email protected]> Date: Thu, 5 Mar 2009 13:38:47 +1100 Subject: [PATCH 4/4] md: move md_k.h from include/linux/raid/ to drivers/md/ It really is nicer to keep related code together.. Signed-off-by: NeilBrown <[email protected]> --- drivers/md/bitmap.c | 2 +- drivers/md/faulty.c | 2 +- drivers/md/linear.c | 2 +- drivers/md/md.c | 2 +- {include/linux/raid => drivers/md}/md_k.h | 0 drivers/md/multipath.c | 2 +- drivers/md/raid0.c | 2 +- drivers/md/raid1.c | 2 +- drivers/md/raid10.c | 2 +- drivers/md/raid5.c | 2 +- drivers/md/raid6.h | 2 +- 11 files changed, 10 insertions(+), 10 deletions(-) rename {include/linux/raid => drivers/md}/md_k.h (100%)
drivers/md/bitmap.c +1 -1
@@ -28,7 +28,7 @@#include <linux/mount.h> #include <linux/buffer_head.h> #include <linux/raid/md.h> -#include <linux/raid/md_k.h> +#include "md_k.h" #include "bitmap.h" /* debug macros */
drivers/md/faulty.c +1 -1
@@ -64,7 +64,7 @@#define MaxFault 50#include <linux/blkdev.h> #include <linux/raid/md.h> -#include <linux/raid/md_k.h> +#include "md_k.h" #include <linux/seq_file.h>
drivers/md/linear.c +1 -1
@@ -18,8 +18,8 @@#include <linux/blkdev.h> #include <linux/raid/md.h> -#include <linux/raid/md_k.h> #include <linux/seq_file.h> +#include "md_k.h" #include "linear.h" /*
drivers/md/md.c +1 -1
@@ -46,9 +46,9 @@#include <linux/reboot.h> #include <linux/file.h> #include <linux/delay.h> -#include <linux/raid/md_k.h> #include <linux/raid/md_p.h> #include <linux/raid/md_u.h> +#include "md_k.h" #include "bitmap.h" /* 63 partitions with the alternate major number (mdp) */
drivers/md/md_k.h renamed from include/linux/raid/md_k.h +0 -0
drivers/md/multipath.c +1 -1
@@ -21,8 +21,8 @@#include <linux/blkdev.h> #include <linux/raid/md.h> -#include <linux/raid/md_k.h> #include <linux/seq_file.h> +#include "md_k.h" #include "multipath.h" #define MAX_WORK_PER_DISK 128
drivers/md/raid0.c +1 -1
@@ -20,8 +20,8 @@#include <linux/blkdev.h> #include <linux/raid/md.h> -#include <linux/raid/md_k.h> #include <linux/seq_file.h> +#include "md_k.h" #include "raid0.h" static void raid0_unplug (struct request_queue *q)
drivers/md/raid1.c +1 -1
@@ -34,8 +34,8 @@#include <linux/delay.h> #include <linux/blkdev.h> #include <linux/raid/md.h> -#include <linux/raid/md_k.h> #include <linux/seq_file.h> +#include "md_k.h" #include "raid1.h" #include "bitmap.h"
drivers/md/raid10.c +1 -1
@@ -20,8 +20,8 @@#include <linux/blkdev.h> #include <linux/raid/md.h> -#include <linux/raid/md_k.h> #include <linux/seq_file.h> +#include "md_k.h" #include "raid10.h" #include "bitmap.h"
drivers/md/raid5.c +1 -1
@@ -45,10 +45,10 @@#include <linux/blkdev.h> #include <linux/raid/md.h> -#include <linux/raid/md_k.h> #include <linux/kthread.h> #include <linux/async_tx.h> #include <linux/seq_file.h> +#include "md_k.h" #include "raid6.h" #include "bitmap.h"
drivers/md/raid6.h +1 -1
@@ -19,7 +19,7 @@#define RAID6_USE_EMPTY_ZERO_PAGE 0#include <linux/blkdev.h> #include <linux/raid/md.h> -#include <linux/raid/md_k.h> +#include "md_k.h" #include "raid5.h" typedef raid5_conf_t raid6_conf_t ;/* Same configuration */
Signature · 1 line
1.6.1.3
Quoted 7 lines · Neil Brown
Quoted 5 lines · On Tuesday March 3, [email protected] wrote:
Move the headers with the local structures for the disciplines and
bitmap.hintodrivers/md/so that they are more easily grepable for hacking and not far away.md.his left where it is for now as there are some uses from the outside.
Quoted 5 lines
I really like this, thanks. I much prefer having the includes with the C files where they are truly local.
I've added a few patches to move
md_k.hintodrivers/mdas well. I'll include them below for reference.
Btw, I think md_k.h should just be named md.h after that move, and the old md.h in include/linux/raid/ should just go away once all the function declarations & co are moved out.
Quoted 634 lines
Thanks,
NeilBrownQuoted 1 line
From
d87d4c82e921ed4aa7d458027bac66a9e18cd48fMon Sep 17 00:00:00 2001From: NeilBrown <[email protected]>
Date: Thu, 5 Mar 2009 13:15:51 +1100
Subject: [PATCH 1/4] md: move LEVEL_* definition frommd_k.htomd_u.h.. as they are part of the user-space interface.
Signed-off-by NeilBrown <[email protected]>--- include/linux/raid/md_k.h | 10 ---------- include/linux/raid/md_u.h | 11 +++++++++++ 2 files changed, 11 insertions(+), 10 deletions(-)include/linux/raid/md_k.h +0
-10@@ -20,16 +20,6 @@#ifdef CONFIG_BLOCK -#define LEVEL_MULTIPATH (-4) -#define LEVEL_LINEAR (-1) -#define LEVEL_FAULTY (-5) - -/* we need a value for 'no level specified' and 0 -* means 'raid0', so we need something else. This is -* for internal use only -*/ -#define LEVEL_NONE (-1000000) -#define MaxSector (~(sector_t)0)typedef struct mddev_s mddev_t ;include/linux/raid/md_u.h +11
-0@@ -85,6 +85,17 @@ typedef struct mdu_array_info_s { } mdu_array_info_t; +/* non-obvious values for 'level' */ +#define LEVEL_MULTIPATH (-4) +#define LEVEL_LINEAR (-1) +#define LEVEL_FAULTY (-5) + +/* we need a value for 'no level specified' and 0 +* means 'raid0', so we need something else. This is +* for internal use only +*/ +#define LEVEL_NONE (-1000000) + typedef struct mdu_disk_info_s { /* * configuration/status of one particular diskSignature · 1 line
1.6.1.3Quoted 1 line
From
41dccc10f5bf63984379562c3b84e56c33003c71Mon Sep 17 00:00:00 2001From: NeilBrown <[email protected]>
Date: Thu, 5 Mar 2009 13:16:39 +1100
Subject: [PATCH 2/4] md: move extern function definition frommd.htomd_k.hbecause they really are kernel-internal definition. This will make it possible to move
md_k.hintodrivers/md/Signed-off-by NeilBrown <[email protected]>--- include/linux/raid/md.h | 22 ---------------------- include/linux/raid/md_k.h | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 22 deletions(-)include/linux/raid/md.h +0
-22@@ -54,28 +54,6 @@extern int mdp_major; -extern int register_md_personality (struct mdk_personality *p); -extern int unregister_md_personality (struct mdk_personality *p); -extern mdk_thread_t *md_register_thread (void (*run) (mddev_t *mddev), -mddev_t *mddev,const char *name); -extern void md_unregister_thread (mdk_thread_t *thread); -extern void md_wakeup_thread (mdk_thread_t *thread); -extern void md_check_recovery (mddev_t *mddev); -extern void md_write_start (mddev_t *mddev,struct bio *bi); -extern void md_write_end (mddev_t *mddev); -extern void md_done_sync (mddev_t *mddev,int blocks,int ok); -extern void md_error (mddev_t *mddev,mdk_rdev_t *rdev); - -extern void md_super_write (mddev_t *mddev,mdk_rdev_t *rdev, -sector_t sector,int size,struct page *page); -extern void md_super_wait (mddev_t *mddev); -extern int sync_page_io (struct block_device *bdev,sector_t sector,int size, -struct page *page,int rw); -extern void md_do_sync (mddev_t *mddev); -extern void md_new_event (mddev_t *mddev); -extern int md_allow_write (mddev_t *mddev); -extern void md_wait_for_blocked_rdev (mdk_rdev_t *rdev,mddev_t *mddev); -#endif /* CONFIG_MD */ #endif include/linux/raid/md_k.h +22
-0@@ -390,3 +390,25 @@ static inline void safe_put_page(struct page *p)#endif /* CONFIG_BLOCK */ #endif + +extern int register_md_personality (struct mdk_personality *p); +extern int unregister_md_personality (struct mdk_personality *p); +extern mdk_thread_t *md_register_thread (void (*run) (mddev_t *mddev), +mddev_t *mddev,const char *name); +extern void md_unregister_thread (mdk_thread_t *thread); +extern void md_wakeup_thread (mdk_thread_t *thread); +extern void md_check_recovery (mddev_t *mddev); +extern void md_write_start (mddev_t *mddev,struct bio *bi); +extern void md_write_end (mddev_t *mddev); +extern void md_done_sync (mddev_t *mddev,int blocks,int ok); +extern void md_error (mddev_t *mddev,mdk_rdev_t *rdev); + +extern void md_super_write (mddev_t *mddev,mdk_rdev_t *rdev, +sector_t sector,int size,struct page *page); +extern void md_super_wait (mddev_t *mddev); +extern int sync_page_io (struct block_device *bdev,sector_t sector,int size, +struct page *page,int rw); +extern void md_do_sync (mddev_t *mddev); +extern void md_new_event (mddev_t *mddev); +extern int md_allow_write (mddev_t *mddev); +extern void md_wait_for_blocked_rdev (mdk_rdev_t *rdev,mddev_t *mddev);Signature · 1 line
1.6.1.3Quoted 1 line
From
c8ef31f0afb1933a3c6a1d185b12e6809c42ce43Mon Sep 17 00:00:00 2001From: NeilBrown <[email protected]>
Date: Thu, 5 Mar 2009 13:34:23 +1100
Subject: [PATCH 3/4] md: move lots of #include lines out of .h files and into .cThis makes the includes more explicit, and is preparation for moving
md_k.htodrivers/md/Signed-off-by NeilBrown <[email protected]>--- drivers/md/bitmap.c | 2 ++ drivers/md/faulty.c | 3 +++ drivers/md/linear.c | 4 ++++ drivers/md/linear.h | 2 -- drivers/md/md.c | 5 +++++ drivers/md/multipath.c | 4 ++++ drivers/md/multipath.h | 2 -- drivers/md/raid0.c | 4 ++++ drivers/md/raid0.h | 2 -- drivers/md/raid1.c | 5 ++++- drivers/md/raid1.h | 2 -- drivers/md/raid10.c | 6 ++++-- drivers/md/raid10.h | 2 -- drivers/md/raid5.c | 4 ++++ drivers/md/raid5.h | 1 - drivers/md/raid6.h | 3 ++- include/linux/raid/md.h | 4 ---- init/do_mounts.h | 1 + 18 files changed, 37 insertions(+), 19 deletions(-)drivers/md/bitmap.c +2
-0@@ -16,6 +16,7 @@* wait if count gets too high, wake when it drops to half. */ +#include <linux/blkdev.h> #include <linux/module.h> #include <linux/errno.h> #include <linux/slab.h> @@ -27,6 +28,7 @@#include <linux/mount.h> #include <linux/buffer_head.h> #include <linux/raid/md.h> +#include <linux/raid/md_k.h> #include "bitmap.h" /* debug macros */ drivers/md/faulty.c +3
-0@@ -62,7 +62,10 @@#define ModeShift 5#define MaxFault 50 +#include <linux/blkdev.h> #include <linux/raid/md.h> +#include <linux/raid/md_k.h> +#include <linux/seq_file.h> static void faulty_fail (struct bio *bio,int error)drivers/md/linear.c +4
-0@@ -16,6 +16,10 @@Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <linux/blkdev.h> +#include <linux/raid/md.h> +#include <linux/raid/md_k.h> +#include <linux/seq_file.h> #include "linear.h" /* drivers/md/linear.h +0
-2@@ -1,8 +1,6 @@ #ifndef _LINEAR_H #define _LINEAR_H -#include <linux/raid/md.h> - struct dev_info { mdk_rdev_t *rdev; sector_t num_sectors;drivers/md/md.c +5
-0@@ -33,8 +33,10 @@*/ #include <linux/kthread.h> +#include <linux/blkdev.h> #include <linux/raid/md.h> #include <linux/sysctl.h> +#include <linux/seq_file.h> #include <linux/buffer_head.h> /* for invalidate_bdev */ #include <linux/poll.h> #include <linux/ctype.h> @@ -44,6 +46,9 @@#include <linux/reboot.h> #include <linux/file.h> #include <linux/delay.h> +#include <linux/raid/md_k.h> +#include <linux/raid/md_p.h> +#include <linux/raid/md_u.h> #include "bitmap.h" /* 63 partitions with the alternate major number (mdp) */ drivers/md/multipath.c +4
-0@@ -19,6 +19,10 @@* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <linux/blkdev.h> +#include <linux/raid/md.h> +#include <linux/raid/md_k.h> +#include <linux/seq_file.h> #include "multipath.h" #define MAX_WORK_PER_DISK 128drivers/md/multipath.h +0
-2@@ -1,8 +1,6 @@#ifndef _MULTIPATH_H#define _MULTIPATH_H -#include <linux/raid/md.h> -struct multipath_info {mdk_rdev_t *rdev; };drivers/md/raid0.c +4
-0@@ -18,6 +18,10 @@Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <linux/blkdev.h> +#include <linux/raid/md.h> +#include <linux/raid/md_k.h> +#include <linux/seq_file.h> #include "raid0.h" static void raid0_unplug (struct request_queue *q)drivers/md/raid0.h +0
-2@@ -1,8 +1,6 @@ #ifndef _RAID0_H #define _RAID0_H -#include <linux/raid/md.h> - struct strip_zone { sector_t zone_start; /* Zone offset in md_dev (in sectors) */drivers/md/raid1.c +4
-1@@ -31,8 +31,11 @@* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "dm-bio-list.h" #include <linux/delay.h> +#include <linux/blkdev.h> +#include <linux/raid/md.h> +#include <linux/raid/md_k.h> +#include <linux/seq_file.h> #include "raid1.h" #include "bitmap.h" drivers/md/raid1.h +0
-2@@ -1,8 +1,6 @@#ifndef _RAID1_H#define _RAID1_H -#include <linux/raid/md.h> -typedef struct mirror_info mirror_info_t ; struct mirror_info {drivers/md/raid10.c +4
-2@@ -18,8 +18,10 @@* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "dm-bio-list.h" -#include <linux/delay.h> +#include <linux/blkdev.h> +#include <linux/raid/md.h> +#include <linux/raid/md_k.h> +#include <linux/seq_file.h> #include "raid10.h" #include "bitmap.h" drivers/md/raid10.h +0
-2@@ -1,8 +1,6 @@#ifndef _RAID10_H#define _RAID10_H -#include <linux/raid/md.h> -typedef struct mirror_info mirror_info_t ; struct mirror_info {drivers/md/raid5.c +4
-0@@ -43,8 +43,12 @@* miss any bits. */ +#include <linux/blkdev.h> +#include <linux/raid/md.h> +#include <linux/raid/md_k.h> #include <linux/kthread.h> #include <linux/async_tx.h> +#include <linux/seq_file.h> #include "raid6.h" #include "bitmap.h" drivers/md/raid5.h +0
-1@@ -1,7 +1,6 @@#ifndef _RAID5_H#define _RAID5_H -#include <linux/raid/md.h> #include <linux/raid/xor.h> /* drivers/md/raid6.h +2
-1@@ -17,8 +17,9 @@/* Set to 1 to use kernel-wide empty_zero_page */ #define RAID6_USE_EMPTY_ZERO_PAGE 0 - +#include <linux/blkdev.h> #include <linux/raid/md.h> +#include <linux/raid/md_k.h> #include "raid5.h" typedef raid5_conf_t raid6_conf_t ;/* Same configuration */ include/linux/raid/md.h +0
-4@@ -18,9 +18,6 @@#ifndef _MD_H#define _MD_H -#include <linux/blkdev.h> -#include <linux/seq_file.h> -/* * 'md_p.h' holds the 'physical' layout of RAID devices * 'md_u.h' holds the user <=> kernel API @@ -30,7 +27,6 @@#include <linux/raid/md_p.h> #include <linux/raid/md_u.h> -#include <linux/raid/md_k.h> #ifdef CONFIG_MD init/do_mounts.h +1
-0@@ -1,4 +1,5 @@#include <linux/kernel.h> +#include <linux/blkdev.h> #include <linux/init.h> #include <linux/syscalls.h> #include <linux/unistd.h> Signature · 1 line
1.6.1.3Quoted 1 line
From
cf43f54136ccb85de844243b5c6ef1ef1c7ad196Mon Sep 17 00:00:00 2001From: NeilBrown <[email protected]>
Date: Thu, 5 Mar 2009 13:38:47 +1100
Subject: [PATCH 4/4] md: movemd_k.hfrominclude/linux/raid/todrivers/md/It really is nicer to keep related code together..
Signed-off-by NeilBrown <[email protected]>--- drivers/md/bitmap.c | 2 +- drivers/md/faulty.c | 2 +- drivers/md/linear.c | 2 +- drivers/md/md.c | 2 +- {include/linux/raid => drivers/md}/md_k.h | 0 drivers/md/multipath.c | 2 +- drivers/md/raid0.c | 2 +- drivers/md/raid1.c | 2 +- drivers/md/raid10.c | 2 +- drivers/md/raid5.c | 2 +- drivers/md/raid6.h | 2 +- 11 files changed, 10 insertions(+), 10 deletions(-) rename {include/linux/raid => drivers/md}/md_k.h (100%)drivers/md/bitmap.c +1
-1@@ -28,7 +28,7 @@#include <linux/mount.h> #include <linux/buffer_head.h> #include <linux/raid/md.h> -#include <linux/raid/md_k.h> +#include "md_k.h" #include "bitmap.h" /* debug macros */ drivers/md/faulty.c +1
-1@@ -64,7 +64,7 @@#define MaxFault 50#include <linux/blkdev.h> #include <linux/raid/md.h> -#include <linux/raid/md_k.h> +#include "md_k.h" #include <linux/seq_file.h> drivers/md/linear.c +1
-1@@ -18,8 +18,8 @@#include <linux/blkdev.h> #include <linux/raid/md.h> -#include <linux/raid/md_k.h> #include <linux/seq_file.h> +#include "md_k.h" #include "linear.h" /* drivers/md/md.c +1
-1@@ -46,9 +46,9 @@#include <linux/reboot.h> #include <linux/file.h> #include <linux/delay.h> -#include <linux/raid/md_k.h> #include <linux/raid/md_p.h> #include <linux/raid/md_u.h> +#include "md_k.h" #include "bitmap.h" /* 63 partitions with the alternate major number (mdp) */ drivers/md/md_k.h renamed from include/linux/raid/md_k.h +0
-0drivers/md/multipath.c +1
-1@@ -21,8 +21,8 @@#include <linux/blkdev.h> #include <linux/raid/md.h> -#include <linux/raid/md_k.h> #include <linux/seq_file.h> +#include "md_k.h" #include "multipath.h" #define MAX_WORK_PER_DISK 128drivers/md/raid0.c +1
-1@@ -20,8 +20,8 @@#include <linux/blkdev.h> #include <linux/raid/md.h> -#include <linux/raid/md_k.h> #include <linux/seq_file.h> +#include "md_k.h" #include "raid0.h" static void raid0_unplug (struct request_queue *q)drivers/md/raid1.c +1
-1@@ -34,8 +34,8 @@#include <linux/delay.h> #include <linux/blkdev.h> #include <linux/raid/md.h> -#include <linux/raid/md_k.h> #include <linux/seq_file.h> +#include "md_k.h" #include "raid1.h" #include "bitmap.h" drivers/md/raid10.c +1
-1@@ -20,8 +20,8 @@#include <linux/blkdev.h> #include <linux/raid/md.h> -#include <linux/raid/md_k.h> #include <linux/seq_file.h> +#include "md_k.h" #include "raid10.h" #include "bitmap.h" drivers/md/raid5.c +1
-1@@ -45,10 +45,10 @@#include <linux/blkdev.h> #include <linux/raid/md.h> -#include <linux/raid/md_k.h> #include <linux/kthread.h> #include <linux/async_tx.h> #include <linux/seq_file.h> +#include "md_k.h" #include "raid6.h" #include "bitmap.h" drivers/md/raid6.h +1
-1@@ -19,7 +19,7 @@#define RAID6_USE_EMPTY_ZERO_PAGE 0#include <linux/blkdev.h> #include <linux/raid/md.h> -#include <linux/raid/md_k.h> +#include "md_k.h" #include "raid5.h" typedef raid5_conf_t raid6_conf_t ;/* Same configuration */ Signature · 6 lines
1.6.1.3 -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
---end quoted text---
Quoted 11 lines · On Thursday March 5, [email protected] wrote:
Quoted 10 lines · Neil Brown
Quoted 5 lines · On Tuesday March 3, [email protected] wrote:
Move the headers with the local structures for the disciplines and
bitmap.hintodrivers/md/so that they are more easily grepable for hacking and not far away.md.his left where it is for now as there are some uses from the outside.I really like this, thanks. I much prefer having the includes with the C files where they are truly local.
Quoted 7 lines
Quoted 2 lines
I've added a few patches to move
md_k.hintodrivers/mdas well. I'll include them below for reference.Btw, I think
md_k.hshould just be namedmd.hafter that move, and the oldmd.hininclude/linux/raid/should just go away once all the function declarations & co are moved out.
Yes, of course.
That makes it much tidier.
All done and pushed to git://neil.brown.name/md for-next to be picked up by -next on Monday I guess.
Thanks!
NeilBrown