@@ -298,9 +298,6 @@ extern void disk_part_iter_init(struct disk_part_iter *piter,
298298extern struct hd_struct * disk_part_iter_next (struct disk_part_iter * piter );
299299extern void disk_part_iter_exit (struct disk_part_iter * piter );
300300
301- extern struct hd_struct * disk_map_sector_rcu (struct gendisk * disk ,
302- sector_t sector );
303-
304301/*
305302 * Macros to operate on percpu disk statistics:
306303 *
@@ -409,13 +406,6 @@ static inline void free_part_stats(struct hd_struct *part)
409406#define part_stat_local_read_cpu (gendiskp , field , cpu ) \
410407 local_read(&(part_stat_get_cpu(gendiskp, field, cpu)))
411408
412- void part_dec_in_flight (struct request_queue * q , struct hd_struct * part ,
413- int rw );
414- void part_inc_in_flight (struct request_queue * q , struct hd_struct * part ,
415- int rw );
416-
417- void update_io_ticks (struct hd_struct * part , unsigned long now , bool end );
418-
419409/* block/genhd.c */
420410extern void device_add_disk (struct device * parent , struct gendisk * disk ,
421411 const struct attribute_group * * groups );
@@ -465,27 +455,11 @@ static inline void set_capacity(struct gendisk *disk, sector_t size)
465455 disk -> part0 .nr_sects = size ;
466456}
467457
468- #define ADDPART_FLAG_NONE 0
469- #define ADDPART_FLAG_RAID 1
470- #define ADDPART_FLAG_WHOLEDISK 2
471-
472- extern int blk_alloc_devt (struct hd_struct * part , dev_t * devt );
473- extern void blk_free_devt (dev_t devt );
474- extern void blk_invalidate_devt (dev_t devt );
475458extern dev_t blk_lookup_devt (const char * name , int partno );
476- extern char * disk_name (struct gendisk * hd , int partno , char * buf );
477459
478460int bdev_disk_changed (struct block_device * bdev , bool invalidate );
479461int blk_add_partitions (struct gendisk * disk , struct block_device * bdev );
480462int blk_drop_partitions (struct gendisk * disk , struct block_device * bdev );
481- extern int disk_expand_part_tbl (struct gendisk * disk , int target );
482- extern struct hd_struct * __must_check add_partition (struct gendisk * disk ,
483- int partno , sector_t start ,
484- sector_t len , int flags ,
485- struct partition_meta_info
486- * info );
487- extern void __delete_partition (struct percpu_ref * );
488- extern void delete_partition (struct gendisk * , int );
489463extern void printk_all_partitions (void );
490464
491465extern struct gendisk * __alloc_disk_node (int minors , int node_id );
@@ -517,100 +491,6 @@ extern void blk_unregister_region(dev_t devt, unsigned long range);
517491
518492#define alloc_disk (minors ) alloc_disk_node(minors, NUMA_NO_NODE)
519493
520- static inline int hd_ref_init (struct hd_struct * part )
521- {
522- if (percpu_ref_init (& part -> ref , __delete_partition , 0 ,
523- GFP_KERNEL ))
524- return - ENOMEM ;
525- return 0 ;
526- }
527-
528- static inline void hd_struct_get (struct hd_struct * part )
529- {
530- percpu_ref_get (& part -> ref );
531- }
532-
533- static inline int hd_struct_try_get (struct hd_struct * part )
534- {
535- return percpu_ref_tryget_live (& part -> ref );
536- }
537-
538- static inline void hd_struct_put (struct hd_struct * part )
539- {
540- percpu_ref_put (& part -> ref );
541- }
542-
543- static inline void hd_struct_kill (struct hd_struct * part )
544- {
545- percpu_ref_kill (& part -> ref );
546- }
547-
548- static inline void hd_free_part (struct hd_struct * part )
549- {
550- free_part_stats (part );
551- kfree (part -> info );
552- percpu_ref_exit (& part -> ref );
553- }
554-
555- /*
556- * Any access of part->nr_sects which is not protected by partition
557- * bd_mutex or gendisk bdev bd_mutex, should be done using this
558- * accessor function.
559- *
560- * Code written along the lines of i_size_read() and i_size_write().
561- * CONFIG_PREEMPTION case optimizes the case of UP kernel with preemption
562- * on.
563- */
564- static inline sector_t part_nr_sects_read (struct hd_struct * part )
565- {
566- #if BITS_PER_LONG == 32 && defined(CONFIG_SMP )
567- sector_t nr_sects ;
568- unsigned seq ;
569- do {
570- seq = read_seqcount_begin (& part -> nr_sects_seq );
571- nr_sects = part -> nr_sects ;
572- } while (read_seqcount_retry (& part -> nr_sects_seq , seq ));
573- return nr_sects ;
574- #elif BITS_PER_LONG == 32 && defined(CONFIG_PREEMPTION )
575- sector_t nr_sects ;
576-
577- preempt_disable ();
578- nr_sects = part -> nr_sects ;
579- preempt_enable ();
580- return nr_sects ;
581- #else
582- return part -> nr_sects ;
583- #endif
584- }
585-
586- /*
587- * Should be called with mutex lock held (typically bd_mutex) of partition
588- * to provide mutual exlusion among writers otherwise seqcount might be
589- * left in wrong state leaving the readers spinning infinitely.
590- */
591- static inline void part_nr_sects_write (struct hd_struct * part , sector_t size )
592- {
593- #if BITS_PER_LONG == 32 && defined(CONFIG_SMP )
594- write_seqcount_begin (& part -> nr_sects_seq );
595- part -> nr_sects = size ;
596- write_seqcount_end (& part -> nr_sects_seq );
597- #elif BITS_PER_LONG == 32 && defined(CONFIG_PREEMPTION )
598- preempt_disable ();
599- part -> nr_sects = size ;
600- preempt_enable ();
601- #else
602- part -> nr_sects = size ;
603- #endif
604- }
605-
606- #if defined(CONFIG_BLK_DEV_INTEGRITY )
607- extern void blk_integrity_add (struct gendisk * );
608- extern void blk_integrity_del (struct gendisk * );
609- #else /* CONFIG_BLK_DEV_INTEGRITY */
610- static inline void blk_integrity_add (struct gendisk * disk ) { }
611- static inline void blk_integrity_del (struct gendisk * disk ) { }
612- #endif /* CONFIG_BLK_DEV_INTEGRITY */
613-
614494#else /* CONFIG_BLOCK */
615495
616496static inline void printk_all_partitions (void ) { }
0 commit comments