Merge branch 'master' into for-linus
Conflicts: include/linux/percpu.h mm/percpu.c
This commit is contained in:
@@ -118,7 +118,6 @@ header-y += eventpoll.h
|
||||
header-y += ext2_fs.h
|
||||
header-y += fadvise.h
|
||||
header-y += falloc.h
|
||||
header-y += fanotify.h
|
||||
header-y += fb.h
|
||||
header-y += fcntl.h
|
||||
header-y += fd.h
|
||||
@@ -302,6 +301,7 @@ header-y += quota.h
|
||||
header-y += radeonfb.h
|
||||
header-y += random.h
|
||||
header-y += raw.h
|
||||
header-y += rds.h
|
||||
header-y += reboot.h
|
||||
header-y += reiserfs_fs.h
|
||||
header-y += reiserfs_xattr.h
|
||||
|
||||
@@ -25,8 +25,6 @@ static inline u32 acpi_pm_read_early(void)
|
||||
return acpi_pm_read_verified() & ACPI_PM_MASK;
|
||||
}
|
||||
|
||||
extern void pmtimer_wait(unsigned);
|
||||
|
||||
#else
|
||||
|
||||
static inline u32 acpi_pm_read_early(void)
|
||||
|
||||
@@ -5,10 +5,15 @@
|
||||
#ifndef __ALTUART_H
|
||||
#define __ALTUART_H
|
||||
|
||||
#include <linux/init.h>
|
||||
|
||||
struct altera_uart_platform_uart {
|
||||
unsigned long mapbase; /* Physical address base */
|
||||
unsigned int irq; /* Interrupt vector */
|
||||
unsigned int uartclk; /* UART clock rate */
|
||||
unsigned int bus_shift; /* Bus shift (address stride) */
|
||||
};
|
||||
|
||||
int __init early_altera_uart_setup(struct altera_uart_platform_uart *platp);
|
||||
|
||||
#endif /* __ALTUART_H */
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <linux/resource.h>
|
||||
|
||||
#define AMBA_NR_IRQS 2
|
||||
#define AMBA_CID 0xb105f00d
|
||||
|
||||
struct clk;
|
||||
|
||||
@@ -70,9 +71,15 @@ void amba_release_regions(struct amba_device *);
|
||||
#define amba_pclk_disable(d) \
|
||||
do { if (!IS_ERR((d)->pclk)) clk_disable((d)->pclk); } while (0)
|
||||
|
||||
#define amba_config(d) (((d)->periphid >> 24) & 0xff)
|
||||
#define amba_rev(d) (((d)->periphid >> 20) & 0x0f)
|
||||
#define amba_manf(d) (((d)->periphid >> 12) & 0xff)
|
||||
#define amba_part(d) ((d)->periphid & 0xfff)
|
||||
/* Some drivers don't use the struct amba_device */
|
||||
#define AMBA_CONFIG_BITS(a) (((a) >> 24) & 0xff)
|
||||
#define AMBA_REV_BITS(a) (((a) >> 20) & 0x0f)
|
||||
#define AMBA_MANF_BITS(a) (((a) >> 12) & 0xff)
|
||||
#define AMBA_PART_BITS(a) ((a) & 0xfff)
|
||||
|
||||
#define amba_config(d) AMBA_CONFIG_BITS((d)->periphid)
|
||||
#define amba_rev(d) AMBA_REV_BITS((d)->periphid)
|
||||
#define amba_manf(d) AMBA_MANF_BITS((d)->periphid)
|
||||
#define amba_part(d) AMBA_PART_BITS((d)->periphid)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
* whether a card is present in the MMC slot or not
|
||||
* @gpio_wp: read this GPIO pin to see if the card is write protected
|
||||
* @gpio_cd: read this GPIO pin to detect card insertion
|
||||
* @cd_invert: true if the gpio_cd pin value is active low
|
||||
* @capabilities: the capabilities of the block as implemented in
|
||||
* this platform, signify anything MMC_CAP_* from mmc/host.h
|
||||
*/
|
||||
@@ -35,6 +36,7 @@ struct mmci_platform_data {
|
||||
unsigned int (*status)(struct device *);
|
||||
int gpio_wp;
|
||||
int gpio_cd;
|
||||
bool cd_invert;
|
||||
unsigned long capabilities;
|
||||
};
|
||||
|
||||
|
||||
@@ -228,6 +228,7 @@ enum ssp_chip_select {
|
||||
};
|
||||
|
||||
|
||||
struct dma_chan;
|
||||
/**
|
||||
* struct pl022_ssp_master - device.platform_data for SPI controller devices.
|
||||
* @num_chipselect: chipselects are used to distinguish individual
|
||||
@@ -235,11 +236,16 @@ enum ssp_chip_select {
|
||||
* each slave has a chipselect signal, but it's common that not
|
||||
* every chipselect is connected to a slave.
|
||||
* @enable_dma: if true enables DMA driven transfers.
|
||||
* @dma_rx_param: parameter to locate an RX DMA channel.
|
||||
* @dma_tx_param: parameter to locate a TX DMA channel.
|
||||
*/
|
||||
struct pl022_ssp_controller {
|
||||
u16 bus_id;
|
||||
u8 num_chipselect;
|
||||
u8 enable_dma:1;
|
||||
bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
|
||||
void *dma_rx_param;
|
||||
void *dma_tx_param;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -270,20 +276,13 @@ struct pl022_ssp_controller {
|
||||
* @dma_config: DMA configuration for SSP controller and peripheral
|
||||
*/
|
||||
struct pl022_config_chip {
|
||||
struct device *dev;
|
||||
enum ssp_loopback lbm;
|
||||
enum ssp_interface iface;
|
||||
enum ssp_hierarchy hierarchy;
|
||||
bool slave_tx_disable;
|
||||
struct ssp_clock_params clk_freq;
|
||||
enum ssp_rx_endian endian_rx;
|
||||
enum ssp_tx_endian endian_tx;
|
||||
enum ssp_data_size data_size;
|
||||
enum ssp_mode com_mode;
|
||||
enum ssp_rx_level_trig rx_lev_trig;
|
||||
enum ssp_tx_level_trig tx_lev_trig;
|
||||
enum ssp_spi_clk_phase clk_phase;
|
||||
enum ssp_spi_clk_pol clk_pol;
|
||||
enum ssp_microwire_ctrl_len ctrl_len;
|
||||
enum ssp_microwire_wait_state wait_state;
|
||||
enum ssp_duplex duplex;
|
||||
|
||||
@@ -32,7 +32,9 @@
|
||||
#define UART01x_RSR 0x04 /* Receive status register (Read). */
|
||||
#define UART01x_ECR 0x04 /* Error clear register (Write). */
|
||||
#define UART010_LCRH 0x08 /* Line control register, high byte. */
|
||||
#define ST_UART011_DMAWM 0x08 /* DMA watermark configure register. */
|
||||
#define UART010_LCRM 0x0C /* Line control register, middle byte. */
|
||||
#define ST_UART011_TIMEOUT 0x0C /* Timeout period register. */
|
||||
#define UART010_LCRL 0x10 /* Line control register, low byte. */
|
||||
#define UART010_CR 0x14 /* Control register. */
|
||||
#define UART01x_FR 0x18 /* Flag register (Read only). */
|
||||
@@ -51,6 +53,15 @@
|
||||
#define UART011_MIS 0x40 /* Masked interrupt status. */
|
||||
#define UART011_ICR 0x44 /* Interrupt clear register. */
|
||||
#define UART011_DMACR 0x48 /* DMA control register. */
|
||||
#define ST_UART011_XFCR 0x50 /* XON/XOFF control register. */
|
||||
#define ST_UART011_XON1 0x54 /* XON1 register. */
|
||||
#define ST_UART011_XON2 0x58 /* XON2 register. */
|
||||
#define ST_UART011_XOFF1 0x5C /* XON1 register. */
|
||||
#define ST_UART011_XOFF2 0x60 /* XON2 register. */
|
||||
#define ST_UART011_ITCR 0x80 /* Integration test control register. */
|
||||
#define ST_UART011_ITIP 0x84 /* Integration test input register. */
|
||||
#define ST_UART011_ABCR 0x100 /* Autobaud control register. */
|
||||
#define ST_UART011_ABIMSC 0x15C /* Autobaud interrupt mask/clear register. */
|
||||
|
||||
#define UART011_DR_OE (1 << 11)
|
||||
#define UART011_DR_BE (1 << 10)
|
||||
|
||||
+40
-6
@@ -89,6 +89,7 @@ enum {
|
||||
ATA_ID_SPG = 98,
|
||||
ATA_ID_LBA_CAPACITY_2 = 100,
|
||||
ATA_ID_SECTOR_SIZE = 106,
|
||||
ATA_ID_LOGICAL_SECTOR_SIZE = 117, /* and 118 */
|
||||
ATA_ID_LAST_LUN = 126,
|
||||
ATA_ID_DLF = 128,
|
||||
ATA_ID_CSFO = 129,
|
||||
@@ -640,16 +641,49 @@ static inline int ata_id_flush_ext_enabled(const u16 *id)
|
||||
return (id[ATA_ID_CFS_ENABLE_2] & 0x2400) == 0x2400;
|
||||
}
|
||||
|
||||
static inline int ata_id_has_large_logical_sectors(const u16 *id)
|
||||
static inline u32 ata_id_logical_sector_size(const u16 *id)
|
||||
{
|
||||
if ((id[ATA_ID_SECTOR_SIZE] & 0xc000) != 0x4000)
|
||||
return 0;
|
||||
return id[ATA_ID_SECTOR_SIZE] & (1 << 13);
|
||||
/* T13/1699-D Revision 6a, Sep 6, 2008. Page 128.
|
||||
* IDENTIFY DEVICE data, word 117-118.
|
||||
* 0xd000 ignores bit 13 (logical:physical > 1)
|
||||
*/
|
||||
if ((id[ATA_ID_SECTOR_SIZE] & 0xd000) == 0x5000)
|
||||
return (((id[ATA_ID_LOGICAL_SECTOR_SIZE+1] << 16)
|
||||
+ id[ATA_ID_LOGICAL_SECTOR_SIZE]) * sizeof(u16)) ;
|
||||
return ATA_SECT_SIZE;
|
||||
}
|
||||
|
||||
static inline u16 ata_id_logical_per_physical_sectors(const u16 *id)
|
||||
static inline u8 ata_id_log2_per_physical_sector(const u16 *id)
|
||||
{
|
||||
return 1 << (id[ATA_ID_SECTOR_SIZE] & 0xf);
|
||||
/* T13/1699-D Revision 6a, Sep 6, 2008. Page 128.
|
||||
* IDENTIFY DEVICE data, word 106.
|
||||
* 0xe000 ignores bit 12 (logical sector > 512 bytes)
|
||||
*/
|
||||
if ((id[ATA_ID_SECTOR_SIZE] & 0xe000) == 0x6000)
|
||||
return (id[ATA_ID_SECTOR_SIZE] & 0xf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Offset of logical sectors relative to physical sectors.
|
||||
*
|
||||
* If device has more than one logical sector per physical sector
|
||||
* (aka 512 byte emulation), vendors might offset the "sector 0" address
|
||||
* so sector 63 is "naturally aligned" - e.g. FAT partition table.
|
||||
* This avoids Read/Mod/Write penalties when using FAT partition table
|
||||
* and updating "well aligned" (FS perspective) physical sectors on every
|
||||
* transaction.
|
||||
*/
|
||||
static inline u16 ata_id_logical_sector_offset(const u16 *id,
|
||||
u8 log2_per_phys)
|
||||
{
|
||||
u16 word_209 = id[209];
|
||||
|
||||
if ((log2_per_phys > 1) && (word_209 & 0xc000) == 0x4000) {
|
||||
u16 first = word_209 & 0x3fff;
|
||||
if (first > 0)
|
||||
return (1 << log2_per_phys) - first;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int ata_id_has_lba48(const u16 *id)
|
||||
|
||||
@@ -449,7 +449,7 @@ void vcc_insert_socket(struct sock *sk);
|
||||
|
||||
static inline int atm_guess_pdu2truesize(int size)
|
||||
{
|
||||
return (SKB_DATA_ALIGN(size) + sizeof(struct skb_shared_info));
|
||||
return SKB_DATA_ALIGN(size) + sizeof(struct skb_shared_info);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+13
-2
@@ -346,8 +346,15 @@ static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags)
|
||||
}
|
||||
|
||||
#else
|
||||
#define bvec_kmap_irq(bvec, flags) (page_address((bvec)->bv_page) + (bvec)->bv_offset)
|
||||
#define bvec_kunmap_irq(buf, flags) do { *(flags) = 0; } while (0)
|
||||
static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags)
|
||||
{
|
||||
return page_address(bvec->bv_page) + bvec->bv_offset;
|
||||
}
|
||||
|
||||
static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags)
|
||||
{
|
||||
*flags = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx,
|
||||
@@ -496,6 +503,10 @@ static inline struct bio *bio_list_get(struct bio_list *bl)
|
||||
#define bip_for_each_vec(bvl, bip, i) \
|
||||
__bip_for_each_vec(bvl, bip, i, (bip)->bip_idx)
|
||||
|
||||
#define bio_for_each_integrity_vec(_bvl, _bio, _iter) \
|
||||
for_each_bio(_bio) \
|
||||
bip_for_each_vec(_bvl, _bio->bi_integrity, _iter)
|
||||
|
||||
#define bio_integrity(bio) (bio->bi_integrity != NULL)
|
||||
|
||||
extern struct bio_integrity_payload *bio_integrity_alloc_bioset(struct bio *, gfp_t, unsigned int, struct bio_set *);
|
||||
|
||||
@@ -136,28 +136,6 @@ static inline unsigned long __ffs64(u64 word)
|
||||
}
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#ifdef CONFIG_GENERIC_FIND_FIRST_BIT
|
||||
|
||||
/**
|
||||
* find_first_bit - find the first set bit in a memory region
|
||||
* @addr: The address to start the search at
|
||||
* @size: The maximum size to search
|
||||
*
|
||||
* Returns the bit number of the first set bit.
|
||||
*/
|
||||
extern unsigned long find_first_bit(const unsigned long *addr,
|
||||
unsigned long size);
|
||||
|
||||
/**
|
||||
* find_first_zero_bit - find the first cleared bit in a memory region
|
||||
* @addr: The address to start the search at
|
||||
* @size: The maximum size to search
|
||||
*
|
||||
* Returns the bit number of the first cleared bit.
|
||||
*/
|
||||
extern unsigned long find_first_zero_bit(const unsigned long *addr,
|
||||
unsigned long size);
|
||||
#endif /* CONFIG_GENERIC_FIND_FIRST_BIT */
|
||||
|
||||
#ifdef CONFIG_GENERIC_FIND_LAST_BIT
|
||||
/**
|
||||
@@ -171,28 +149,5 @@ extern unsigned long find_last_bit(const unsigned long *addr,
|
||||
unsigned long size);
|
||||
#endif /* CONFIG_GENERIC_FIND_LAST_BIT */
|
||||
|
||||
#ifdef CONFIG_GENERIC_FIND_NEXT_BIT
|
||||
|
||||
/**
|
||||
* find_next_bit - find the next set bit in a memory region
|
||||
* @addr: The address to base the search on
|
||||
* @offset: The bitnumber to start searching at
|
||||
* @size: The bitmap size in bits
|
||||
*/
|
||||
extern unsigned long find_next_bit(const unsigned long *addr,
|
||||
unsigned long size, unsigned long offset);
|
||||
|
||||
/**
|
||||
* find_next_zero_bit - find the next cleared bit in a memory region
|
||||
* @addr: The address to base the search on
|
||||
* @offset: The bitnumber to start searching at
|
||||
* @size: The bitmap size in bits
|
||||
*/
|
||||
|
||||
extern unsigned long find_next_zero_bit(const unsigned long *addr,
|
||||
unsigned long size,
|
||||
unsigned long offset);
|
||||
|
||||
#endif /* CONFIG_GENERIC_FIND_NEXT_BIT */
|
||||
#endif /* __KERNEL__ */
|
||||
#endif
|
||||
|
||||
@@ -97,6 +97,7 @@ struct bio {
|
||||
#define BIO_NULL_MAPPED 9 /* contains invalid user pages */
|
||||
#define BIO_FS_INTEGRITY 10 /* fs owns integrity data, not block layer */
|
||||
#define BIO_QUIET 11 /* Make BIO Quiet */
|
||||
#define BIO_MAPPED_INTEGRITY 12/* integrity metadata has been remapped */
|
||||
#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag)))
|
||||
|
||||
/*
|
||||
@@ -130,6 +131,8 @@ enum rq_flag_bits {
|
||||
/* bio only flags */
|
||||
__REQ_UNPLUG, /* unplug the immediately after submission */
|
||||
__REQ_RAHEAD, /* read ahead, can fail anytime */
|
||||
__REQ_THROTTLED, /* This bio has already been subjected to
|
||||
* throttling rules. Don't do it again. */
|
||||
|
||||
/* request only flags */
|
||||
__REQ_SORTED, /* elevator knows about this request */
|
||||
@@ -143,10 +146,8 @@ enum rq_flag_bits {
|
||||
__REQ_FAILED, /* set if the request failed */
|
||||
__REQ_QUIET, /* don't worry about errors */
|
||||
__REQ_PREEMPT, /* set for "ide_preempt" requests */
|
||||
__REQ_ORDERED_COLOR, /* is before or after barrier */
|
||||
__REQ_ALLOCED, /* request came from our alloc pool */
|
||||
__REQ_COPY_USER, /* contains copies of user pages */
|
||||
__REQ_INTEGRITY, /* integrity metadata has been remapped */
|
||||
__REQ_FLUSH, /* request for cache flush */
|
||||
__REQ_IO_STAT, /* account I/O stat */
|
||||
__REQ_MIXED_MERGE, /* merge of different types, fail separately */
|
||||
@@ -168,10 +169,12 @@ enum rq_flag_bits {
|
||||
(REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER)
|
||||
#define REQ_COMMON_MASK \
|
||||
(REQ_WRITE | REQ_FAILFAST_MASK | REQ_HARDBARRIER | REQ_SYNC | \
|
||||
REQ_META| REQ_DISCARD | REQ_NOIDLE)
|
||||
REQ_META | REQ_DISCARD | REQ_NOIDLE | REQ_FLUSH | REQ_FUA)
|
||||
#define REQ_CLONE_MASK REQ_COMMON_MASK
|
||||
|
||||
#define REQ_UNPLUG (1 << __REQ_UNPLUG)
|
||||
#define REQ_RAHEAD (1 << __REQ_RAHEAD)
|
||||
#define REQ_THROTTLED (1 << __REQ_THROTTLED)
|
||||
|
||||
#define REQ_SORTED (1 << __REQ_SORTED)
|
||||
#define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER)
|
||||
@@ -184,10 +187,8 @@ enum rq_flag_bits {
|
||||
#define REQ_FAILED (1 << __REQ_FAILED)
|
||||
#define REQ_QUIET (1 << __REQ_QUIET)
|
||||
#define REQ_PREEMPT (1 << __REQ_PREEMPT)
|
||||
#define REQ_ORDERED_COLOR (1 << __REQ_ORDERED_COLOR)
|
||||
#define REQ_ALLOCED (1 << __REQ_ALLOCED)
|
||||
#define REQ_COPY_USER (1 << __REQ_COPY_USER)
|
||||
#define REQ_INTEGRITY (1 << __REQ_INTEGRITY)
|
||||
#define REQ_FLUSH (1 << __REQ_FLUSH)
|
||||
#define REQ_IO_STAT (1 << __REQ_IO_STAT)
|
||||
#define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE)
|
||||
|
||||
+78
-87
@@ -115,6 +115,7 @@ struct request {
|
||||
void *elevator_private3;
|
||||
|
||||
struct gendisk *rq_disk;
|
||||
struct hd_struct *part;
|
||||
unsigned long start_time;
|
||||
#ifdef CONFIG_BLK_CGROUP
|
||||
unsigned long long start_time_ns;
|
||||
@@ -124,6 +125,9 @@ struct request {
|
||||
* physical address coalescing is performed.
|
||||
*/
|
||||
unsigned short nr_phys_segments;
|
||||
#if defined(CONFIG_BLK_DEV_INTEGRITY)
|
||||
unsigned short nr_integrity_segments;
|
||||
#endif
|
||||
|
||||
unsigned short ioprio;
|
||||
|
||||
@@ -243,6 +247,7 @@ struct queue_limits {
|
||||
|
||||
unsigned short logical_block_size;
|
||||
unsigned short max_segments;
|
||||
unsigned short max_integrity_segments;
|
||||
|
||||
unsigned char misaligned;
|
||||
unsigned char discard_misaligned;
|
||||
@@ -355,18 +360,25 @@ struct request_queue
|
||||
struct blk_trace *blk_trace;
|
||||
#endif
|
||||
/*
|
||||
* reserved for flush operations
|
||||
* for flush operations
|
||||
*/
|
||||
unsigned int ordered, next_ordered, ordseq;
|
||||
int orderr, ordcolor;
|
||||
struct request pre_flush_rq, bar_rq, post_flush_rq;
|
||||
struct request *orig_bar_rq;
|
||||
unsigned int flush_flags;
|
||||
unsigned int flush_seq;
|
||||
int flush_err;
|
||||
struct request flush_rq;
|
||||
struct request *orig_flush_rq;
|
||||
struct list_head pending_flushes;
|
||||
|
||||
struct mutex sysfs_lock;
|
||||
|
||||
#if defined(CONFIG_BLK_DEV_BSG)
|
||||
struct bsg_class_device bsg_dev;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BLK_DEV_THROTTLING
|
||||
/* Throttle data */
|
||||
struct throtl_data *td;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define QUEUE_FLAG_CLUSTER 0 /* cluster several segments into 1 */
|
||||
@@ -462,56 +474,6 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q)
|
||||
__clear_bit(flag, &q->queue_flags);
|
||||
}
|
||||
|
||||
enum {
|
||||
/*
|
||||
* Hardbarrier is supported with one of the following methods.
|
||||
*
|
||||
* NONE : hardbarrier unsupported
|
||||
* DRAIN : ordering by draining is enough
|
||||
* DRAIN_FLUSH : ordering by draining w/ pre and post flushes
|
||||
* DRAIN_FUA : ordering by draining w/ pre flush and FUA write
|
||||
* TAG : ordering by tag is enough
|
||||
* TAG_FLUSH : ordering by tag w/ pre and post flushes
|
||||
* TAG_FUA : ordering by tag w/ pre flush and FUA write
|
||||
*/
|
||||
QUEUE_ORDERED_BY_DRAIN = 0x01,
|
||||
QUEUE_ORDERED_BY_TAG = 0x02,
|
||||
QUEUE_ORDERED_DO_PREFLUSH = 0x10,
|
||||
QUEUE_ORDERED_DO_BAR = 0x20,
|
||||
QUEUE_ORDERED_DO_POSTFLUSH = 0x40,
|
||||
QUEUE_ORDERED_DO_FUA = 0x80,
|
||||
|
||||
QUEUE_ORDERED_NONE = 0x00,
|
||||
|
||||
QUEUE_ORDERED_DRAIN = QUEUE_ORDERED_BY_DRAIN |
|
||||
QUEUE_ORDERED_DO_BAR,
|
||||
QUEUE_ORDERED_DRAIN_FLUSH = QUEUE_ORDERED_DRAIN |
|
||||
QUEUE_ORDERED_DO_PREFLUSH |
|
||||
QUEUE_ORDERED_DO_POSTFLUSH,
|
||||
QUEUE_ORDERED_DRAIN_FUA = QUEUE_ORDERED_DRAIN |
|
||||
QUEUE_ORDERED_DO_PREFLUSH |
|
||||
QUEUE_ORDERED_DO_FUA,
|
||||
|
||||
QUEUE_ORDERED_TAG = QUEUE_ORDERED_BY_TAG |
|
||||
QUEUE_ORDERED_DO_BAR,
|
||||
QUEUE_ORDERED_TAG_FLUSH = QUEUE_ORDERED_TAG |
|
||||
QUEUE_ORDERED_DO_PREFLUSH |
|
||||
QUEUE_ORDERED_DO_POSTFLUSH,
|
||||
QUEUE_ORDERED_TAG_FUA = QUEUE_ORDERED_TAG |
|
||||
QUEUE_ORDERED_DO_PREFLUSH |
|
||||
QUEUE_ORDERED_DO_FUA,
|
||||
|
||||
/*
|
||||
* Ordered operation sequence
|
||||
*/
|
||||
QUEUE_ORDSEQ_STARTED = 0x01, /* flushing in progress */
|
||||
QUEUE_ORDSEQ_DRAIN = 0x02, /* waiting for the queue to be drained */
|
||||
QUEUE_ORDSEQ_PREFLUSH = 0x04, /* pre-flushing in progress */
|
||||
QUEUE_ORDSEQ_BAR = 0x08, /* original barrier req in progress */
|
||||
QUEUE_ORDSEQ_POSTFLUSH = 0x10, /* post-flushing in progress */
|
||||
QUEUE_ORDSEQ_DONE = 0x20,
|
||||
};
|
||||
|
||||
#define blk_queue_plugged(q) test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags)
|
||||
#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags)
|
||||
#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags)
|
||||
@@ -521,7 +483,6 @@ enum {
|
||||
#define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags)
|
||||
#define blk_queue_io_stat(q) test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)
|
||||
#define blk_queue_add_random(q) test_bit(QUEUE_FLAG_ADD_RANDOM, &(q)->queue_flags)
|
||||
#define blk_queue_flushing(q) ((q)->ordseq)
|
||||
#define blk_queue_stackable(q) \
|
||||
test_bit(QUEUE_FLAG_STACKABLE, &(q)->queue_flags)
|
||||
#define blk_queue_discard(q) test_bit(QUEUE_FLAG_DISCARD, &(q)->queue_flags)
|
||||
@@ -592,7 +553,8 @@ static inline void blk_clear_queue_full(struct request_queue *q, int sync)
|
||||
* it already be started by driver.
|
||||
*/
|
||||
#define RQ_NOMERGE_FLAGS \
|
||||
(REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER)
|
||||
(REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER | \
|
||||
REQ_FLUSH | REQ_FUA)
|
||||
#define rq_mergeable(rq) \
|
||||
(!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && \
|
||||
(((rq)->cmd_flags & REQ_DISCARD) || \
|
||||
@@ -851,7 +813,7 @@ extern void blk_queue_max_segment_size(struct request_queue *, unsigned int);
|
||||
extern void blk_queue_max_discard_sectors(struct request_queue *q,
|
||||
unsigned int max_discard_sectors);
|
||||
extern void blk_queue_logical_block_size(struct request_queue *, unsigned short);
|
||||
extern void blk_queue_physical_block_size(struct request_queue *, unsigned short);
|
||||
extern void blk_queue_physical_block_size(struct request_queue *, unsigned int);
|
||||
extern void blk_queue_alignment_offset(struct request_queue *q,
|
||||
unsigned int alignment);
|
||||
extern void blk_limits_io_min(struct queue_limits *limits, unsigned int min);
|
||||
@@ -881,12 +843,8 @@ extern void blk_queue_update_dma_alignment(struct request_queue *, int);
|
||||
extern void blk_queue_softirq_done(struct request_queue *, softirq_done_fn *);
|
||||
extern void blk_queue_rq_timed_out(struct request_queue *, rq_timed_out_fn *);
|
||||
extern void blk_queue_rq_timeout(struct request_queue *, unsigned int);
|
||||
extern void blk_queue_flush(struct request_queue *q, unsigned int flush);
|
||||
extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev);
|
||||
extern int blk_queue_ordered(struct request_queue *, unsigned);
|
||||
extern bool blk_do_ordered(struct request_queue *, struct request **);
|
||||
extern unsigned blk_ordered_cur_seq(struct request_queue *);
|
||||
extern unsigned blk_ordered_req_seq(struct request *);
|
||||
extern bool blk_ordered_complete_seq(struct request_queue *, unsigned, int);
|
||||
|
||||
extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *);
|
||||
extern void blk_dump_rq_flags(struct request *, char *);
|
||||
@@ -919,27 +877,20 @@ static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt,
|
||||
return NULL;
|
||||
return bqt->tag_index[tag];
|
||||
}
|
||||
enum{
|
||||
BLKDEV_WAIT, /* wait for completion */
|
||||
BLKDEV_BARRIER, /* issue request with barrier */
|
||||
BLKDEV_SECURE, /* secure discard */
|
||||
};
|
||||
#define BLKDEV_IFL_WAIT (1 << BLKDEV_WAIT)
|
||||
#define BLKDEV_IFL_BARRIER (1 << BLKDEV_BARRIER)
|
||||
#define BLKDEV_IFL_SECURE (1 << BLKDEV_SECURE)
|
||||
extern int blkdev_issue_flush(struct block_device *, gfp_t, sector_t *,
|
||||
unsigned long);
|
||||
|
||||
#define BLKDEV_DISCARD_SECURE 0x01 /* secure discard */
|
||||
|
||||
extern int blkdev_issue_flush(struct block_device *, gfp_t, sector_t *);
|
||||
extern int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
|
||||
sector_t nr_sects, gfp_t gfp_mask, unsigned long flags);
|
||||
extern int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
|
||||
sector_t nr_sects, gfp_t gfp_mask, unsigned long flags);
|
||||
static inline int sb_issue_discard(struct super_block *sb,
|
||||
sector_t block, sector_t nr_blocks)
|
||||
sector_t nr_sects, gfp_t gfp_mask);
|
||||
static inline int sb_issue_discard(struct super_block *sb, sector_t block,
|
||||
sector_t nr_blocks, gfp_t gfp_mask, unsigned long flags)
|
||||
{
|
||||
block <<= (sb->s_blocksize_bits - 9);
|
||||
nr_blocks <<= (sb->s_blocksize_bits - 9);
|
||||
return blkdev_issue_discard(sb->s_bdev, block, nr_blocks, GFP_NOFS,
|
||||
BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER);
|
||||
return blkdev_issue_discard(sb->s_bdev, block << (sb->s_blocksize_bits - 9),
|
||||
nr_blocks << (sb->s_blocksize_bits - 9),
|
||||
gfp_mask, flags);
|
||||
}
|
||||
|
||||
extern int blk_verify_command(unsigned char *cmd, fmode_t has_write_perm);
|
||||
@@ -1004,7 +955,7 @@ static inline unsigned int queue_physical_block_size(struct request_queue *q)
|
||||
return q->limits.physical_block_size;
|
||||
}
|
||||
|
||||
static inline int bdev_physical_block_size(struct block_device *bdev)
|
||||
static inline unsigned int bdev_physical_block_size(struct block_device *bdev)
|
||||
{
|
||||
return queue_physical_block_size(bdev_get_queue(bdev));
|
||||
}
|
||||
@@ -1093,11 +1044,11 @@ static inline int queue_dma_alignment(struct request_queue *q)
|
||||
return q ? q->dma_alignment : 511;
|
||||
}
|
||||
|
||||
static inline int blk_rq_aligned(struct request_queue *q, void *addr,
|
||||
static inline int blk_rq_aligned(struct request_queue *q, unsigned long addr,
|
||||
unsigned int len)
|
||||
{
|
||||
unsigned int alignment = queue_dma_alignment(q) | q->dma_pad_mask;
|
||||
return !((unsigned long)addr & alignment) && !(len & alignment);
|
||||
return !(addr & alignment) && !(len & alignment);
|
||||
}
|
||||
|
||||
/* assumes size > 256 */
|
||||
@@ -1127,6 +1078,7 @@ static inline void put_dev_sector(Sector p)
|
||||
|
||||
struct work_struct;
|
||||
int kblockd_schedule_work(struct request_queue *q, struct work_struct *work);
|
||||
int kblockd_schedule_delayed_work(struct request_queue *q, struct delayed_work *dwork, unsigned long delay);
|
||||
|
||||
#ifdef CONFIG_BLK_CGROUP
|
||||
/*
|
||||
@@ -1170,6 +1122,24 @@ static inline uint64_t rq_io_start_time_ns(struct request *req)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BLK_DEV_THROTTLING
|
||||
extern int blk_throtl_init(struct request_queue *q);
|
||||
extern void blk_throtl_exit(struct request_queue *q);
|
||||
extern int blk_throtl_bio(struct request_queue *q, struct bio **bio);
|
||||
extern void throtl_schedule_delayed_work(struct request_queue *q, unsigned long delay);
|
||||
extern void throtl_shutdown_timer_wq(struct request_queue *q);
|
||||
#else /* CONFIG_BLK_DEV_THROTTLING */
|
||||
static inline int blk_throtl_bio(struct request_queue *q, struct bio **bio)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int blk_throtl_init(struct request_queue *q) { return 0; }
|
||||
static inline int blk_throtl_exit(struct request_queue *q) { return 0; }
|
||||
static inline void throtl_schedule_delayed_work(struct request_queue *q, unsigned long delay) {}
|
||||
static inline void throtl_shutdown_timer_wq(struct request_queue *q) {}
|
||||
#endif /* CONFIG_BLK_DEV_THROTTLING */
|
||||
|
||||
#define MODULE_ALIAS_BLOCKDEV(major,minor) \
|
||||
MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor))
|
||||
#define MODULE_ALIAS_BLOCKDEV_MAJOR(major) \
|
||||
@@ -1213,8 +1183,13 @@ struct blk_integrity {
|
||||
extern int blk_integrity_register(struct gendisk *, struct blk_integrity *);
|
||||
extern void blk_integrity_unregister(struct gendisk *);
|
||||
extern int blk_integrity_compare(struct gendisk *, struct gendisk *);
|
||||
extern int blk_rq_map_integrity_sg(struct request *, struct scatterlist *);
|
||||
extern int blk_rq_count_integrity_sg(struct request *);
|
||||
extern int blk_rq_map_integrity_sg(struct request_queue *, struct bio *,
|
||||
struct scatterlist *);
|
||||
extern int blk_rq_count_integrity_sg(struct request_queue *, struct bio *);
|
||||
extern int blk_integrity_merge_rq(struct request_queue *, struct request *,
|
||||
struct request *);
|
||||
extern int blk_integrity_merge_bio(struct request_queue *, struct request *,
|
||||
struct bio *);
|
||||
|
||||
static inline
|
||||
struct blk_integrity *bdev_get_integrity(struct block_device *bdev)
|
||||
@@ -1235,16 +1210,32 @@ static inline int blk_integrity_rq(struct request *rq)
|
||||
return bio_integrity(rq->bio);
|
||||
}
|
||||
|
||||
static inline void blk_queue_max_integrity_segments(struct request_queue *q,
|
||||
unsigned int segs)
|
||||
{
|
||||
q->limits.max_integrity_segments = segs;
|
||||
}
|
||||
|
||||
static inline unsigned short
|
||||
queue_max_integrity_segments(struct request_queue *q)
|
||||
{
|
||||
return q->limits.max_integrity_segments;
|
||||
}
|
||||
|
||||
#else /* CONFIG_BLK_DEV_INTEGRITY */
|
||||
|
||||
#define blk_integrity_rq(rq) (0)
|
||||
#define blk_rq_count_integrity_sg(a) (0)
|
||||
#define blk_rq_map_integrity_sg(a, b) (0)
|
||||
#define blk_rq_count_integrity_sg(a, b) (0)
|
||||
#define blk_rq_map_integrity_sg(a, b, c) (0)
|
||||
#define bdev_get_integrity(a) (0)
|
||||
#define blk_get_integrity(a) (0)
|
||||
#define blk_integrity_compare(a, b) (0)
|
||||
#define blk_integrity_register(a, b) (0)
|
||||
#define blk_integrity_unregister(a) do { } while (0);
|
||||
#define blk_queue_max_integrity_segments(a, b) do { } while (0);
|
||||
#define queue_max_integrity_segments(a) (0)
|
||||
#define blk_integrity_merge_rq(a, b, c) (0)
|
||||
#define blk_integrity_merge_bio(a, b, c) (0)
|
||||
|
||||
#endif /* CONFIG_BLK_DEV_INTEGRITY */
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ enum bh_state_bits {
|
||||
BH_Delay, /* Buffer is not yet allocated on disk */
|
||||
BH_Boundary, /* Block is followed by a discontiguity */
|
||||
BH_Write_EIO, /* I/O error on write */
|
||||
BH_Eopnotsupp, /* operation not supported (barrier) */
|
||||
BH_Unwritten, /* Buffer is allocated on disk but not written */
|
||||
BH_Quiet, /* Buffer Error Prinks to be quiet */
|
||||
|
||||
@@ -124,7 +123,6 @@ BUFFER_FNS(Async_Write, async_write)
|
||||
BUFFER_FNS(Delay, delay)
|
||||
BUFFER_FNS(Boundary, boundary)
|
||||
BUFFER_FNS(Write_EIO, write_io_error)
|
||||
BUFFER_FNS(Eopnotsupp, eopnotsupp)
|
||||
BUFFER_FNS(Unwritten, unwritten)
|
||||
|
||||
#define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK)
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
/**
|
||||
* struct mcp251x_platform_data - MCP251X SPI CAN controller platform data
|
||||
* @oscillator_frequency: - oscillator frequency in Hz
|
||||
* @model: - actual type of chip
|
||||
* @board_specific_setup: - called before probing the chip (power,reset)
|
||||
* @transceiver_enable: - called to power on/off the transceiver
|
||||
* @power_enable: - called to power on/off the mcp *and* the
|
||||
@@ -25,9 +24,6 @@
|
||||
|
||||
struct mcp251x_platform_data {
|
||||
unsigned long oscillator_frequency;
|
||||
int model;
|
||||
#define CAN_MCP251X_MCP2510 0x2510
|
||||
#define CAN_MCP251X_MCP2515 0x2515
|
||||
int (*board_specific_setup)(struct spi_device *spi);
|
||||
int (*transceiver_enable)(int enable);
|
||||
int (*power_enable) (int enable);
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
#ifndef _FS_CEPH_AUTH_H
|
||||
#define _FS_CEPH_AUTH_H
|
||||
|
||||
#include <linux/ceph/types.h>
|
||||
#include <linux/ceph/buffer.h>
|
||||
|
||||
/*
|
||||
* Abstract interface for communicating with the authenticate module.
|
||||
* There is some handshake that takes place between us and the monitor
|
||||
* to acquire the necessary keys. These are used to generate an
|
||||
* 'authorizer' that we use when connecting to a service (mds, osd).
|
||||
*/
|
||||
|
||||
struct ceph_auth_client;
|
||||
struct ceph_authorizer;
|
||||
|
||||
struct ceph_auth_client_ops {
|
||||
const char *name;
|
||||
|
||||
/*
|
||||
* true if we are authenticated and can connect to
|
||||
* services.
|
||||
*/
|
||||
int (*is_authenticated)(struct ceph_auth_client *ac);
|
||||
|
||||
/*
|
||||
* true if we should (re)authenticate, e.g., when our tickets
|
||||
* are getting old and crusty.
|
||||
*/
|
||||
int (*should_authenticate)(struct ceph_auth_client *ac);
|
||||
|
||||
/*
|
||||
* build requests and process replies during monitor
|
||||
* handshake. if handle_reply returns -EAGAIN, we build
|
||||
* another request.
|
||||
*/
|
||||
int (*build_request)(struct ceph_auth_client *ac, void *buf, void *end);
|
||||
int (*handle_reply)(struct ceph_auth_client *ac, int result,
|
||||
void *buf, void *end);
|
||||
|
||||
/*
|
||||
* Create authorizer for connecting to a service, and verify
|
||||
* the response to authenticate the service.
|
||||
*/
|
||||
int (*create_authorizer)(struct ceph_auth_client *ac, int peer_type,
|
||||
struct ceph_authorizer **a,
|
||||
void **buf, size_t *len,
|
||||
void **reply_buf, size_t *reply_len);
|
||||
int (*verify_authorizer_reply)(struct ceph_auth_client *ac,
|
||||
struct ceph_authorizer *a, size_t len);
|
||||
void (*destroy_authorizer)(struct ceph_auth_client *ac,
|
||||
struct ceph_authorizer *a);
|
||||
void (*invalidate_authorizer)(struct ceph_auth_client *ac,
|
||||
int peer_type);
|
||||
|
||||
/* reset when we (re)connect to a monitor */
|
||||
void (*reset)(struct ceph_auth_client *ac);
|
||||
|
||||
void (*destroy)(struct ceph_auth_client *ac);
|
||||
};
|
||||
|
||||
struct ceph_auth_client {
|
||||
u32 protocol; /* CEPH_AUTH_* */
|
||||
void *private; /* for use by protocol implementation */
|
||||
const struct ceph_auth_client_ops *ops; /* null iff protocol==0 */
|
||||
|
||||
bool negotiating; /* true if negotiating protocol */
|
||||
const char *name; /* entity name */
|
||||
u64 global_id; /* our unique id in system */
|
||||
const char *secret; /* our secret key */
|
||||
unsigned want_keys; /* which services we want */
|
||||
};
|
||||
|
||||
extern struct ceph_auth_client *ceph_auth_init(const char *name,
|
||||
const char *secret);
|
||||
extern void ceph_auth_destroy(struct ceph_auth_client *ac);
|
||||
|
||||
extern void ceph_auth_reset(struct ceph_auth_client *ac);
|
||||
|
||||
extern int ceph_auth_build_hello(struct ceph_auth_client *ac,
|
||||
void *buf, size_t len);
|
||||
extern int ceph_handle_auth_reply(struct ceph_auth_client *ac,
|
||||
void *buf, size_t len,
|
||||
void *reply_buf, size_t reply_len);
|
||||
extern int ceph_entity_name_encode(const char *name, void **p, void *end);
|
||||
|
||||
extern int ceph_build_auth(struct ceph_auth_client *ac,
|
||||
void *msg_buf, size_t msg_len);
|
||||
|
||||
extern int ceph_auth_is_authenticated(struct ceph_auth_client *ac);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,39 @@
|
||||
#ifndef __FS_CEPH_BUFFER_H
|
||||
#define __FS_CEPH_BUFFER_H
|
||||
|
||||
#include <linux/kref.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/uio.h>
|
||||
|
||||
/*
|
||||
* a simple reference counted buffer.
|
||||
*
|
||||
* use kmalloc for small sizes (<= one page), vmalloc for larger
|
||||
* sizes.
|
||||
*/
|
||||
struct ceph_buffer {
|
||||
struct kref kref;
|
||||
struct kvec vec;
|
||||
size_t alloc_len;
|
||||
bool is_vmalloc;
|
||||
};
|
||||
|
||||
extern struct ceph_buffer *ceph_buffer_new(size_t len, gfp_t gfp);
|
||||
extern void ceph_buffer_release(struct kref *kref);
|
||||
|
||||
static inline struct ceph_buffer *ceph_buffer_get(struct ceph_buffer *b)
|
||||
{
|
||||
kref_get(&b->kref);
|
||||
return b;
|
||||
}
|
||||
|
||||
static inline void ceph_buffer_put(struct ceph_buffer *b)
|
||||
{
|
||||
kref_put(&b->kref, ceph_buffer_release);
|
||||
}
|
||||
|
||||
extern int ceph_decode_buffer(struct ceph_buffer **b, void **p, void *end);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,38 @@
|
||||
#ifndef _FS_CEPH_DEBUG_H
|
||||
#define _FS_CEPH_DEBUG_H
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#ifdef CONFIG_CEPH_LIB_PRETTYDEBUG
|
||||
|
||||
/*
|
||||
* wrap pr_debug to include a filename:lineno prefix on each line.
|
||||
* this incurs some overhead (kernel size and execution time) due to
|
||||
* the extra function call at each call site.
|
||||
*/
|
||||
|
||||
# if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG)
|
||||
extern const char *ceph_file_part(const char *s, int len);
|
||||
# define dout(fmt, ...) \
|
||||
pr_debug("%.*s %12.12s:%-4d : " fmt, \
|
||||
8 - (int)sizeof(KBUILD_MODNAME), " ", \
|
||||
ceph_file_part(__FILE__, sizeof(__FILE__)), \
|
||||
__LINE__, ##__VA_ARGS__)
|
||||
# else
|
||||
/* faux printk call just to see any compiler warnings. */
|
||||
# define dout(fmt, ...) do { \
|
||||
if (0) \
|
||||
printk(KERN_DEBUG fmt, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
# endif
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* or, just wrap pr_debug
|
||||
*/
|
||||
# define dout(fmt, ...) pr_debug(" " fmt, ##__VA_ARGS__)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,109 @@
|
||||
#ifndef FS_CEPH_FRAG_H
|
||||
#define FS_CEPH_FRAG_H
|
||||
|
||||
/*
|
||||
* "Frags" are a way to describe a subset of a 32-bit number space,
|
||||
* using a mask and a value to match against that mask. Any given frag
|
||||
* (subset of the number space) can be partitioned into 2^n sub-frags.
|
||||
*
|
||||
* Frags are encoded into a 32-bit word:
|
||||
* 8 upper bits = "bits"
|
||||
* 24 lower bits = "value"
|
||||
* (We could go to 5+27 bits, but who cares.)
|
||||
*
|
||||
* We use the _most_ significant bits of the 24 bit value. This makes
|
||||
* values logically sort.
|
||||
*
|
||||
* Unfortunately, because the "bits" field is still in the high bits, we
|
||||
* can't sort encoded frags numerically. However, it does allow you
|
||||
* to feed encoded frags as values into frag_contains_value.
|
||||
*/
|
||||
static inline __u32 ceph_frag_make(__u32 b, __u32 v)
|
||||
{
|
||||
return (b << 24) |
|
||||
(v & (0xffffffu << (24-b)) & 0xffffffu);
|
||||
}
|
||||
static inline __u32 ceph_frag_bits(__u32 f)
|
||||
{
|
||||
return f >> 24;
|
||||
}
|
||||
static inline __u32 ceph_frag_value(__u32 f)
|
||||
{
|
||||
return f & 0xffffffu;
|
||||
}
|
||||
static inline __u32 ceph_frag_mask(__u32 f)
|
||||
{
|
||||
return (0xffffffu << (24-ceph_frag_bits(f))) & 0xffffffu;
|
||||
}
|
||||
static inline __u32 ceph_frag_mask_shift(__u32 f)
|
||||
{
|
||||
return 24 - ceph_frag_bits(f);
|
||||
}
|
||||
|
||||
static inline int ceph_frag_contains_value(__u32 f, __u32 v)
|
||||
{
|
||||
return (v & ceph_frag_mask(f)) == ceph_frag_value(f);
|
||||
}
|
||||
static inline int ceph_frag_contains_frag(__u32 f, __u32 sub)
|
||||
{
|
||||
/* is sub as specific as us, and contained by us? */
|
||||
return ceph_frag_bits(sub) >= ceph_frag_bits(f) &&
|
||||
(ceph_frag_value(sub) & ceph_frag_mask(f)) == ceph_frag_value(f);
|
||||
}
|
||||
|
||||
static inline __u32 ceph_frag_parent(__u32 f)
|
||||
{
|
||||
return ceph_frag_make(ceph_frag_bits(f) - 1,
|
||||
ceph_frag_value(f) & (ceph_frag_mask(f) << 1));
|
||||
}
|
||||
static inline int ceph_frag_is_left_child(__u32 f)
|
||||
{
|
||||
return ceph_frag_bits(f) > 0 &&
|
||||
(ceph_frag_value(f) & (0x1000000 >> ceph_frag_bits(f))) == 0;
|
||||
}
|
||||
static inline int ceph_frag_is_right_child(__u32 f)
|
||||
{
|
||||
return ceph_frag_bits(f) > 0 &&
|
||||
(ceph_frag_value(f) & (0x1000000 >> ceph_frag_bits(f))) == 1;
|
||||
}
|
||||
static inline __u32 ceph_frag_sibling(__u32 f)
|
||||
{
|
||||
return ceph_frag_make(ceph_frag_bits(f),
|
||||
ceph_frag_value(f) ^ (0x1000000 >> ceph_frag_bits(f)));
|
||||
}
|
||||
static inline __u32 ceph_frag_left_child(__u32 f)
|
||||
{
|
||||
return ceph_frag_make(ceph_frag_bits(f)+1, ceph_frag_value(f));
|
||||
}
|
||||
static inline __u32 ceph_frag_right_child(__u32 f)
|
||||
{
|
||||
return ceph_frag_make(ceph_frag_bits(f)+1,
|
||||
ceph_frag_value(f) | (0x1000000 >> (1+ceph_frag_bits(f))));
|
||||
}
|
||||
static inline __u32 ceph_frag_make_child(__u32 f, int by, int i)
|
||||
{
|
||||
int newbits = ceph_frag_bits(f) + by;
|
||||
return ceph_frag_make(newbits,
|
||||
ceph_frag_value(f) | (i << (24 - newbits)));
|
||||
}
|
||||
static inline int ceph_frag_is_leftmost(__u32 f)
|
||||
{
|
||||
return ceph_frag_value(f) == 0;
|
||||
}
|
||||
static inline int ceph_frag_is_rightmost(__u32 f)
|
||||
{
|
||||
return ceph_frag_value(f) == ceph_frag_mask(f);
|
||||
}
|
||||
static inline __u32 ceph_frag_next(__u32 f)
|
||||
{
|
||||
return ceph_frag_make(ceph_frag_bits(f),
|
||||
ceph_frag_value(f) + (0x1000000 >> ceph_frag_bits(f)));
|
||||
}
|
||||
|
||||
/*
|
||||
* comparator to sort frags logically, as when traversing the
|
||||
* number space in ascending order...
|
||||
*/
|
||||
int ceph_frag_compare(__u32 a, __u32 b);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,729 @@
|
||||
/*
|
||||
* ceph_fs.h - Ceph constants and data types to share between kernel and
|
||||
* user space.
|
||||
*
|
||||
* Most types in this file are defined as little-endian, and are
|
||||
* primarily intended to describe data structures that pass over the
|
||||
* wire or that are stored on disk.
|
||||
*
|
||||
* LGPL2
|
||||
*/
|
||||
|
||||
#ifndef CEPH_FS_H
|
||||
#define CEPH_FS_H
|
||||
|
||||
#include "msgr.h"
|
||||
#include "rados.h"
|
||||
|
||||
/*
|
||||
* subprotocol versions. when specific messages types or high-level
|
||||
* protocols change, bump the affected components. we keep rev
|
||||
* internal cluster protocols separately from the public,
|
||||
* client-facing protocol.
|
||||
*/
|
||||
#define CEPH_OSD_PROTOCOL 8 /* cluster internal */
|
||||
#define CEPH_MDS_PROTOCOL 12 /* cluster internal */
|
||||
#define CEPH_MON_PROTOCOL 5 /* cluster internal */
|
||||
#define CEPH_OSDC_PROTOCOL 24 /* server/client */
|
||||
#define CEPH_MDSC_PROTOCOL 32 /* server/client */
|
||||
#define CEPH_MONC_PROTOCOL 15 /* server/client */
|
||||
|
||||
|
||||
#define CEPH_INO_ROOT 1
|
||||
#define CEPH_INO_CEPH 2 /* hidden .ceph dir */
|
||||
|
||||
/* arbitrary limit on max # of monitors (cluster of 3 is typical) */
|
||||
#define CEPH_MAX_MON 31
|
||||
|
||||
|
||||
/*
|
||||
* feature bits
|
||||
*/
|
||||
#define CEPH_FEATURE_UID (1<<0)
|
||||
#define CEPH_FEATURE_NOSRCADDR (1<<1)
|
||||
#define CEPH_FEATURE_MONCLOCKCHECK (1<<2)
|
||||
#define CEPH_FEATURE_FLOCK (1<<3)
|
||||
|
||||
|
||||
/*
|
||||
* ceph_file_layout - describe data layout for a file/inode
|
||||
*/
|
||||
struct ceph_file_layout {
|
||||
/* file -> object mapping */
|
||||
__le32 fl_stripe_unit; /* stripe unit, in bytes. must be multiple
|
||||
of page size. */
|
||||
__le32 fl_stripe_count; /* over this many objects */
|
||||
__le32 fl_object_size; /* until objects are this big, then move to
|
||||
new objects */
|
||||
__le32 fl_cas_hash; /* 0 = none; 1 = sha256 */
|
||||
|
||||
/* pg -> disk layout */
|
||||
__le32 fl_object_stripe_unit; /* for per-object parity, if any */
|
||||
|
||||
/* object -> pg layout */
|
||||
__le32 fl_pg_preferred; /* preferred primary for pg (-1 for none) */
|
||||
__le32 fl_pg_pool; /* namespace, crush ruleset, rep level */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define CEPH_MIN_STRIPE_UNIT 65536
|
||||
|
||||
int ceph_file_layout_is_valid(const struct ceph_file_layout *layout);
|
||||
|
||||
|
||||
/* crypto algorithms */
|
||||
#define CEPH_CRYPTO_NONE 0x0
|
||||
#define CEPH_CRYPTO_AES 0x1
|
||||
|
||||
#define CEPH_AES_IV "cephsageyudagreg"
|
||||
|
||||
/* security/authentication protocols */
|
||||
#define CEPH_AUTH_UNKNOWN 0x0
|
||||
#define CEPH_AUTH_NONE 0x1
|
||||
#define CEPH_AUTH_CEPHX 0x2
|
||||
|
||||
#define CEPH_AUTH_UID_DEFAULT ((__u64) -1)
|
||||
|
||||
|
||||
/*********************************************
|
||||
* message layer
|
||||
*/
|
||||
|
||||
/*
|
||||
* message types
|
||||
*/
|
||||
|
||||
/* misc */
|
||||
#define CEPH_MSG_SHUTDOWN 1
|
||||
#define CEPH_MSG_PING 2
|
||||
|
||||
/* client <-> monitor */
|
||||
#define CEPH_MSG_MON_MAP 4
|
||||
#define CEPH_MSG_MON_GET_MAP 5
|
||||
#define CEPH_MSG_STATFS 13
|
||||
#define CEPH_MSG_STATFS_REPLY 14
|
||||
#define CEPH_MSG_MON_SUBSCRIBE 15
|
||||
#define CEPH_MSG_MON_SUBSCRIBE_ACK 16
|
||||
#define CEPH_MSG_AUTH 17
|
||||
#define CEPH_MSG_AUTH_REPLY 18
|
||||
|
||||
/* client <-> mds */
|
||||
#define CEPH_MSG_MDS_MAP 21
|
||||
|
||||
#define CEPH_MSG_CLIENT_SESSION 22
|
||||
#define CEPH_MSG_CLIENT_RECONNECT 23
|
||||
|
||||
#define CEPH_MSG_CLIENT_REQUEST 24
|
||||
#define CEPH_MSG_CLIENT_REQUEST_FORWARD 25
|
||||
#define CEPH_MSG_CLIENT_REPLY 26
|
||||
#define CEPH_MSG_CLIENT_CAPS 0x310
|
||||
#define CEPH_MSG_CLIENT_LEASE 0x311
|
||||
#define CEPH_MSG_CLIENT_SNAP 0x312
|
||||
#define CEPH_MSG_CLIENT_CAPRELEASE 0x313
|
||||
|
||||
/* pool ops */
|
||||
#define CEPH_MSG_POOLOP_REPLY 48
|
||||
#define CEPH_MSG_POOLOP 49
|
||||
|
||||
|
||||
/* osd */
|
||||
#define CEPH_MSG_OSD_MAP 41
|
||||
#define CEPH_MSG_OSD_OP 42
|
||||
#define CEPH_MSG_OSD_OPREPLY 43
|
||||
|
||||
/* pool operations */
|
||||
enum {
|
||||
POOL_OP_CREATE = 0x01,
|
||||
POOL_OP_DELETE = 0x02,
|
||||
POOL_OP_AUID_CHANGE = 0x03,
|
||||
POOL_OP_CREATE_SNAP = 0x11,
|
||||
POOL_OP_DELETE_SNAP = 0x12,
|
||||
POOL_OP_CREATE_UNMANAGED_SNAP = 0x21,
|
||||
POOL_OP_DELETE_UNMANAGED_SNAP = 0x22,
|
||||
};
|
||||
|
||||
struct ceph_mon_request_header {
|
||||
__le64 have_version;
|
||||
__le16 session_mon;
|
||||
__le64 session_mon_tid;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ceph_mon_statfs {
|
||||
struct ceph_mon_request_header monhdr;
|
||||
struct ceph_fsid fsid;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ceph_statfs {
|
||||
__le64 kb, kb_used, kb_avail;
|
||||
__le64 num_objects;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ceph_mon_statfs_reply {
|
||||
struct ceph_fsid fsid;
|
||||
__le64 version;
|
||||
struct ceph_statfs st;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
const char *ceph_pool_op_name(int op);
|
||||
|
||||
struct ceph_mon_poolop {
|
||||
struct ceph_mon_request_header monhdr;
|
||||
struct ceph_fsid fsid;
|
||||
__le32 pool;
|
||||
__le32 op;
|
||||
__le64 auid;
|
||||
__le64 snapid;
|
||||
__le32 name_len;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ceph_mon_poolop_reply {
|
||||
struct ceph_mon_request_header monhdr;
|
||||
struct ceph_fsid fsid;
|
||||
__le32 reply_code;
|
||||
__le32 epoch;
|
||||
char has_data;
|
||||
char data[0];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ceph_mon_unmanaged_snap {
|
||||
__le64 snapid;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ceph_osd_getmap {
|
||||
struct ceph_mon_request_header monhdr;
|
||||
struct ceph_fsid fsid;
|
||||
__le32 start;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ceph_mds_getmap {
|
||||
struct ceph_mon_request_header monhdr;
|
||||
struct ceph_fsid fsid;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ceph_client_mount {
|
||||
struct ceph_mon_request_header monhdr;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ceph_mon_subscribe_item {
|
||||
__le64 have_version; __le64 have;
|
||||
__u8 onetime;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ceph_mon_subscribe_ack {
|
||||
__le32 duration; /* seconds */
|
||||
struct ceph_fsid fsid;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/*
|
||||
* mds states
|
||||
* > 0 -> in
|
||||
* <= 0 -> out
|
||||
*/
|
||||
#define CEPH_MDS_STATE_DNE 0 /* down, does not exist. */
|
||||
#define CEPH_MDS_STATE_STOPPED -1 /* down, once existed, but no subtrees.
|
||||
empty log. */
|
||||
#define CEPH_MDS_STATE_BOOT -4 /* up, boot announcement. */
|
||||
#define CEPH_MDS_STATE_STANDBY -5 /* up, idle. waiting for assignment. */
|
||||
#define CEPH_MDS_STATE_CREATING -6 /* up, creating MDS instance. */
|
||||
#define CEPH_MDS_STATE_STARTING -7 /* up, starting previously stopped mds */
|
||||
#define CEPH_MDS_STATE_STANDBY_REPLAY -8 /* up, tailing active node's journal */
|
||||
|
||||
#define CEPH_MDS_STATE_REPLAY 8 /* up, replaying journal. */
|
||||
#define CEPH_MDS_STATE_RESOLVE 9 /* up, disambiguating distributed
|
||||
operations (import, rename, etc.) */
|
||||
#define CEPH_MDS_STATE_RECONNECT 10 /* up, reconnect to clients */
|
||||
#define CEPH_MDS_STATE_REJOIN 11 /* up, rejoining distributed cache */
|
||||
#define CEPH_MDS_STATE_CLIENTREPLAY 12 /* up, replaying client operations */
|
||||
#define CEPH_MDS_STATE_ACTIVE 13 /* up, active */
|
||||
#define CEPH_MDS_STATE_STOPPING 14 /* up, but exporting metadata */
|
||||
|
||||
extern const char *ceph_mds_state_name(int s);
|
||||
|
||||
|
||||
/*
|
||||
* metadata lock types.
|
||||
* - these are bitmasks.. we can compose them
|
||||
* - they also define the lock ordering by the MDS
|
||||
* - a few of these are internal to the mds
|
||||
*/
|
||||
#define CEPH_LOCK_DVERSION 1
|
||||
#define CEPH_LOCK_DN 2
|
||||
#define CEPH_LOCK_ISNAP 16
|
||||
#define CEPH_LOCK_IVERSION 32 /* mds internal */
|
||||
#define CEPH_LOCK_IFILE 64
|
||||
#define CEPH_LOCK_IAUTH 128
|
||||
#define CEPH_LOCK_ILINK 256
|
||||
#define CEPH_LOCK_IDFT 512 /* dir frag tree */
|
||||
#define CEPH_LOCK_INEST 1024 /* mds internal */
|
||||
#define CEPH_LOCK_IXATTR 2048
|
||||
#define CEPH_LOCK_IFLOCK 4096 /* advisory file locks */
|
||||
#define CEPH_LOCK_INO 8192 /* immutable inode bits; not a lock */
|
||||
|
||||
/* client_session ops */
|
||||
enum {
|
||||
CEPH_SESSION_REQUEST_OPEN,
|
||||
CEPH_SESSION_OPEN,
|
||||
CEPH_SESSION_REQUEST_CLOSE,
|
||||
CEPH_SESSION_CLOSE,
|
||||
CEPH_SESSION_REQUEST_RENEWCAPS,
|
||||
CEPH_SESSION_RENEWCAPS,
|
||||
CEPH_SESSION_STALE,
|
||||
CEPH_SESSION_RECALL_STATE,
|
||||
};
|
||||
|
||||
extern const char *ceph_session_op_name(int op);
|
||||
|
||||
struct ceph_mds_session_head {
|
||||
__le32 op;
|
||||
__le64 seq;
|
||||
struct ceph_timespec stamp;
|
||||
__le32 max_caps, max_leases;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* client_request */
|
||||
/*
|
||||
* metadata ops.
|
||||
* & 0x001000 -> write op
|
||||
* & 0x010000 -> follow symlink (e.g. stat(), not lstat()).
|
||||
& & 0x100000 -> use weird ino/path trace
|
||||
*/
|
||||
#define CEPH_MDS_OP_WRITE 0x001000
|
||||
enum {
|
||||
CEPH_MDS_OP_LOOKUP = 0x00100,
|
||||
CEPH_MDS_OP_GETATTR = 0x00101,
|
||||
CEPH_MDS_OP_LOOKUPHASH = 0x00102,
|
||||
CEPH_MDS_OP_LOOKUPPARENT = 0x00103,
|
||||
|
||||
CEPH_MDS_OP_SETXATTR = 0x01105,
|
||||
CEPH_MDS_OP_RMXATTR = 0x01106,
|
||||
CEPH_MDS_OP_SETLAYOUT = 0x01107,
|
||||
CEPH_MDS_OP_SETATTR = 0x01108,
|
||||
CEPH_MDS_OP_SETFILELOCK= 0x01109,
|
||||
CEPH_MDS_OP_GETFILELOCK= 0x00110,
|
||||
CEPH_MDS_OP_SETDIRLAYOUT=0x0110a,
|
||||
|
||||
CEPH_MDS_OP_MKNOD = 0x01201,
|
||||
CEPH_MDS_OP_LINK = 0x01202,
|
||||
CEPH_MDS_OP_UNLINK = 0x01203,
|
||||
CEPH_MDS_OP_RENAME = 0x01204,
|
||||
CEPH_MDS_OP_MKDIR = 0x01220,
|
||||
CEPH_MDS_OP_RMDIR = 0x01221,
|
||||
CEPH_MDS_OP_SYMLINK = 0x01222,
|
||||
|
||||
CEPH_MDS_OP_CREATE = 0x01301,
|
||||
CEPH_MDS_OP_OPEN = 0x00302,
|
||||
CEPH_MDS_OP_READDIR = 0x00305,
|
||||
|
||||
CEPH_MDS_OP_LOOKUPSNAP = 0x00400,
|
||||
CEPH_MDS_OP_MKSNAP = 0x01400,
|
||||
CEPH_MDS_OP_RMSNAP = 0x01401,
|
||||
CEPH_MDS_OP_LSSNAP = 0x00402,
|
||||
};
|
||||
|
||||
extern const char *ceph_mds_op_name(int op);
|
||||
|
||||
|
||||
#define CEPH_SETATTR_MODE 1
|
||||
#define CEPH_SETATTR_UID 2
|
||||
#define CEPH_SETATTR_GID 4
|
||||
#define CEPH_SETATTR_MTIME 8
|
||||
#define CEPH_SETATTR_ATIME 16
|
||||
#define CEPH_SETATTR_SIZE 32
|
||||
#define CEPH_SETATTR_CTIME 64
|
||||
|
||||
union ceph_mds_request_args {
|
||||
struct {
|
||||
__le32 mask; /* CEPH_CAP_* */
|
||||
} __attribute__ ((packed)) getattr;
|
||||
struct {
|
||||
__le32 mode;
|
||||
__le32 uid;
|
||||
__le32 gid;
|
||||
struct ceph_timespec mtime;
|
||||
struct ceph_timespec atime;
|
||||
__le64 size, old_size; /* old_size needed by truncate */
|
||||
__le32 mask; /* CEPH_SETATTR_* */
|
||||
} __attribute__ ((packed)) setattr;
|
||||
struct {
|
||||
__le32 frag; /* which dir fragment */
|
||||
__le32 max_entries; /* how many dentries to grab */
|
||||
__le32 max_bytes;
|
||||
} __attribute__ ((packed)) readdir;
|
||||
struct {
|
||||
__le32 mode;
|
||||
__le32 rdev;
|
||||
} __attribute__ ((packed)) mknod;
|
||||
struct {
|
||||
__le32 mode;
|
||||
} __attribute__ ((packed)) mkdir;
|
||||
struct {
|
||||
__le32 flags;
|
||||
__le32 mode;
|
||||
__le32 stripe_unit; /* layout for newly created file */
|
||||
__le32 stripe_count; /* ... */
|
||||
__le32 object_size;
|
||||
__le32 file_replication;
|
||||
__le32 preferred;
|
||||
} __attribute__ ((packed)) open;
|
||||
struct {
|
||||
__le32 flags;
|
||||
} __attribute__ ((packed)) setxattr;
|
||||
struct {
|
||||
struct ceph_file_layout layout;
|
||||
} __attribute__ ((packed)) setlayout;
|
||||
struct {
|
||||
__u8 rule; /* currently fcntl or flock */
|
||||
__u8 type; /* shared, exclusive, remove*/
|
||||
__le64 pid; /* process id requesting the lock */
|
||||
__le64 pid_namespace;
|
||||
__le64 start; /* initial location to lock */
|
||||
__le64 length; /* num bytes to lock from start */
|
||||
__u8 wait; /* will caller wait for lock to become available? */
|
||||
} __attribute__ ((packed)) filelock_change;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define CEPH_MDS_FLAG_REPLAY 1 /* this is a replayed op */
|
||||
#define CEPH_MDS_FLAG_WANT_DENTRY 2 /* want dentry in reply */
|
||||
|
||||
struct ceph_mds_request_head {
|
||||
__le64 oldest_client_tid;
|
||||
__le32 mdsmap_epoch; /* on client */
|
||||
__le32 flags; /* CEPH_MDS_FLAG_* */
|
||||
__u8 num_retry, num_fwd; /* count retry, fwd attempts */
|
||||
__le16 num_releases; /* # include cap/lease release records */
|
||||
__le32 op; /* mds op code */
|
||||
__le32 caller_uid, caller_gid;
|
||||
__le64 ino; /* use this ino for openc, mkdir, mknod,
|
||||
etc. (if replaying) */
|
||||
union ceph_mds_request_args args;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* cap/lease release record */
|
||||
struct ceph_mds_request_release {
|
||||
__le64 ino, cap_id; /* ino and unique cap id */
|
||||
__le32 caps, wanted; /* new issued, wanted */
|
||||
__le32 seq, issue_seq, mseq;
|
||||
__le32 dname_seq; /* if releasing a dentry lease, a */
|
||||
__le32 dname_len; /* string follows. */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* client reply */
|
||||
struct ceph_mds_reply_head {
|
||||
__le32 op;
|
||||
__le32 result;
|
||||
__le32 mdsmap_epoch;
|
||||
__u8 safe; /* true if committed to disk */
|
||||
__u8 is_dentry, is_target; /* true if dentry, target inode records
|
||||
are included with reply */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* one for each node split */
|
||||
struct ceph_frag_tree_split {
|
||||
__le32 frag; /* this frag splits... */
|
||||
__le32 by; /* ...by this many bits */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ceph_frag_tree_head {
|
||||
__le32 nsplits; /* num ceph_frag_tree_split records */
|
||||
struct ceph_frag_tree_split splits[];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* capability issue, for bundling with mds reply */
|
||||
struct ceph_mds_reply_cap {
|
||||
__le32 caps, wanted; /* caps issued, wanted */
|
||||
__le64 cap_id;
|
||||
__le32 seq, mseq;
|
||||
__le64 realm; /* snap realm */
|
||||
__u8 flags; /* CEPH_CAP_FLAG_* */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define CEPH_CAP_FLAG_AUTH 1 /* cap is issued by auth mds */
|
||||
|
||||
/* inode record, for bundling with mds reply */
|
||||
struct ceph_mds_reply_inode {
|
||||
__le64 ino;
|
||||
__le64 snapid;
|
||||
__le32 rdev;
|
||||
__le64 version; /* inode version */
|
||||
__le64 xattr_version; /* version for xattr blob */
|
||||
struct ceph_mds_reply_cap cap; /* caps issued for this inode */
|
||||
struct ceph_file_layout layout;
|
||||
struct ceph_timespec ctime, mtime, atime;
|
||||
__le32 time_warp_seq;
|
||||
__le64 size, max_size, truncate_size;
|
||||
__le32 truncate_seq;
|
||||
__le32 mode, uid, gid;
|
||||
__le32 nlink;
|
||||
__le64 files, subdirs, rbytes, rfiles, rsubdirs; /* dir stats */
|
||||
struct ceph_timespec rctime;
|
||||
struct ceph_frag_tree_head fragtree; /* (must be at end of struct) */
|
||||
} __attribute__ ((packed));
|
||||
/* followed by frag array, then symlink string, then xattr blob */
|
||||
|
||||
/* reply_lease follows dname, and reply_inode */
|
||||
struct ceph_mds_reply_lease {
|
||||
__le16 mask; /* lease type(s) */
|
||||
__le32 duration_ms; /* lease duration */
|
||||
__le32 seq;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ceph_mds_reply_dirfrag {
|
||||
__le32 frag; /* fragment */
|
||||
__le32 auth; /* auth mds, if this is a delegation point */
|
||||
__le32 ndist; /* number of mds' this is replicated on */
|
||||
__le32 dist[];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define CEPH_LOCK_FCNTL 1
|
||||
#define CEPH_LOCK_FLOCK 2
|
||||
|
||||
#define CEPH_LOCK_SHARED 1
|
||||
#define CEPH_LOCK_EXCL 2
|
||||
#define CEPH_LOCK_UNLOCK 4
|
||||
|
||||
struct ceph_filelock {
|
||||
__le64 start;/* file offset to start lock at */
|
||||
__le64 length; /* num bytes to lock; 0 for all following start */
|
||||
__le64 client; /* which client holds the lock */
|
||||
__le64 pid; /* process id holding the lock on the client */
|
||||
__le64 pid_namespace;
|
||||
__u8 type; /* shared lock, exclusive lock, or unlock */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
/* file access modes */
|
||||
#define CEPH_FILE_MODE_PIN 0
|
||||
#define CEPH_FILE_MODE_RD 1
|
||||
#define CEPH_FILE_MODE_WR 2
|
||||
#define CEPH_FILE_MODE_RDWR 3 /* RD | WR */
|
||||
#define CEPH_FILE_MODE_LAZY 4 /* lazy io */
|
||||
#define CEPH_FILE_MODE_NUM 8 /* bc these are bit fields.. mostly */
|
||||
|
||||
int ceph_flags_to_mode(int flags);
|
||||
|
||||
|
||||
/* capability bits */
|
||||
#define CEPH_CAP_PIN 1 /* no specific capabilities beyond the pin */
|
||||
|
||||
/* generic cap bits */
|
||||
#define CEPH_CAP_GSHARED 1 /* client can reads */
|
||||
#define CEPH_CAP_GEXCL 2 /* client can read and update */
|
||||
#define CEPH_CAP_GCACHE 4 /* (file) client can cache reads */
|
||||
#define CEPH_CAP_GRD 8 /* (file) client can read */
|
||||
#define CEPH_CAP_GWR 16 /* (file) client can write */
|
||||
#define CEPH_CAP_GBUFFER 32 /* (file) client can buffer writes */
|
||||
#define CEPH_CAP_GWREXTEND 64 /* (file) client can extend EOF */
|
||||
#define CEPH_CAP_GLAZYIO 128 /* (file) client can perform lazy io */
|
||||
|
||||
/* per-lock shift */
|
||||
#define CEPH_CAP_SAUTH 2
|
||||
#define CEPH_CAP_SLINK 4
|
||||
#define CEPH_CAP_SXATTR 6
|
||||
#define CEPH_CAP_SFILE 8
|
||||
#define CEPH_CAP_SFLOCK 20
|
||||
|
||||
#define CEPH_CAP_BITS 22
|
||||
|
||||
/* composed values */
|
||||
#define CEPH_CAP_AUTH_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SAUTH)
|
||||
#define CEPH_CAP_AUTH_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SAUTH)
|
||||
#define CEPH_CAP_LINK_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SLINK)
|
||||
#define CEPH_CAP_LINK_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SLINK)
|
||||
#define CEPH_CAP_XATTR_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SXATTR)
|
||||
#define CEPH_CAP_XATTR_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SXATTR)
|
||||
#define CEPH_CAP_FILE(x) (x << CEPH_CAP_SFILE)
|
||||
#define CEPH_CAP_FILE_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SFILE)
|
||||
#define CEPH_CAP_FILE_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SFILE)
|
||||
#define CEPH_CAP_FILE_CACHE (CEPH_CAP_GCACHE << CEPH_CAP_SFILE)
|
||||
#define CEPH_CAP_FILE_RD (CEPH_CAP_GRD << CEPH_CAP_SFILE)
|
||||
#define CEPH_CAP_FILE_WR (CEPH_CAP_GWR << CEPH_CAP_SFILE)
|
||||
#define CEPH_CAP_FILE_BUFFER (CEPH_CAP_GBUFFER << CEPH_CAP_SFILE)
|
||||
#define CEPH_CAP_FILE_WREXTEND (CEPH_CAP_GWREXTEND << CEPH_CAP_SFILE)
|
||||
#define CEPH_CAP_FILE_LAZYIO (CEPH_CAP_GLAZYIO << CEPH_CAP_SFILE)
|
||||
#define CEPH_CAP_FLOCK_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SFLOCK)
|
||||
#define CEPH_CAP_FLOCK_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SFLOCK)
|
||||
|
||||
|
||||
/* cap masks (for getattr) */
|
||||
#define CEPH_STAT_CAP_INODE CEPH_CAP_PIN
|
||||
#define CEPH_STAT_CAP_TYPE CEPH_CAP_PIN /* mode >> 12 */
|
||||
#define CEPH_STAT_CAP_SYMLINK CEPH_CAP_PIN
|
||||
#define CEPH_STAT_CAP_UID CEPH_CAP_AUTH_SHARED
|
||||
#define CEPH_STAT_CAP_GID CEPH_CAP_AUTH_SHARED
|
||||
#define CEPH_STAT_CAP_MODE CEPH_CAP_AUTH_SHARED
|
||||
#define CEPH_STAT_CAP_NLINK CEPH_CAP_LINK_SHARED
|
||||
#define CEPH_STAT_CAP_LAYOUT CEPH_CAP_FILE_SHARED
|
||||
#define CEPH_STAT_CAP_MTIME CEPH_CAP_FILE_SHARED
|
||||
#define CEPH_STAT_CAP_SIZE CEPH_CAP_FILE_SHARED
|
||||
#define CEPH_STAT_CAP_ATIME CEPH_CAP_FILE_SHARED /* fixme */
|
||||
#define CEPH_STAT_CAP_XATTR CEPH_CAP_XATTR_SHARED
|
||||
#define CEPH_STAT_CAP_INODE_ALL (CEPH_CAP_PIN | \
|
||||
CEPH_CAP_AUTH_SHARED | \
|
||||
CEPH_CAP_LINK_SHARED | \
|
||||
CEPH_CAP_FILE_SHARED | \
|
||||
CEPH_CAP_XATTR_SHARED)
|
||||
|
||||
#define CEPH_CAP_ANY_SHARED (CEPH_CAP_AUTH_SHARED | \
|
||||
CEPH_CAP_LINK_SHARED | \
|
||||
CEPH_CAP_XATTR_SHARED | \
|
||||
CEPH_CAP_FILE_SHARED)
|
||||
#define CEPH_CAP_ANY_RD (CEPH_CAP_ANY_SHARED | CEPH_CAP_FILE_RD | \
|
||||
CEPH_CAP_FILE_CACHE)
|
||||
|
||||
#define CEPH_CAP_ANY_EXCL (CEPH_CAP_AUTH_EXCL | \
|
||||
CEPH_CAP_LINK_EXCL | \
|
||||
CEPH_CAP_XATTR_EXCL | \
|
||||
CEPH_CAP_FILE_EXCL)
|
||||
#define CEPH_CAP_ANY_FILE_WR (CEPH_CAP_FILE_WR | CEPH_CAP_FILE_BUFFER | \
|
||||
CEPH_CAP_FILE_EXCL)
|
||||
#define CEPH_CAP_ANY_WR (CEPH_CAP_ANY_EXCL | CEPH_CAP_ANY_FILE_WR)
|
||||
#define CEPH_CAP_ANY (CEPH_CAP_ANY_RD | CEPH_CAP_ANY_EXCL | \
|
||||
CEPH_CAP_ANY_FILE_WR | CEPH_CAP_FILE_LAZYIO | \
|
||||
CEPH_CAP_PIN)
|
||||
|
||||
#define CEPH_CAP_LOCKS (CEPH_LOCK_IFILE | CEPH_LOCK_IAUTH | CEPH_LOCK_ILINK | \
|
||||
CEPH_LOCK_IXATTR)
|
||||
|
||||
int ceph_caps_for_mode(int mode);
|
||||
|
||||
enum {
|
||||
CEPH_CAP_OP_GRANT, /* mds->client grant */
|
||||
CEPH_CAP_OP_REVOKE, /* mds->client revoke */
|
||||
CEPH_CAP_OP_TRUNC, /* mds->client trunc notify */
|
||||
CEPH_CAP_OP_EXPORT, /* mds has exported the cap */
|
||||
CEPH_CAP_OP_IMPORT, /* mds has imported the cap */
|
||||
CEPH_CAP_OP_UPDATE, /* client->mds update */
|
||||
CEPH_CAP_OP_DROP, /* client->mds drop cap bits */
|
||||
CEPH_CAP_OP_FLUSH, /* client->mds cap writeback */
|
||||
CEPH_CAP_OP_FLUSH_ACK, /* mds->client flushed */
|
||||
CEPH_CAP_OP_FLUSHSNAP, /* client->mds flush snapped metadata */
|
||||
CEPH_CAP_OP_FLUSHSNAP_ACK, /* mds->client flushed snapped metadata */
|
||||
CEPH_CAP_OP_RELEASE, /* client->mds release (clean) cap */
|
||||
CEPH_CAP_OP_RENEW, /* client->mds renewal request */
|
||||
};
|
||||
|
||||
extern const char *ceph_cap_op_name(int op);
|
||||
|
||||
/*
|
||||
* caps message, used for capability callbacks, acks, requests, etc.
|
||||
*/
|
||||
struct ceph_mds_caps {
|
||||
__le32 op; /* CEPH_CAP_OP_* */
|
||||
__le64 ino, realm;
|
||||
__le64 cap_id;
|
||||
__le32 seq, issue_seq;
|
||||
__le32 caps, wanted, dirty; /* latest issued/wanted/dirty */
|
||||
__le32 migrate_seq;
|
||||
__le64 snap_follows;
|
||||
__le32 snap_trace_len;
|
||||
|
||||
/* authlock */
|
||||
__le32 uid, gid, mode;
|
||||
|
||||
/* linklock */
|
||||
__le32 nlink;
|
||||
|
||||
/* xattrlock */
|
||||
__le32 xattr_len;
|
||||
__le64 xattr_version;
|
||||
|
||||
/* filelock */
|
||||
__le64 size, max_size, truncate_size;
|
||||
__le32 truncate_seq;
|
||||
struct ceph_timespec mtime, atime, ctime;
|
||||
struct ceph_file_layout layout;
|
||||
__le32 time_warp_seq;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* cap release msg head */
|
||||
struct ceph_mds_cap_release {
|
||||
__le32 num; /* number of cap_items that follow */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ceph_mds_cap_item {
|
||||
__le64 ino;
|
||||
__le64 cap_id;
|
||||
__le32 migrate_seq, seq;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define CEPH_MDS_LEASE_REVOKE 1 /* mds -> client */
|
||||
#define CEPH_MDS_LEASE_RELEASE 2 /* client -> mds */
|
||||
#define CEPH_MDS_LEASE_RENEW 3 /* client <-> mds */
|
||||
#define CEPH_MDS_LEASE_REVOKE_ACK 4 /* client -> mds */
|
||||
|
||||
extern const char *ceph_lease_op_name(int o);
|
||||
|
||||
/* lease msg header */
|
||||
struct ceph_mds_lease {
|
||||
__u8 action; /* CEPH_MDS_LEASE_* */
|
||||
__le16 mask; /* which lease */
|
||||
__le64 ino;
|
||||
__le64 first, last; /* snap range */
|
||||
__le32 seq;
|
||||
__le32 duration_ms; /* duration of renewal */
|
||||
} __attribute__ ((packed));
|
||||
/* followed by a __le32+string for dname */
|
||||
|
||||
/* client reconnect */
|
||||
struct ceph_mds_cap_reconnect {
|
||||
__le64 cap_id;
|
||||
__le32 wanted;
|
||||
__le32 issued;
|
||||
__le64 snaprealm;
|
||||
__le64 pathbase; /* base ino for our path to this ino */
|
||||
__le32 flock_len; /* size of flock state blob, if any */
|
||||
} __attribute__ ((packed));
|
||||
/* followed by flock blob */
|
||||
|
||||
struct ceph_mds_cap_reconnect_v1 {
|
||||
__le64 cap_id;
|
||||
__le32 wanted;
|
||||
__le32 issued;
|
||||
__le64 size;
|
||||
struct ceph_timespec mtime, atime;
|
||||
__le64 snaprealm;
|
||||
__le64 pathbase; /* base ino for our path to this ino */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ceph_mds_snaprealm_reconnect {
|
||||
__le64 ino; /* snap realm base */
|
||||
__le64 seq; /* snap seq for this snap realm */
|
||||
__le64 parent; /* parent realm */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/*
|
||||
* snaps
|
||||
*/
|
||||
enum {
|
||||
CEPH_SNAP_OP_UPDATE, /* CREATE or DESTROY */
|
||||
CEPH_SNAP_OP_CREATE,
|
||||
CEPH_SNAP_OP_DESTROY,
|
||||
CEPH_SNAP_OP_SPLIT,
|
||||
};
|
||||
|
||||
extern const char *ceph_snap_op_name(int o);
|
||||
|
||||
/* snap msg header */
|
||||
struct ceph_mds_snap_head {
|
||||
__le32 op; /* CEPH_SNAP_OP_* */
|
||||
__le64 split; /* ino to split off, if any */
|
||||
__le32 num_split_inos; /* # inos belonging to new child realm */
|
||||
__le32 num_split_realms; /* # child realms udner new child realm */
|
||||
__le32 trace_len; /* size of snap trace blob */
|
||||
} __attribute__ ((packed));
|
||||
/* followed by split ino list, then split realms, then the trace blob */
|
||||
|
||||
/*
|
||||
* encode info about a snaprealm, as viewed by a client
|
||||
*/
|
||||
struct ceph_mds_snap_realm {
|
||||
__le64 ino; /* ino */
|
||||
__le64 created; /* snap: when created */
|
||||
__le64 parent; /* ino: parent realm */
|
||||
__le64 parent_since; /* snap: same parent since */
|
||||
__le64 seq; /* snap: version */
|
||||
__le32 num_snaps;
|
||||
__le32 num_prior_parent_snaps;
|
||||
} __attribute__ ((packed));
|
||||
/* followed by my snap list, then prior parent snap list */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef FS_CEPH_HASH_H
|
||||
#define FS_CEPH_HASH_H
|
||||
|
||||
#define CEPH_STR_HASH_LINUX 0x1 /* linux dcache hash */
|
||||
#define CEPH_STR_HASH_RJENKINS 0x2 /* robert jenkins' */
|
||||
|
||||
extern unsigned ceph_str_hash_linux(const char *s, unsigned len);
|
||||
extern unsigned ceph_str_hash_rjenkins(const char *s, unsigned len);
|
||||
|
||||
extern unsigned ceph_str_hash(int type, const char *s, unsigned len);
|
||||
extern const char *ceph_str_hash_name(int type);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,33 @@
|
||||
#ifndef _FS_CEPH_DEBUGFS_H
|
||||
#define _FS_CEPH_DEBUGFS_H
|
||||
|
||||
#include "ceph_debug.h"
|
||||
#include "types.h"
|
||||
|
||||
#define CEPH_DEFINE_SHOW_FUNC(name) \
|
||||
static int name##_open(struct inode *inode, struct file *file) \
|
||||
{ \
|
||||
struct seq_file *sf; \
|
||||
int ret; \
|
||||
\
|
||||
ret = single_open(file, name, NULL); \
|
||||
sf = file->private_data; \
|
||||
sf->private = inode->i_private; \
|
||||
return ret; \
|
||||
} \
|
||||
\
|
||||
static const struct file_operations name##_fops = { \
|
||||
.open = name##_open, \
|
||||
.read = seq_read, \
|
||||
.llseek = seq_lseek, \
|
||||
.release = single_release, \
|
||||
};
|
||||
|
||||
/* debugfs.c */
|
||||
extern int ceph_debugfs_init(void);
|
||||
extern void ceph_debugfs_cleanup(void);
|
||||
extern int ceph_debugfs_client_init(struct ceph_client *client);
|
||||
extern void ceph_debugfs_client_cleanup(struct ceph_client *client);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
#ifndef __CEPH_DECODE_H
|
||||
#define __CEPH_DECODE_H
|
||||
|
||||
#include <asm/unaligned.h>
|
||||
#include <linux/time.h>
|
||||
|
||||
#include "types.h"
|
||||
|
||||
/*
|
||||
* in all cases,
|
||||
* void **p pointer to position pointer
|
||||
* void *end pointer to end of buffer (last byte + 1)
|
||||
*/
|
||||
|
||||
static inline u64 ceph_decode_64(void **p)
|
||||
{
|
||||
u64 v = get_unaligned_le64(*p);
|
||||
*p += sizeof(u64);
|
||||
return v;
|
||||
}
|
||||
static inline u32 ceph_decode_32(void **p)
|
||||
{
|
||||
u32 v = get_unaligned_le32(*p);
|
||||
*p += sizeof(u32);
|
||||
return v;
|
||||
}
|
||||
static inline u16 ceph_decode_16(void **p)
|
||||
{
|
||||
u16 v = get_unaligned_le16(*p);
|
||||
*p += sizeof(u16);
|
||||
return v;
|
||||
}
|
||||
static inline u8 ceph_decode_8(void **p)
|
||||
{
|
||||
u8 v = *(u8 *)*p;
|
||||
(*p)++;
|
||||
return v;
|
||||
}
|
||||
static inline void ceph_decode_copy(void **p, void *pv, size_t n)
|
||||
{
|
||||
memcpy(pv, *p, n);
|
||||
*p += n;
|
||||
}
|
||||
|
||||
/*
|
||||
* bounds check input.
|
||||
*/
|
||||
#define ceph_decode_need(p, end, n, bad) \
|
||||
do { \
|
||||
if (unlikely(*(p) + (n) > (end))) \
|
||||
goto bad; \
|
||||
} while (0)
|
||||
|
||||
#define ceph_decode_64_safe(p, end, v, bad) \
|
||||
do { \
|
||||
ceph_decode_need(p, end, sizeof(u64), bad); \
|
||||
v = ceph_decode_64(p); \
|
||||
} while (0)
|
||||
#define ceph_decode_32_safe(p, end, v, bad) \
|
||||
do { \
|
||||
ceph_decode_need(p, end, sizeof(u32), bad); \
|
||||
v = ceph_decode_32(p); \
|
||||
} while (0)
|
||||
#define ceph_decode_16_safe(p, end, v, bad) \
|
||||
do { \
|
||||
ceph_decode_need(p, end, sizeof(u16), bad); \
|
||||
v = ceph_decode_16(p); \
|
||||
} while (0)
|
||||
#define ceph_decode_8_safe(p, end, v, bad) \
|
||||
do { \
|
||||
ceph_decode_need(p, end, sizeof(u8), bad); \
|
||||
v = ceph_decode_8(p); \
|
||||
} while (0)
|
||||
|
||||
#define ceph_decode_copy_safe(p, end, pv, n, bad) \
|
||||
do { \
|
||||
ceph_decode_need(p, end, n, bad); \
|
||||
ceph_decode_copy(p, pv, n); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* struct ceph_timespec <-> struct timespec
|
||||
*/
|
||||
static inline void ceph_decode_timespec(struct timespec *ts,
|
||||
const struct ceph_timespec *tv)
|
||||
{
|
||||
ts->tv_sec = le32_to_cpu(tv->tv_sec);
|
||||
ts->tv_nsec = le32_to_cpu(tv->tv_nsec);
|
||||
}
|
||||
static inline void ceph_encode_timespec(struct ceph_timespec *tv,
|
||||
const struct timespec *ts)
|
||||
{
|
||||
tv->tv_sec = cpu_to_le32(ts->tv_sec);
|
||||
tv->tv_nsec = cpu_to_le32(ts->tv_nsec);
|
||||
}
|
||||
|
||||
/*
|
||||
* sockaddr_storage <-> ceph_sockaddr
|
||||
*/
|
||||
static inline void ceph_encode_addr(struct ceph_entity_addr *a)
|
||||
{
|
||||
__be16 ss_family = htons(a->in_addr.ss_family);
|
||||
a->in_addr.ss_family = *(__u16 *)&ss_family;
|
||||
}
|
||||
static inline void ceph_decode_addr(struct ceph_entity_addr *a)
|
||||
{
|
||||
__be16 ss_family = *(__be16 *)&a->in_addr.ss_family;
|
||||
a->in_addr.ss_family = ntohs(ss_family);
|
||||
WARN_ON(a->in_addr.ss_family == 512);
|
||||
}
|
||||
|
||||
/*
|
||||
* encoders
|
||||
*/
|
||||
static inline void ceph_encode_64(void **p, u64 v)
|
||||
{
|
||||
put_unaligned_le64(v, (__le64 *)*p);
|
||||
*p += sizeof(u64);
|
||||
}
|
||||
static inline void ceph_encode_32(void **p, u32 v)
|
||||
{
|
||||
put_unaligned_le32(v, (__le32 *)*p);
|
||||
*p += sizeof(u32);
|
||||
}
|
||||
static inline void ceph_encode_16(void **p, u16 v)
|
||||
{
|
||||
put_unaligned_le16(v, (__le16 *)*p);
|
||||
*p += sizeof(u16);
|
||||
}
|
||||
static inline void ceph_encode_8(void **p, u8 v)
|
||||
{
|
||||
*(u8 *)*p = v;
|
||||
(*p)++;
|
||||
}
|
||||
static inline void ceph_encode_copy(void **p, const void *s, int len)
|
||||
{
|
||||
memcpy(*p, s, len);
|
||||
*p += len;
|
||||
}
|
||||
|
||||
/*
|
||||
* filepath, string encoders
|
||||
*/
|
||||
static inline void ceph_encode_filepath(void **p, void *end,
|
||||
u64 ino, const char *path)
|
||||
{
|
||||
u32 len = path ? strlen(path) : 0;
|
||||
BUG_ON(*p + sizeof(ino) + sizeof(len) + len > end);
|
||||
ceph_encode_8(p, 1);
|
||||
ceph_encode_64(p, ino);
|
||||
ceph_encode_32(p, len);
|
||||
if (len)
|
||||
memcpy(*p, path, len);
|
||||
*p += len;
|
||||
}
|
||||
|
||||
static inline void ceph_encode_string(void **p, void *end,
|
||||
const char *s, u32 len)
|
||||
{
|
||||
BUG_ON(*p + sizeof(len) + len > end);
|
||||
ceph_encode_32(p, len);
|
||||
if (len)
|
||||
memcpy(*p, s, len);
|
||||
*p += len;
|
||||
}
|
||||
|
||||
#define ceph_encode_need(p, end, n, bad) \
|
||||
do { \
|
||||
if (unlikely(*(p) + (n) > (end))) \
|
||||
goto bad; \
|
||||
} while (0)
|
||||
|
||||
#define ceph_encode_64_safe(p, end, v, bad) \
|
||||
do { \
|
||||
ceph_encode_need(p, end, sizeof(u64), bad); \
|
||||
ceph_encode_64(p, v); \
|
||||
} while (0)
|
||||
#define ceph_encode_32_safe(p, end, v, bad) \
|
||||
do { \
|
||||
ceph_encode_need(p, end, sizeof(u32), bad); \
|
||||
ceph_encode_32(p, v); \
|
||||
} while (0)
|
||||
#define ceph_encode_16_safe(p, end, v, bad) \
|
||||
do { \
|
||||
ceph_encode_need(p, end, sizeof(u16), bad); \
|
||||
ceph_encode_16(p, v); \
|
||||
} while (0)
|
||||
|
||||
#define ceph_encode_copy_safe(p, end, pv, n, bad) \
|
||||
do { \
|
||||
ceph_encode_need(p, end, n, bad); \
|
||||
ceph_encode_copy(p, pv, n); \
|
||||
} while (0)
|
||||
#define ceph_encode_string_safe(p, end, s, n, bad) \
|
||||
do { \
|
||||
ceph_encode_need(p, end, n, bad); \
|
||||
ceph_encode_string(p, end, s, n); \
|
||||
} while (0)
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,249 @@
|
||||
#ifndef _FS_CEPH_LIBCEPH_H
|
||||
#define _FS_CEPH_LIBCEPH_H
|
||||
|
||||
#include "ceph_debug.h"
|
||||
|
||||
#include <asm/unaligned.h>
|
||||
#include <linux/backing-dev.h>
|
||||
#include <linux/completion.h>
|
||||
#include <linux/exportfs.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/mempool.h>
|
||||
#include <linux/pagemap.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/writeback.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include "types.h"
|
||||
#include "messenger.h"
|
||||
#include "msgpool.h"
|
||||
#include "mon_client.h"
|
||||
#include "osd_client.h"
|
||||
#include "ceph_fs.h"
|
||||
|
||||
/*
|
||||
* Supported features
|
||||
*/
|
||||
#define CEPH_FEATURE_SUPPORTED_DEFAULT CEPH_FEATURE_NOSRCADDR
|
||||
#define CEPH_FEATURE_REQUIRED_DEFAULT CEPH_FEATURE_NOSRCADDR
|
||||
|
||||
/*
|
||||
* mount options
|
||||
*/
|
||||
#define CEPH_OPT_FSID (1<<0)
|
||||
#define CEPH_OPT_NOSHARE (1<<1) /* don't share client with other sbs */
|
||||
#define CEPH_OPT_MYIP (1<<2) /* specified my ip */
|
||||
#define CEPH_OPT_NOCRC (1<<3) /* no data crc on writes */
|
||||
|
||||
#define CEPH_OPT_DEFAULT (0);
|
||||
|
||||
#define ceph_set_opt(client, opt) \
|
||||
(client)->options->flags |= CEPH_OPT_##opt;
|
||||
#define ceph_test_opt(client, opt) \
|
||||
(!!((client)->options->flags & CEPH_OPT_##opt))
|
||||
|
||||
struct ceph_options {
|
||||
int flags;
|
||||
struct ceph_fsid fsid;
|
||||
struct ceph_entity_addr my_addr;
|
||||
int mount_timeout;
|
||||
int osd_idle_ttl;
|
||||
int osd_timeout;
|
||||
int osd_keepalive_timeout;
|
||||
|
||||
/*
|
||||
* any type that can't be simply compared or doesn't need need
|
||||
* to be compared should go beyond this point,
|
||||
* ceph_compare_options() should be updated accordingly
|
||||
*/
|
||||
|
||||
struct ceph_entity_addr *mon_addr; /* should be the first
|
||||
pointer type of args */
|
||||
int num_mon;
|
||||
char *name;
|
||||
char *secret;
|
||||
};
|
||||
|
||||
/*
|
||||
* defaults
|
||||
*/
|
||||
#define CEPH_MOUNT_TIMEOUT_DEFAULT 60
|
||||
#define CEPH_OSD_TIMEOUT_DEFAULT 60 /* seconds */
|
||||
#define CEPH_OSD_KEEPALIVE_DEFAULT 5
|
||||
#define CEPH_OSD_IDLE_TTL_DEFAULT 60
|
||||
#define CEPH_MOUNT_RSIZE_DEFAULT (512*1024) /* readahead */
|
||||
|
||||
#define CEPH_MSG_MAX_FRONT_LEN (16*1024*1024)
|
||||
#define CEPH_MSG_MAX_DATA_LEN (16*1024*1024)
|
||||
|
||||
#define CEPH_AUTH_NAME_DEFAULT "guest"
|
||||
|
||||
/*
|
||||
* Delay telling the MDS we no longer want caps, in case we reopen
|
||||
* the file. Delay a minimum amount of time, even if we send a cap
|
||||
* message for some other reason. Otherwise, take the oppotunity to
|
||||
* update the mds to avoid sending another message later.
|
||||
*/
|
||||
#define CEPH_CAPS_WANTED_DELAY_MIN_DEFAULT 5 /* cap release delay */
|
||||
#define CEPH_CAPS_WANTED_DELAY_MAX_DEFAULT 60 /* cap release delay */
|
||||
|
||||
#define CEPH_CAP_RELEASE_SAFETY_DEFAULT (CEPH_CAPS_PER_RELEASE * 4)
|
||||
|
||||
/* mount state */
|
||||
enum {
|
||||
CEPH_MOUNT_MOUNTING,
|
||||
CEPH_MOUNT_MOUNTED,
|
||||
CEPH_MOUNT_UNMOUNTING,
|
||||
CEPH_MOUNT_UNMOUNTED,
|
||||
CEPH_MOUNT_SHUTDOWN,
|
||||
};
|
||||
|
||||
/*
|
||||
* subtract jiffies
|
||||
*/
|
||||
static inline unsigned long time_sub(unsigned long a, unsigned long b)
|
||||
{
|
||||
BUG_ON(time_after(b, a));
|
||||
return (long)a - (long)b;
|
||||
}
|
||||
|
||||
struct ceph_mds_client;
|
||||
|
||||
/*
|
||||
* per client state
|
||||
*
|
||||
* possibly shared by multiple mount points, if they are
|
||||
* mounting the same ceph filesystem/cluster.
|
||||
*/
|
||||
struct ceph_client {
|
||||
struct ceph_fsid fsid;
|
||||
bool have_fsid;
|
||||
|
||||
void *private;
|
||||
|
||||
struct ceph_options *options;
|
||||
|
||||
struct mutex mount_mutex; /* serialize mount attempts */
|
||||
wait_queue_head_t auth_wq;
|
||||
int auth_err;
|
||||
|
||||
int (*extra_mon_dispatch)(struct ceph_client *, struct ceph_msg *);
|
||||
|
||||
u32 supported_features;
|
||||
u32 required_features;
|
||||
|
||||
struct ceph_messenger *msgr; /* messenger instance */
|
||||
struct ceph_mon_client monc;
|
||||
struct ceph_osd_client osdc;
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
struct dentry *debugfs_dir;
|
||||
struct dentry *debugfs_monmap;
|
||||
struct dentry *debugfs_osdmap;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* snapshots
|
||||
*/
|
||||
|
||||
/*
|
||||
* A "snap context" is the set of existing snapshots when we
|
||||
* write data. It is used by the OSD to guide its COW behavior.
|
||||
*
|
||||
* The ceph_snap_context is refcounted, and attached to each dirty
|
||||
* page, indicating which context the dirty data belonged when it was
|
||||
* dirtied.
|
||||
*/
|
||||
struct ceph_snap_context {
|
||||
atomic_t nref;
|
||||
u64 seq;
|
||||
int num_snaps;
|
||||
u64 snaps[];
|
||||
};
|
||||
|
||||
static inline struct ceph_snap_context *
|
||||
ceph_get_snap_context(struct ceph_snap_context *sc)
|
||||
{
|
||||
/*
|
||||
printk("get_snap_context %p %d -> %d\n", sc, atomic_read(&sc->nref),
|
||||
atomic_read(&sc->nref)+1);
|
||||
*/
|
||||
if (sc)
|
||||
atomic_inc(&sc->nref);
|
||||
return sc;
|
||||
}
|
||||
|
||||
static inline void ceph_put_snap_context(struct ceph_snap_context *sc)
|
||||
{
|
||||
if (!sc)
|
||||
return;
|
||||
/*
|
||||
printk("put_snap_context %p %d -> %d\n", sc, atomic_read(&sc->nref),
|
||||
atomic_read(&sc->nref)-1);
|
||||
*/
|
||||
if (atomic_dec_and_test(&sc->nref)) {
|
||||
/*printk(" deleting snap_context %p\n", sc);*/
|
||||
kfree(sc);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* calculate the number of pages a given length and offset map onto,
|
||||
* if we align the data.
|
||||
*/
|
||||
static inline int calc_pages_for(u64 off, u64 len)
|
||||
{
|
||||
return ((off+len+PAGE_CACHE_SIZE-1) >> PAGE_CACHE_SHIFT) -
|
||||
(off >> PAGE_CACHE_SHIFT);
|
||||
}
|
||||
|
||||
/* ceph_common.c */
|
||||
extern const char *ceph_msg_type_name(int type);
|
||||
extern int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid);
|
||||
extern struct kmem_cache *ceph_inode_cachep;
|
||||
extern struct kmem_cache *ceph_cap_cachep;
|
||||
extern struct kmem_cache *ceph_dentry_cachep;
|
||||
extern struct kmem_cache *ceph_file_cachep;
|
||||
|
||||
extern int ceph_parse_options(struct ceph_options **popt, char *options,
|
||||
const char *dev_name, const char *dev_name_end,
|
||||
int (*parse_extra_token)(char *c, void *private),
|
||||
void *private);
|
||||
extern void ceph_destroy_options(struct ceph_options *opt);
|
||||
extern int ceph_compare_options(struct ceph_options *new_opt,
|
||||
struct ceph_client *client);
|
||||
extern struct ceph_client *ceph_create_client(struct ceph_options *opt,
|
||||
void *private);
|
||||
extern u64 ceph_client_id(struct ceph_client *client);
|
||||
extern void ceph_destroy_client(struct ceph_client *client);
|
||||
extern int __ceph_open_session(struct ceph_client *client,
|
||||
unsigned long started);
|
||||
extern int ceph_open_session(struct ceph_client *client);
|
||||
|
||||
/* pagevec.c */
|
||||
extern void ceph_release_page_vector(struct page **pages, int num_pages);
|
||||
|
||||
extern struct page **ceph_get_direct_page_vector(const char __user *data,
|
||||
int num_pages,
|
||||
loff_t off, size_t len);
|
||||
extern void ceph_put_page_vector(struct page **pages, int num_pages);
|
||||
extern void ceph_release_page_vector(struct page **pages, int num_pages);
|
||||
extern struct page **ceph_alloc_page_vector(int num_pages, gfp_t flags);
|
||||
extern int ceph_copy_user_to_page_vector(struct page **pages,
|
||||
const char __user *data,
|
||||
loff_t off, size_t len);
|
||||
extern int ceph_copy_to_page_vector(struct page **pages,
|
||||
const char *data,
|
||||
loff_t off, size_t len);
|
||||
extern int ceph_copy_from_page_vector(struct page **pages,
|
||||
char *data,
|
||||
loff_t off, size_t len);
|
||||
extern int ceph_copy_page_vector_to_user(struct page **pages, char __user *data,
|
||||
loff_t off, size_t len);
|
||||
extern void ceph_zero_page_vector_range(int off, int len, struct page **pages);
|
||||
|
||||
|
||||
#endif /* _FS_CEPH_SUPER_H */
|
||||
@@ -0,0 +1,62 @@
|
||||
#ifndef _FS_CEPH_MDSMAP_H
|
||||
#define _FS_CEPH_MDSMAP_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
/*
|
||||
* mds map - describe servers in the mds cluster.
|
||||
*
|
||||
* we limit fields to those the client actually xcares about
|
||||
*/
|
||||
struct ceph_mds_info {
|
||||
u64 global_id;
|
||||
struct ceph_entity_addr addr;
|
||||
s32 state;
|
||||
int num_export_targets;
|
||||
bool laggy;
|
||||
u32 *export_targets;
|
||||
};
|
||||
|
||||
struct ceph_mdsmap {
|
||||
u32 m_epoch, m_client_epoch, m_last_failure;
|
||||
u32 m_root;
|
||||
u32 m_session_timeout; /* seconds */
|
||||
u32 m_session_autoclose; /* seconds */
|
||||
u64 m_max_file_size;
|
||||
u32 m_max_mds; /* size of m_addr, m_state arrays */
|
||||
struct ceph_mds_info *m_info;
|
||||
|
||||
/* which object pools file data can be stored in */
|
||||
int m_num_data_pg_pools;
|
||||
u32 *m_data_pg_pools;
|
||||
u32 m_cas_pg_pool;
|
||||
};
|
||||
|
||||
static inline struct ceph_entity_addr *
|
||||
ceph_mdsmap_get_addr(struct ceph_mdsmap *m, int w)
|
||||
{
|
||||
if (w >= m->m_max_mds)
|
||||
return NULL;
|
||||
return &m->m_info[w].addr;
|
||||
}
|
||||
|
||||
static inline int ceph_mdsmap_get_state(struct ceph_mdsmap *m, int w)
|
||||
{
|
||||
BUG_ON(w < 0);
|
||||
if (w >= m->m_max_mds)
|
||||
return CEPH_MDS_STATE_DNE;
|
||||
return m->m_info[w].state;
|
||||
}
|
||||
|
||||
static inline bool ceph_mdsmap_is_laggy(struct ceph_mdsmap *m, int w)
|
||||
{
|
||||
if (w >= 0 && w < m->m_max_mds)
|
||||
return m->m_info[w].laggy;
|
||||
return false;
|
||||
}
|
||||
|
||||
extern int ceph_mdsmap_get_random_mds(struct ceph_mdsmap *m);
|
||||
extern struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end);
|
||||
extern void ceph_mdsmap_destroy(struct ceph_mdsmap *m);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,261 @@
|
||||
#ifndef __FS_CEPH_MESSENGER_H
|
||||
#define __FS_CEPH_MESSENGER_H
|
||||
|
||||
#include <linux/kref.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/net.h>
|
||||
#include <linux/radix-tree.h>
|
||||
#include <linux/uio.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/workqueue.h>
|
||||
|
||||
#include "types.h"
|
||||
#include "buffer.h"
|
||||
|
||||
struct ceph_msg;
|
||||
struct ceph_connection;
|
||||
|
||||
extern struct workqueue_struct *ceph_msgr_wq; /* receive work queue */
|
||||
|
||||
/*
|
||||
* Ceph defines these callbacks for handling connection events.
|
||||
*/
|
||||
struct ceph_connection_operations {
|
||||
struct ceph_connection *(*get)(struct ceph_connection *);
|
||||
void (*put)(struct ceph_connection *);
|
||||
|
||||
/* handle an incoming message. */
|
||||
void (*dispatch) (struct ceph_connection *con, struct ceph_msg *m);
|
||||
|
||||
/* authorize an outgoing connection */
|
||||
int (*get_authorizer) (struct ceph_connection *con,
|
||||
void **buf, int *len, int *proto,
|
||||
void **reply_buf, int *reply_len, int force_new);
|
||||
int (*verify_authorizer_reply) (struct ceph_connection *con, int len);
|
||||
int (*invalidate_authorizer)(struct ceph_connection *con);
|
||||
|
||||
/* protocol version mismatch */
|
||||
void (*bad_proto) (struct ceph_connection *con);
|
||||
|
||||
/* there was some error on the socket (disconnect, whatever) */
|
||||
void (*fault) (struct ceph_connection *con);
|
||||
|
||||
/* a remote host as terminated a message exchange session, and messages
|
||||
* we sent (or they tried to send us) may be lost. */
|
||||
void (*peer_reset) (struct ceph_connection *con);
|
||||
|
||||
struct ceph_msg * (*alloc_msg) (struct ceph_connection *con,
|
||||
struct ceph_msg_header *hdr,
|
||||
int *skip);
|
||||
};
|
||||
|
||||
/* use format string %s%d */
|
||||
#define ENTITY_NAME(n) ceph_entity_type_name((n).type), le64_to_cpu((n).num)
|
||||
|
||||
struct ceph_messenger {
|
||||
struct ceph_entity_inst inst; /* my name+address */
|
||||
struct ceph_entity_addr my_enc_addr;
|
||||
struct page *zero_page; /* used in certain error cases */
|
||||
|
||||
bool nocrc;
|
||||
|
||||
/*
|
||||
* the global_seq counts connections i (attempt to) initiate
|
||||
* in order to disambiguate certain connect race conditions.
|
||||
*/
|
||||
u32 global_seq;
|
||||
spinlock_t global_seq_lock;
|
||||
|
||||
u32 supported_features;
|
||||
u32 required_features;
|
||||
};
|
||||
|
||||
/*
|
||||
* a single message. it contains a header (src, dest, message type, etc.),
|
||||
* footer (crc values, mainly), a "front" message body, and possibly a
|
||||
* data payload (stored in some number of pages).
|
||||
*/
|
||||
struct ceph_msg {
|
||||
struct ceph_msg_header hdr; /* header */
|
||||
struct ceph_msg_footer footer; /* footer */
|
||||
struct kvec front; /* unaligned blobs of message */
|
||||
struct ceph_buffer *middle;
|
||||
struct page **pages; /* data payload. NOT OWNER. */
|
||||
unsigned nr_pages; /* size of page array */
|
||||
struct ceph_pagelist *pagelist; /* instead of pages */
|
||||
struct list_head list_head;
|
||||
struct kref kref;
|
||||
struct bio *bio; /* instead of pages/pagelist */
|
||||
struct bio *bio_iter; /* bio iterator */
|
||||
int bio_seg; /* current bio segment */
|
||||
struct ceph_pagelist *trail; /* the trailing part of the data */
|
||||
bool front_is_vmalloc;
|
||||
bool more_to_follow;
|
||||
bool needs_out_seq;
|
||||
int front_max;
|
||||
|
||||
struct ceph_msgpool *pool;
|
||||
};
|
||||
|
||||
struct ceph_msg_pos {
|
||||
int page, page_pos; /* which page; offset in page */
|
||||
int data_pos; /* offset in data payload */
|
||||
int did_page_crc; /* true if we've calculated crc for current page */
|
||||
};
|
||||
|
||||
/* ceph connection fault delay defaults, for exponential backoff */
|
||||
#define BASE_DELAY_INTERVAL (HZ/2)
|
||||
#define MAX_DELAY_INTERVAL (5 * 60 * HZ)
|
||||
|
||||
/*
|
||||
* ceph_connection state bit flags
|
||||
*
|
||||
* QUEUED and BUSY are used together to ensure that only a single
|
||||
* thread is currently opening, reading or writing data to the socket.
|
||||
*/
|
||||
#define LOSSYTX 0 /* we can close channel or drop messages on errors */
|
||||
#define CONNECTING 1
|
||||
#define NEGOTIATING 2
|
||||
#define KEEPALIVE_PENDING 3
|
||||
#define WRITE_PENDING 4 /* we have data ready to send */
|
||||
#define QUEUED 5 /* there is work queued on this connection */
|
||||
#define BUSY 6 /* work is being done */
|
||||
#define STANDBY 8 /* no outgoing messages, socket closed. we keep
|
||||
* the ceph_connection around to maintain shared
|
||||
* state with the peer. */
|
||||
#define CLOSED 10 /* we've closed the connection */
|
||||
#define SOCK_CLOSED 11 /* socket state changed to closed */
|
||||
#define OPENING 13 /* open connection w/ (possibly new) peer */
|
||||
#define DEAD 14 /* dead, about to kfree */
|
||||
|
||||
/*
|
||||
* A single connection with another host.
|
||||
*
|
||||
* We maintain a queue of outgoing messages, and some session state to
|
||||
* ensure that we can preserve the lossless, ordered delivery of
|
||||
* messages in the case of a TCP disconnect.
|
||||
*/
|
||||
struct ceph_connection {
|
||||
void *private;
|
||||
atomic_t nref;
|
||||
|
||||
const struct ceph_connection_operations *ops;
|
||||
|
||||
struct ceph_messenger *msgr;
|
||||
struct socket *sock;
|
||||
unsigned long state; /* connection state (see flags above) */
|
||||
const char *error_msg; /* error message, if any */
|
||||
|
||||
struct ceph_entity_addr peer_addr; /* peer address */
|
||||
struct ceph_entity_name peer_name; /* peer name */
|
||||
struct ceph_entity_addr peer_addr_for_me;
|
||||
unsigned peer_features;
|
||||
u32 connect_seq; /* identify the most recent connection
|
||||
attempt for this connection, client */
|
||||
u32 peer_global_seq; /* peer's global seq for this connection */
|
||||
|
||||
int auth_retry; /* true if we need a newer authorizer */
|
||||
void *auth_reply_buf; /* where to put the authorizer reply */
|
||||
int auth_reply_buf_len;
|
||||
|
||||
struct mutex mutex;
|
||||
|
||||
/* out queue */
|
||||
struct list_head out_queue;
|
||||
struct list_head out_sent; /* sending or sent but unacked */
|
||||
u64 out_seq; /* last message queued for send */
|
||||
bool out_keepalive_pending;
|
||||
|
||||
u64 in_seq, in_seq_acked; /* last message received, acked */
|
||||
|
||||
/* connection negotiation temps */
|
||||
char in_banner[CEPH_BANNER_MAX_LEN];
|
||||
union {
|
||||
struct { /* outgoing connection */
|
||||
struct ceph_msg_connect out_connect;
|
||||
struct ceph_msg_connect_reply in_reply;
|
||||
};
|
||||
struct { /* incoming */
|
||||
struct ceph_msg_connect in_connect;
|
||||
struct ceph_msg_connect_reply out_reply;
|
||||
};
|
||||
};
|
||||
struct ceph_entity_addr actual_peer_addr;
|
||||
|
||||
/* message out temps */
|
||||
struct ceph_msg *out_msg; /* sending message (== tail of
|
||||
out_sent) */
|
||||
bool out_msg_done;
|
||||
struct ceph_msg_pos out_msg_pos;
|
||||
|
||||
struct kvec out_kvec[8], /* sending header/footer data */
|
||||
*out_kvec_cur;
|
||||
int out_kvec_left; /* kvec's left in out_kvec */
|
||||
int out_skip; /* skip this many bytes */
|
||||
int out_kvec_bytes; /* total bytes left */
|
||||
bool out_kvec_is_msg; /* kvec refers to out_msg */
|
||||
int out_more; /* there is more data after the kvecs */
|
||||
__le64 out_temp_ack; /* for writing an ack */
|
||||
|
||||
/* message in temps */
|
||||
struct ceph_msg_header in_hdr;
|
||||
struct ceph_msg *in_msg;
|
||||
struct ceph_msg_pos in_msg_pos;
|
||||
u32 in_front_crc, in_middle_crc, in_data_crc; /* calculated crc */
|
||||
|
||||
char in_tag; /* protocol control byte */
|
||||
int in_base_pos; /* bytes read */
|
||||
__le64 in_temp_ack; /* for reading an ack */
|
||||
|
||||
struct delayed_work work; /* send|recv work */
|
||||
unsigned long delay; /* current delay interval */
|
||||
};
|
||||
|
||||
|
||||
extern const char *ceph_pr_addr(const struct sockaddr_storage *ss);
|
||||
extern int ceph_parse_ips(const char *c, const char *end,
|
||||
struct ceph_entity_addr *addr,
|
||||
int max_count, int *count);
|
||||
|
||||
|
||||
extern int ceph_msgr_init(void);
|
||||
extern void ceph_msgr_exit(void);
|
||||
extern void ceph_msgr_flush(void);
|
||||
|
||||
extern struct ceph_messenger *ceph_messenger_create(
|
||||
struct ceph_entity_addr *myaddr,
|
||||
u32 features, u32 required);
|
||||
extern void ceph_messenger_destroy(struct ceph_messenger *);
|
||||
|
||||
extern void ceph_con_init(struct ceph_messenger *msgr,
|
||||
struct ceph_connection *con);
|
||||
extern void ceph_con_open(struct ceph_connection *con,
|
||||
struct ceph_entity_addr *addr);
|
||||
extern bool ceph_con_opened(struct ceph_connection *con);
|
||||
extern void ceph_con_close(struct ceph_connection *con);
|
||||
extern void ceph_con_send(struct ceph_connection *con, struct ceph_msg *msg);
|
||||
extern void ceph_con_revoke(struct ceph_connection *con, struct ceph_msg *msg);
|
||||
extern void ceph_con_revoke_message(struct ceph_connection *con,
|
||||
struct ceph_msg *msg);
|
||||
extern void ceph_con_keepalive(struct ceph_connection *con);
|
||||
extern struct ceph_connection *ceph_con_get(struct ceph_connection *con);
|
||||
extern void ceph_con_put(struct ceph_connection *con);
|
||||
|
||||
extern struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags);
|
||||
extern void ceph_msg_kfree(struct ceph_msg *m);
|
||||
|
||||
|
||||
static inline struct ceph_msg *ceph_msg_get(struct ceph_msg *msg)
|
||||
{
|
||||
kref_get(&msg->kref);
|
||||
return msg;
|
||||
}
|
||||
extern void ceph_msg_last_put(struct kref *kref);
|
||||
static inline void ceph_msg_put(struct ceph_msg *msg)
|
||||
{
|
||||
kref_put(&msg->kref, ceph_msg_last_put);
|
||||
}
|
||||
|
||||
extern void ceph_msg_dump(struct ceph_msg *msg);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,122 @@
|
||||
#ifndef _FS_CEPH_MON_CLIENT_H
|
||||
#define _FS_CEPH_MON_CLIENT_H
|
||||
|
||||
#include <linux/completion.h>
|
||||
#include <linux/kref.h>
|
||||
#include <linux/rbtree.h>
|
||||
|
||||
#include "messenger.h"
|
||||
|
||||
struct ceph_client;
|
||||
struct ceph_mount_args;
|
||||
struct ceph_auth_client;
|
||||
|
||||
/*
|
||||
* The monitor map enumerates the set of all monitors.
|
||||
*/
|
||||
struct ceph_monmap {
|
||||
struct ceph_fsid fsid;
|
||||
u32 epoch;
|
||||
u32 num_mon;
|
||||
struct ceph_entity_inst mon_inst[0];
|
||||
};
|
||||
|
||||
struct ceph_mon_client;
|
||||
struct ceph_mon_generic_request;
|
||||
|
||||
|
||||
/*
|
||||
* Generic mechanism for resending monitor requests.
|
||||
*/
|
||||
typedef void (*ceph_monc_request_func_t)(struct ceph_mon_client *monc,
|
||||
int newmon);
|
||||
|
||||
/* a pending monitor request */
|
||||
struct ceph_mon_request {
|
||||
struct ceph_mon_client *monc;
|
||||
struct delayed_work delayed_work;
|
||||
unsigned long delay;
|
||||
ceph_monc_request_func_t do_request;
|
||||
};
|
||||
|
||||
/*
|
||||
* ceph_mon_generic_request is being used for the statfs and poolop requests
|
||||
* which are bening done a bit differently because we need to get data back
|
||||
* to the caller
|
||||
*/
|
||||
struct ceph_mon_generic_request {
|
||||
struct kref kref;
|
||||
u64 tid;
|
||||
struct rb_node node;
|
||||
int result;
|
||||
void *buf;
|
||||
int buf_len;
|
||||
struct completion completion;
|
||||
struct ceph_msg *request; /* original request */
|
||||
struct ceph_msg *reply; /* and reply */
|
||||
};
|
||||
|
||||
struct ceph_mon_client {
|
||||
struct ceph_client *client;
|
||||
struct ceph_monmap *monmap;
|
||||
|
||||
struct mutex mutex;
|
||||
struct delayed_work delayed_work;
|
||||
|
||||
struct ceph_auth_client *auth;
|
||||
struct ceph_msg *m_auth, *m_auth_reply, *m_subscribe, *m_subscribe_ack;
|
||||
int pending_auth;
|
||||
|
||||
bool hunting;
|
||||
int cur_mon; /* last monitor i contacted */
|
||||
unsigned long sub_sent, sub_renew_after;
|
||||
struct ceph_connection *con;
|
||||
bool have_fsid;
|
||||
|
||||
/* pending generic requests */
|
||||
struct rb_root generic_request_tree;
|
||||
int num_generic_requests;
|
||||
u64 last_tid;
|
||||
|
||||
/* mds/osd map */
|
||||
int want_mdsmap;
|
||||
int want_next_osdmap; /* 1 = want, 2 = want+asked */
|
||||
u32 have_osdmap, have_mdsmap;
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
struct dentry *debugfs_file;
|
||||
#endif
|
||||
};
|
||||
|
||||
extern struct ceph_monmap *ceph_monmap_decode(void *p, void *end);
|
||||
extern int ceph_monmap_contains(struct ceph_monmap *m,
|
||||
struct ceph_entity_addr *addr);
|
||||
|
||||
extern int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl);
|
||||
extern void ceph_monc_stop(struct ceph_mon_client *monc);
|
||||
|
||||
/*
|
||||
* The model here is to indicate that we need a new map of at least
|
||||
* epoch @want, and also call in when we receive a map. We will
|
||||
* periodically rerequest the map from the monitor cluster until we
|
||||
* get what we want.
|
||||
*/
|
||||
extern int ceph_monc_got_mdsmap(struct ceph_mon_client *monc, u32 have);
|
||||
extern int ceph_monc_got_osdmap(struct ceph_mon_client *monc, u32 have);
|
||||
|
||||
extern void ceph_monc_request_next_osdmap(struct ceph_mon_client *monc);
|
||||
|
||||
extern int ceph_monc_do_statfs(struct ceph_mon_client *monc,
|
||||
struct ceph_statfs *buf);
|
||||
|
||||
extern int ceph_monc_open_session(struct ceph_mon_client *monc);
|
||||
|
||||
extern int ceph_monc_validate_auth(struct ceph_mon_client *monc);
|
||||
|
||||
extern int ceph_monc_create_snapid(struct ceph_mon_client *monc,
|
||||
u32 pool, u64 *snapid);
|
||||
|
||||
extern int ceph_monc_delete_snapid(struct ceph_mon_client *monc,
|
||||
u32 pool, u64 snapid);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,25 @@
|
||||
#ifndef _FS_CEPH_MSGPOOL
|
||||
#define _FS_CEPH_MSGPOOL
|
||||
|
||||
#include <linux/mempool.h>
|
||||
#include "messenger.h"
|
||||
|
||||
/*
|
||||
* we use memory pools for preallocating messages we may receive, to
|
||||
* avoid unexpected OOM conditions.
|
||||
*/
|
||||
struct ceph_msgpool {
|
||||
const char *name;
|
||||
mempool_t *pool;
|
||||
int front_len; /* preallocated payload size */
|
||||
};
|
||||
|
||||
extern int ceph_msgpool_init(struct ceph_msgpool *pool,
|
||||
int front_len, int size, bool blocking,
|
||||
const char *name);
|
||||
extern void ceph_msgpool_destroy(struct ceph_msgpool *pool);
|
||||
extern struct ceph_msg *ceph_msgpool_get(struct ceph_msgpool *,
|
||||
int front_len);
|
||||
extern void ceph_msgpool_put(struct ceph_msgpool *, struct ceph_msg *);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,175 @@
|
||||
#ifndef CEPH_MSGR_H
|
||||
#define CEPH_MSGR_H
|
||||
|
||||
/*
|
||||
* Data types for message passing layer used by Ceph.
|
||||
*/
|
||||
|
||||
#define CEPH_MON_PORT 6789 /* default monitor port */
|
||||
|
||||
/*
|
||||
* client-side processes will try to bind to ports in this
|
||||
* range, simply for the benefit of tools like nmap or wireshark
|
||||
* that would like to identify the protocol.
|
||||
*/
|
||||
#define CEPH_PORT_FIRST 6789
|
||||
#define CEPH_PORT_START 6800 /* non-monitors start here */
|
||||
#define CEPH_PORT_LAST 6900
|
||||
|
||||
/*
|
||||
* tcp connection banner. include a protocol version. and adjust
|
||||
* whenever the wire protocol changes. try to keep this string length
|
||||
* constant.
|
||||
*/
|
||||
#define CEPH_BANNER "ceph v027"
|
||||
#define CEPH_BANNER_MAX_LEN 30
|
||||
|
||||
|
||||
/*
|
||||
* Rollover-safe type and comparator for 32-bit sequence numbers.
|
||||
* Comparator returns -1, 0, or 1.
|
||||
*/
|
||||
typedef __u32 ceph_seq_t;
|
||||
|
||||
static inline __s32 ceph_seq_cmp(__u32 a, __u32 b)
|
||||
{
|
||||
return (__s32)a - (__s32)b;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* entity_name -- logical name for a process participating in the
|
||||
* network, e.g. 'mds0' or 'osd3'.
|
||||
*/
|
||||
struct ceph_entity_name {
|
||||
__u8 type; /* CEPH_ENTITY_TYPE_* */
|
||||
__le64 num;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define CEPH_ENTITY_TYPE_MON 0x01
|
||||
#define CEPH_ENTITY_TYPE_MDS 0x02
|
||||
#define CEPH_ENTITY_TYPE_OSD 0x04
|
||||
#define CEPH_ENTITY_TYPE_CLIENT 0x08
|
||||
#define CEPH_ENTITY_TYPE_AUTH 0x20
|
||||
|
||||
#define CEPH_ENTITY_TYPE_ANY 0xFF
|
||||
|
||||
extern const char *ceph_entity_type_name(int type);
|
||||
|
||||
/*
|
||||
* entity_addr -- network address
|
||||
*/
|
||||
struct ceph_entity_addr {
|
||||
__le32 type;
|
||||
__le32 nonce; /* unique id for process (e.g. pid) */
|
||||
struct sockaddr_storage in_addr;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ceph_entity_inst {
|
||||
struct ceph_entity_name name;
|
||||
struct ceph_entity_addr addr;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
/* used by message exchange protocol */
|
||||
#define CEPH_MSGR_TAG_READY 1 /* server->client: ready for messages */
|
||||
#define CEPH_MSGR_TAG_RESETSESSION 2 /* server->client: reset, try again */
|
||||
#define CEPH_MSGR_TAG_WAIT 3 /* server->client: wait for racing
|
||||
incoming connection */
|
||||
#define CEPH_MSGR_TAG_RETRY_SESSION 4 /* server->client + cseq: try again
|
||||
with higher cseq */
|
||||
#define CEPH_MSGR_TAG_RETRY_GLOBAL 5 /* server->client + gseq: try again
|
||||
with higher gseq */
|
||||
#define CEPH_MSGR_TAG_CLOSE 6 /* closing pipe */
|
||||
#define CEPH_MSGR_TAG_MSG 7 /* message */
|
||||
#define CEPH_MSGR_TAG_ACK 8 /* message ack */
|
||||
#define CEPH_MSGR_TAG_KEEPALIVE 9 /* just a keepalive byte! */
|
||||
#define CEPH_MSGR_TAG_BADPROTOVER 10 /* bad protocol version */
|
||||
#define CEPH_MSGR_TAG_BADAUTHORIZER 11 /* bad authorizer */
|
||||
#define CEPH_MSGR_TAG_FEATURES 12 /* insufficient features */
|
||||
|
||||
|
||||
/*
|
||||
* connection negotiation
|
||||
*/
|
||||
struct ceph_msg_connect {
|
||||
__le64 features; /* supported feature bits */
|
||||
__le32 host_type; /* CEPH_ENTITY_TYPE_* */
|
||||
__le32 global_seq; /* count connections initiated by this host */
|
||||
__le32 connect_seq; /* count connections initiated in this session */
|
||||
__le32 protocol_version;
|
||||
__le32 authorizer_protocol;
|
||||
__le32 authorizer_len;
|
||||
__u8 flags; /* CEPH_MSG_CONNECT_* */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ceph_msg_connect_reply {
|
||||
__u8 tag;
|
||||
__le64 features; /* feature bits for this session */
|
||||
__le32 global_seq;
|
||||
__le32 connect_seq;
|
||||
__le32 protocol_version;
|
||||
__le32 authorizer_len;
|
||||
__u8 flags;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define CEPH_MSG_CONNECT_LOSSY 1 /* messages i send may be safely dropped */
|
||||
|
||||
|
||||
/*
|
||||
* message header
|
||||
*/
|
||||
struct ceph_msg_header_old {
|
||||
__le64 seq; /* message seq# for this session */
|
||||
__le64 tid; /* transaction id */
|
||||
__le16 type; /* message type */
|
||||
__le16 priority; /* priority. higher value == higher priority */
|
||||
__le16 version; /* version of message encoding */
|
||||
|
||||
__le32 front_len; /* bytes in main payload */
|
||||
__le32 middle_len;/* bytes in middle payload */
|
||||
__le32 data_len; /* bytes of data payload */
|
||||
__le16 data_off; /* sender: include full offset;
|
||||
receiver: mask against ~PAGE_MASK */
|
||||
|
||||
struct ceph_entity_inst src, orig_src;
|
||||
__le32 reserved;
|
||||
__le32 crc; /* header crc32c */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ceph_msg_header {
|
||||
__le64 seq; /* message seq# for this session */
|
||||
__le64 tid; /* transaction id */
|
||||
__le16 type; /* message type */
|
||||
__le16 priority; /* priority. higher value == higher priority */
|
||||
__le16 version; /* version of message encoding */
|
||||
|
||||
__le32 front_len; /* bytes in main payload */
|
||||
__le32 middle_len;/* bytes in middle payload */
|
||||
__le32 data_len; /* bytes of data payload */
|
||||
__le16 data_off; /* sender: include full offset;
|
||||
receiver: mask against ~PAGE_MASK */
|
||||
|
||||
struct ceph_entity_name src;
|
||||
__le32 reserved;
|
||||
__le32 crc; /* header crc32c */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define CEPH_MSG_PRIO_LOW 64
|
||||
#define CEPH_MSG_PRIO_DEFAULT 127
|
||||
#define CEPH_MSG_PRIO_HIGH 196
|
||||
#define CEPH_MSG_PRIO_HIGHEST 255
|
||||
|
||||
/*
|
||||
* follows data payload
|
||||
*/
|
||||
struct ceph_msg_footer {
|
||||
__le32 front_crc, middle_crc, data_crc;
|
||||
__u8 flags;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define CEPH_MSG_FOOTER_COMPLETE (1<<0) /* msg wasn't aborted */
|
||||
#define CEPH_MSG_FOOTER_NOCRC (1<<1) /* no data crc */
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,234 @@
|
||||
#ifndef _FS_CEPH_OSD_CLIENT_H
|
||||
#define _FS_CEPH_OSD_CLIENT_H
|
||||
|
||||
#include <linux/completion.h>
|
||||
#include <linux/kref.h>
|
||||
#include <linux/mempool.h>
|
||||
#include <linux/rbtree.h>
|
||||
|
||||
#include "types.h"
|
||||
#include "osdmap.h"
|
||||
#include "messenger.h"
|
||||
|
||||
struct ceph_msg;
|
||||
struct ceph_snap_context;
|
||||
struct ceph_osd_request;
|
||||
struct ceph_osd_client;
|
||||
struct ceph_authorizer;
|
||||
struct ceph_pagelist;
|
||||
|
||||
/*
|
||||
* completion callback for async writepages
|
||||
*/
|
||||
typedef void (*ceph_osdc_callback_t)(struct ceph_osd_request *,
|
||||
struct ceph_msg *);
|
||||
|
||||
/* a given osd we're communicating with */
|
||||
struct ceph_osd {
|
||||
atomic_t o_ref;
|
||||
struct ceph_osd_client *o_osdc;
|
||||
int o_osd;
|
||||
int o_incarnation;
|
||||
struct rb_node o_node;
|
||||
struct ceph_connection o_con;
|
||||
struct list_head o_requests;
|
||||
struct list_head o_osd_lru;
|
||||
struct ceph_authorizer *o_authorizer;
|
||||
void *o_authorizer_buf, *o_authorizer_reply_buf;
|
||||
size_t o_authorizer_buf_len, o_authorizer_reply_buf_len;
|
||||
unsigned long lru_ttl;
|
||||
int o_marked_for_keepalive;
|
||||
struct list_head o_keepalive_item;
|
||||
};
|
||||
|
||||
/* an in-flight request */
|
||||
struct ceph_osd_request {
|
||||
u64 r_tid; /* unique for this client */
|
||||
struct rb_node r_node;
|
||||
struct list_head r_req_lru_item;
|
||||
struct list_head r_osd_item;
|
||||
struct ceph_osd *r_osd;
|
||||
struct ceph_pg r_pgid;
|
||||
int r_pg_osds[CEPH_PG_MAX_SIZE];
|
||||
int r_num_pg_osds;
|
||||
|
||||
struct ceph_connection *r_con_filling_msg;
|
||||
|
||||
struct ceph_msg *r_request, *r_reply;
|
||||
int r_result;
|
||||
int r_flags; /* any additional flags for the osd */
|
||||
u32 r_sent; /* >0 if r_request is sending/sent */
|
||||
int r_got_reply;
|
||||
|
||||
struct ceph_osd_client *r_osdc;
|
||||
struct kref r_kref;
|
||||
bool r_mempool;
|
||||
struct completion r_completion, r_safe_completion;
|
||||
ceph_osdc_callback_t r_callback, r_safe_callback;
|
||||
struct ceph_eversion r_reassert_version;
|
||||
struct list_head r_unsafe_item;
|
||||
|
||||
struct inode *r_inode; /* for use by callbacks */
|
||||
void *r_priv; /* ditto */
|
||||
|
||||
char r_oid[40]; /* object name */
|
||||
int r_oid_len;
|
||||
unsigned long r_stamp; /* send OR check time */
|
||||
bool r_resend; /* msg send failed, needs retry */
|
||||
|
||||
struct ceph_file_layout r_file_layout;
|
||||
struct ceph_snap_context *r_snapc; /* snap context for writes */
|
||||
unsigned r_num_pages; /* size of page array (follows) */
|
||||
struct page **r_pages; /* pages for data payload */
|
||||
int r_pages_from_pool;
|
||||
int r_own_pages; /* if true, i own page list */
|
||||
#ifdef CONFIG_BLOCK
|
||||
struct bio *r_bio; /* instead of pages */
|
||||
#endif
|
||||
|
||||
struct ceph_pagelist *r_trail; /* trailing part of the data */
|
||||
};
|
||||
|
||||
struct ceph_osd_client {
|
||||
struct ceph_client *client;
|
||||
|
||||
struct ceph_osdmap *osdmap; /* current map */
|
||||
struct rw_semaphore map_sem;
|
||||
struct completion map_waiters;
|
||||
u64 last_requested_map;
|
||||
|
||||
struct mutex request_mutex;
|
||||
struct rb_root osds; /* osds */
|
||||
struct list_head osd_lru; /* idle osds */
|
||||
u64 timeout_tid; /* tid of timeout triggering rq */
|
||||
u64 last_tid; /* tid of last request */
|
||||
struct rb_root requests; /* pending requests */
|
||||
struct list_head req_lru; /* pending requests lru */
|
||||
int num_requests;
|
||||
struct delayed_work timeout_work;
|
||||
struct delayed_work osds_timeout_work;
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
struct dentry *debugfs_file;
|
||||
#endif
|
||||
|
||||
mempool_t *req_mempool;
|
||||
|
||||
struct ceph_msgpool msgpool_op;
|
||||
struct ceph_msgpool msgpool_op_reply;
|
||||
};
|
||||
|
||||
struct ceph_osd_req_op {
|
||||
u16 op; /* CEPH_OSD_OP_* */
|
||||
u32 flags; /* CEPH_OSD_FLAG_* */
|
||||
union {
|
||||
struct {
|
||||
u64 offset, length;
|
||||
u64 truncate_size;
|
||||
u32 truncate_seq;
|
||||
} extent;
|
||||
struct {
|
||||
const char *name;
|
||||
u32 name_len;
|
||||
const char *val;
|
||||
u32 value_len;
|
||||
__u8 cmp_op; /* CEPH_OSD_CMPXATTR_OP_* */
|
||||
__u8 cmp_mode; /* CEPH_OSD_CMPXATTR_MODE_* */
|
||||
} xattr;
|
||||
struct {
|
||||
const char *class_name;
|
||||
__u8 class_len;
|
||||
const char *method_name;
|
||||
__u8 method_len;
|
||||
__u8 argc;
|
||||
const char *indata;
|
||||
u32 indata_len;
|
||||
} cls;
|
||||
struct {
|
||||
u64 cookie, count;
|
||||
} pgls;
|
||||
struct {
|
||||
u64 snapid;
|
||||
} snap;
|
||||
};
|
||||
u32 payload_len;
|
||||
};
|
||||
|
||||
extern int ceph_osdc_init(struct ceph_osd_client *osdc,
|
||||
struct ceph_client *client);
|
||||
extern void ceph_osdc_stop(struct ceph_osd_client *osdc);
|
||||
|
||||
extern void ceph_osdc_handle_reply(struct ceph_osd_client *osdc,
|
||||
struct ceph_msg *msg);
|
||||
extern void ceph_osdc_handle_map(struct ceph_osd_client *osdc,
|
||||
struct ceph_msg *msg);
|
||||
|
||||
extern void ceph_calc_raw_layout(struct ceph_osd_client *osdc,
|
||||
struct ceph_file_layout *layout,
|
||||
u64 snapid,
|
||||
u64 off, u64 *plen, u64 *bno,
|
||||
struct ceph_osd_request *req,
|
||||
struct ceph_osd_req_op *op);
|
||||
|
||||
extern struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc,
|
||||
int flags,
|
||||
struct ceph_snap_context *snapc,
|
||||
struct ceph_osd_req_op *ops,
|
||||
bool use_mempool,
|
||||
gfp_t gfp_flags,
|
||||
struct page **pages,
|
||||
struct bio *bio);
|
||||
|
||||
extern void ceph_osdc_build_request(struct ceph_osd_request *req,
|
||||
u64 off, u64 *plen,
|
||||
struct ceph_osd_req_op *src_ops,
|
||||
struct ceph_snap_context *snapc,
|
||||
struct timespec *mtime,
|
||||
const char *oid,
|
||||
int oid_len);
|
||||
|
||||
extern struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *,
|
||||
struct ceph_file_layout *layout,
|
||||
struct ceph_vino vino,
|
||||
u64 offset, u64 *len, int op, int flags,
|
||||
struct ceph_snap_context *snapc,
|
||||
int do_sync, u32 truncate_seq,
|
||||
u64 truncate_size,
|
||||
struct timespec *mtime,
|
||||
bool use_mempool, int num_reply);
|
||||
|
||||
static inline void ceph_osdc_get_request(struct ceph_osd_request *req)
|
||||
{
|
||||
kref_get(&req->r_kref);
|
||||
}
|
||||
extern void ceph_osdc_release_request(struct kref *kref);
|
||||
static inline void ceph_osdc_put_request(struct ceph_osd_request *req)
|
||||
{
|
||||
kref_put(&req->r_kref, ceph_osdc_release_request);
|
||||
}
|
||||
|
||||
extern int ceph_osdc_start_request(struct ceph_osd_client *osdc,
|
||||
struct ceph_osd_request *req,
|
||||
bool nofail);
|
||||
extern int ceph_osdc_wait_request(struct ceph_osd_client *osdc,
|
||||
struct ceph_osd_request *req);
|
||||
extern void ceph_osdc_sync(struct ceph_osd_client *osdc);
|
||||
|
||||
extern int ceph_osdc_readpages(struct ceph_osd_client *osdc,
|
||||
struct ceph_vino vino,
|
||||
struct ceph_file_layout *layout,
|
||||
u64 off, u64 *plen,
|
||||
u32 truncate_seq, u64 truncate_size,
|
||||
struct page **pages, int nr_pages);
|
||||
|
||||
extern int ceph_osdc_writepages(struct ceph_osd_client *osdc,
|
||||
struct ceph_vino vino,
|
||||
struct ceph_file_layout *layout,
|
||||
struct ceph_snap_context *sc,
|
||||
u64 off, u64 len,
|
||||
u32 truncate_seq, u64 truncate_size,
|
||||
struct timespec *mtime,
|
||||
struct page **pages, int nr_pages,
|
||||
int flags, int do_sync, bool nofail);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
#ifndef _FS_CEPH_OSDMAP_H
|
||||
#define _FS_CEPH_OSDMAP_H
|
||||
|
||||
#include <linux/rbtree.h>
|
||||
#include "types.h"
|
||||
#include "ceph_fs.h"
|
||||
#include <linux/crush/crush.h>
|
||||
|
||||
/*
|
||||
* The osd map describes the current membership of the osd cluster and
|
||||
* specifies the mapping of objects to placement groups and placement
|
||||
* groups to (sets of) osds. That is, it completely specifies the
|
||||
* (desired) distribution of all data objects in the system at some
|
||||
* point in time.
|
||||
*
|
||||
* Each map version is identified by an epoch, which increases monotonically.
|
||||
*
|
||||
* The map can be updated either via an incremental map (diff) describing
|
||||
* the change between two successive epochs, or as a fully encoded map.
|
||||
*/
|
||||
struct ceph_pg_pool_info {
|
||||
struct rb_node node;
|
||||
int id;
|
||||
struct ceph_pg_pool v;
|
||||
int pg_num_mask, pgp_num_mask, lpg_num_mask, lpgp_num_mask;
|
||||
char *name;
|
||||
};
|
||||
|
||||
struct ceph_pg_mapping {
|
||||
struct rb_node node;
|
||||
struct ceph_pg pgid;
|
||||
int len;
|
||||
int osds[];
|
||||
};
|
||||
|
||||
struct ceph_osdmap {
|
||||
struct ceph_fsid fsid;
|
||||
u32 epoch;
|
||||
u32 mkfs_epoch;
|
||||
struct ceph_timespec created, modified;
|
||||
|
||||
u32 flags; /* CEPH_OSDMAP_* */
|
||||
|
||||
u32 max_osd; /* size of osd_state, _offload, _addr arrays */
|
||||
u8 *osd_state; /* CEPH_OSD_* */
|
||||
u32 *osd_weight; /* 0 = failed, 0x10000 = 100% normal */
|
||||
struct ceph_entity_addr *osd_addr;
|
||||
|
||||
struct rb_root pg_temp;
|
||||
struct rb_root pg_pools;
|
||||
u32 pool_max;
|
||||
|
||||
/* the CRUSH map specifies the mapping of placement groups to
|
||||
* the list of osds that store+replicate them. */
|
||||
struct crush_map *crush;
|
||||
};
|
||||
|
||||
/*
|
||||
* file layout helpers
|
||||
*/
|
||||
#define ceph_file_layout_su(l) ((__s32)le32_to_cpu((l).fl_stripe_unit))
|
||||
#define ceph_file_layout_stripe_count(l) \
|
||||
((__s32)le32_to_cpu((l).fl_stripe_count))
|
||||
#define ceph_file_layout_object_size(l) ((__s32)le32_to_cpu((l).fl_object_size))
|
||||
#define ceph_file_layout_cas_hash(l) ((__s32)le32_to_cpu((l).fl_cas_hash))
|
||||
#define ceph_file_layout_object_su(l) \
|
||||
((__s32)le32_to_cpu((l).fl_object_stripe_unit))
|
||||
#define ceph_file_layout_pg_preferred(l) \
|
||||
((__s32)le32_to_cpu((l).fl_pg_preferred))
|
||||
#define ceph_file_layout_pg_pool(l) \
|
||||
((__s32)le32_to_cpu((l).fl_pg_pool))
|
||||
|
||||
static inline unsigned ceph_file_layout_stripe_width(struct ceph_file_layout *l)
|
||||
{
|
||||
return le32_to_cpu(l->fl_stripe_unit) *
|
||||
le32_to_cpu(l->fl_stripe_count);
|
||||
}
|
||||
|
||||
/* "period" == bytes before i start on a new set of objects */
|
||||
static inline unsigned ceph_file_layout_period(struct ceph_file_layout *l)
|
||||
{
|
||||
return le32_to_cpu(l->fl_object_size) *
|
||||
le32_to_cpu(l->fl_stripe_count);
|
||||
}
|
||||
|
||||
|
||||
static inline int ceph_osd_is_up(struct ceph_osdmap *map, int osd)
|
||||
{
|
||||
return (osd < map->max_osd) && (map->osd_state[osd] & CEPH_OSD_UP);
|
||||
}
|
||||
|
||||
static inline bool ceph_osdmap_flag(struct ceph_osdmap *map, int flag)
|
||||
{
|
||||
return map && (map->flags & flag);
|
||||
}
|
||||
|
||||
extern char *ceph_osdmap_state_str(char *str, int len, int state);
|
||||
|
||||
static inline struct ceph_entity_addr *ceph_osd_addr(struct ceph_osdmap *map,
|
||||
int osd)
|
||||
{
|
||||
if (osd >= map->max_osd)
|
||||
return NULL;
|
||||
return &map->osd_addr[osd];
|
||||
}
|
||||
|
||||
extern struct ceph_osdmap *osdmap_decode(void **p, void *end);
|
||||
extern struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
|
||||
struct ceph_osdmap *map,
|
||||
struct ceph_messenger *msgr);
|
||||
extern void ceph_osdmap_destroy(struct ceph_osdmap *map);
|
||||
|
||||
/* calculate mapping of a file extent to an object */
|
||||
extern void ceph_calc_file_object_mapping(struct ceph_file_layout *layout,
|
||||
u64 off, u64 *plen,
|
||||
u64 *bno, u64 *oxoff, u64 *oxlen);
|
||||
|
||||
/* calculate mapping of object to a placement group */
|
||||
extern int ceph_calc_object_layout(struct ceph_object_layout *ol,
|
||||
const char *oid,
|
||||
struct ceph_file_layout *fl,
|
||||
struct ceph_osdmap *osdmap);
|
||||
extern int ceph_calc_pg_acting(struct ceph_osdmap *osdmap, struct ceph_pg pgid,
|
||||
int *acting);
|
||||
extern int ceph_calc_pg_primary(struct ceph_osdmap *osdmap,
|
||||
struct ceph_pg pgid);
|
||||
|
||||
extern int ceph_pg_poolid_by_name(struct ceph_osdmap *map, const char *name);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,75 @@
|
||||
#ifndef __FS_CEPH_PAGELIST_H
|
||||
#define __FS_CEPH_PAGELIST_H
|
||||
|
||||
#include <linux/list.h>
|
||||
|
||||
struct ceph_pagelist {
|
||||
struct list_head head;
|
||||
void *mapped_tail;
|
||||
size_t length;
|
||||
size_t room;
|
||||
struct list_head free_list;
|
||||
size_t num_pages_free;
|
||||
};
|
||||
|
||||
struct ceph_pagelist_cursor {
|
||||
struct ceph_pagelist *pl; /* pagelist, for error checking */
|
||||
struct list_head *page_lru; /* page in list */
|
||||
size_t room; /* room remaining to reset to */
|
||||
};
|
||||
|
||||
static inline void ceph_pagelist_init(struct ceph_pagelist *pl)
|
||||
{
|
||||
INIT_LIST_HEAD(&pl->head);
|
||||
pl->mapped_tail = NULL;
|
||||
pl->length = 0;
|
||||
pl->room = 0;
|
||||
INIT_LIST_HEAD(&pl->free_list);
|
||||
pl->num_pages_free = 0;
|
||||
}
|
||||
|
||||
extern int ceph_pagelist_release(struct ceph_pagelist *pl);
|
||||
|
||||
extern int ceph_pagelist_append(struct ceph_pagelist *pl, const void *d, size_t l);
|
||||
|
||||
extern int ceph_pagelist_reserve(struct ceph_pagelist *pl, size_t space);
|
||||
|
||||
extern int ceph_pagelist_free_reserve(struct ceph_pagelist *pl);
|
||||
|
||||
extern void ceph_pagelist_set_cursor(struct ceph_pagelist *pl,
|
||||
struct ceph_pagelist_cursor *c);
|
||||
|
||||
extern int ceph_pagelist_truncate(struct ceph_pagelist *pl,
|
||||
struct ceph_pagelist_cursor *c);
|
||||
|
||||
static inline int ceph_pagelist_encode_64(struct ceph_pagelist *pl, u64 v)
|
||||
{
|
||||
__le64 ev = cpu_to_le64(v);
|
||||
return ceph_pagelist_append(pl, &ev, sizeof(ev));
|
||||
}
|
||||
static inline int ceph_pagelist_encode_32(struct ceph_pagelist *pl, u32 v)
|
||||
{
|
||||
__le32 ev = cpu_to_le32(v);
|
||||
return ceph_pagelist_append(pl, &ev, sizeof(ev));
|
||||
}
|
||||
static inline int ceph_pagelist_encode_16(struct ceph_pagelist *pl, u16 v)
|
||||
{
|
||||
__le16 ev = cpu_to_le16(v);
|
||||
return ceph_pagelist_append(pl, &ev, sizeof(ev));
|
||||
}
|
||||
static inline int ceph_pagelist_encode_8(struct ceph_pagelist *pl, u8 v)
|
||||
{
|
||||
return ceph_pagelist_append(pl, &v, 1);
|
||||
}
|
||||
static inline int ceph_pagelist_encode_string(struct ceph_pagelist *pl,
|
||||
char *s, size_t len)
|
||||
{
|
||||
int ret = ceph_pagelist_encode_32(pl, len);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (len)
|
||||
return ceph_pagelist_append(pl, s, len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,405 @@
|
||||
#ifndef CEPH_RADOS_H
|
||||
#define CEPH_RADOS_H
|
||||
|
||||
/*
|
||||
* Data types for the Ceph distributed object storage layer RADOS
|
||||
* (Reliable Autonomic Distributed Object Store).
|
||||
*/
|
||||
|
||||
#include "msgr.h"
|
||||
|
||||
/*
|
||||
* osdmap encoding versions
|
||||
*/
|
||||
#define CEPH_OSDMAP_INC_VERSION 5
|
||||
#define CEPH_OSDMAP_INC_VERSION_EXT 5
|
||||
#define CEPH_OSDMAP_VERSION 5
|
||||
#define CEPH_OSDMAP_VERSION_EXT 5
|
||||
|
||||
/*
|
||||
* fs id
|
||||
*/
|
||||
struct ceph_fsid {
|
||||
unsigned char fsid[16];
|
||||
};
|
||||
|
||||
static inline int ceph_fsid_compare(const struct ceph_fsid *a,
|
||||
const struct ceph_fsid *b)
|
||||
{
|
||||
return memcmp(a, b, sizeof(*a));
|
||||
}
|
||||
|
||||
/*
|
||||
* ino, object, etc.
|
||||
*/
|
||||
typedef __le64 ceph_snapid_t;
|
||||
#define CEPH_SNAPDIR ((__u64)(-1)) /* reserved for hidden .snap dir */
|
||||
#define CEPH_NOSNAP ((__u64)(-2)) /* "head", "live" revision */
|
||||
#define CEPH_MAXSNAP ((__u64)(-3)) /* largest valid snapid */
|
||||
|
||||
struct ceph_timespec {
|
||||
__le32 tv_sec;
|
||||
__le32 tv_nsec;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
/*
|
||||
* object layout - how objects are mapped into PGs
|
||||
*/
|
||||
#define CEPH_OBJECT_LAYOUT_HASH 1
|
||||
#define CEPH_OBJECT_LAYOUT_LINEAR 2
|
||||
#define CEPH_OBJECT_LAYOUT_HASHINO 3
|
||||
|
||||
/*
|
||||
* pg layout -- how PGs are mapped onto (sets of) OSDs
|
||||
*/
|
||||
#define CEPH_PG_LAYOUT_CRUSH 0
|
||||
#define CEPH_PG_LAYOUT_HASH 1
|
||||
#define CEPH_PG_LAYOUT_LINEAR 2
|
||||
#define CEPH_PG_LAYOUT_HYBRID 3
|
||||
|
||||
#define CEPH_PG_MAX_SIZE 16 /* max # osds in a single pg */
|
||||
|
||||
/*
|
||||
* placement group.
|
||||
* we encode this into one __le64.
|
||||
*/
|
||||
struct ceph_pg {
|
||||
__le16 preferred; /* preferred primary osd */
|
||||
__le16 ps; /* placement seed */
|
||||
__le32 pool; /* object pool */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/*
|
||||
* pg_pool is a set of pgs storing a pool of objects
|
||||
*
|
||||
* pg_num -- base number of pseudorandomly placed pgs
|
||||
*
|
||||
* pgp_num -- effective number when calculating pg placement. this
|
||||
* is used for pg_num increases. new pgs result in data being "split"
|
||||
* into new pgs. for this to proceed smoothly, new pgs are intiially
|
||||
* colocated with their parents; that is, pgp_num doesn't increase
|
||||
* until the new pgs have successfully split. only _then_ are the new
|
||||
* pgs placed independently.
|
||||
*
|
||||
* lpg_num -- localized pg count (per device). replicas are randomly
|
||||
* selected.
|
||||
*
|
||||
* lpgp_num -- as above.
|
||||
*/
|
||||
#define CEPH_PG_TYPE_REP 1
|
||||
#define CEPH_PG_TYPE_RAID4 2
|
||||
#define CEPH_PG_POOL_VERSION 2
|
||||
struct ceph_pg_pool {
|
||||
__u8 type; /* CEPH_PG_TYPE_* */
|
||||
__u8 size; /* number of osds in each pg */
|
||||
__u8 crush_ruleset; /* crush placement rule */
|
||||
__u8 object_hash; /* hash mapping object name to ps */
|
||||
__le32 pg_num, pgp_num; /* number of pg's */
|
||||
__le32 lpg_num, lpgp_num; /* number of localized pg's */
|
||||
__le32 last_change; /* most recent epoch changed */
|
||||
__le64 snap_seq; /* seq for per-pool snapshot */
|
||||
__le32 snap_epoch; /* epoch of last snap */
|
||||
__le32 num_snaps;
|
||||
__le32 num_removed_snap_intervals; /* if non-empty, NO per-pool snaps */
|
||||
__le64 auid; /* who owns the pg */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/*
|
||||
* stable_mod func is used to control number of placement groups.
|
||||
* similar to straight-up modulo, but produces a stable mapping as b
|
||||
* increases over time. b is the number of bins, and bmask is the
|
||||
* containing power of 2 minus 1.
|
||||
*
|
||||
* b <= bmask and bmask=(2**n)-1
|
||||
* e.g., b=12 -> bmask=15, b=123 -> bmask=127
|
||||
*/
|
||||
static inline int ceph_stable_mod(int x, int b, int bmask)
|
||||
{
|
||||
if ((x & bmask) < b)
|
||||
return x & bmask;
|
||||
else
|
||||
return x & (bmask >> 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* object layout - how a given object should be stored.
|
||||
*/
|
||||
struct ceph_object_layout {
|
||||
struct ceph_pg ol_pgid; /* raw pg, with _full_ ps precision. */
|
||||
__le32 ol_stripe_unit; /* for per-object parity, if any */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/*
|
||||
* compound epoch+version, used by storage layer to serialize mutations
|
||||
*/
|
||||
struct ceph_eversion {
|
||||
__le32 epoch;
|
||||
__le64 version;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/*
|
||||
* osd map bits
|
||||
*/
|
||||
|
||||
/* status bits */
|
||||
#define CEPH_OSD_EXISTS 1
|
||||
#define CEPH_OSD_UP 2
|
||||
|
||||
/* osd weights. fixed point value: 0x10000 == 1.0 ("in"), 0 == "out" */
|
||||
#define CEPH_OSD_IN 0x10000
|
||||
#define CEPH_OSD_OUT 0
|
||||
|
||||
|
||||
/*
|
||||
* osd map flag bits
|
||||
*/
|
||||
#define CEPH_OSDMAP_NEARFULL (1<<0) /* sync writes (near ENOSPC) */
|
||||
#define CEPH_OSDMAP_FULL (1<<1) /* no data writes (ENOSPC) */
|
||||
#define CEPH_OSDMAP_PAUSERD (1<<2) /* pause all reads */
|
||||
#define CEPH_OSDMAP_PAUSEWR (1<<3) /* pause all writes */
|
||||
#define CEPH_OSDMAP_PAUSEREC (1<<4) /* pause recovery */
|
||||
|
||||
/*
|
||||
* osd ops
|
||||
*/
|
||||
#define CEPH_OSD_OP_MODE 0xf000
|
||||
#define CEPH_OSD_OP_MODE_RD 0x1000
|
||||
#define CEPH_OSD_OP_MODE_WR 0x2000
|
||||
#define CEPH_OSD_OP_MODE_RMW 0x3000
|
||||
#define CEPH_OSD_OP_MODE_SUB 0x4000
|
||||
|
||||
#define CEPH_OSD_OP_TYPE 0x0f00
|
||||
#define CEPH_OSD_OP_TYPE_LOCK 0x0100
|
||||
#define CEPH_OSD_OP_TYPE_DATA 0x0200
|
||||
#define CEPH_OSD_OP_TYPE_ATTR 0x0300
|
||||
#define CEPH_OSD_OP_TYPE_EXEC 0x0400
|
||||
#define CEPH_OSD_OP_TYPE_PG 0x0500
|
||||
|
||||
enum {
|
||||
/** data **/
|
||||
/* read */
|
||||
CEPH_OSD_OP_READ = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 1,
|
||||
CEPH_OSD_OP_STAT = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 2,
|
||||
|
||||
/* fancy read */
|
||||
CEPH_OSD_OP_MASKTRUNC = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 4,
|
||||
|
||||
/* write */
|
||||
CEPH_OSD_OP_WRITE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 1,
|
||||
CEPH_OSD_OP_WRITEFULL = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 2,
|
||||
CEPH_OSD_OP_TRUNCATE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 3,
|
||||
CEPH_OSD_OP_ZERO = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 4,
|
||||
CEPH_OSD_OP_DELETE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 5,
|
||||
|
||||
/* fancy write */
|
||||
CEPH_OSD_OP_APPEND = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 6,
|
||||
CEPH_OSD_OP_STARTSYNC = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 7,
|
||||
CEPH_OSD_OP_SETTRUNC = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 8,
|
||||
CEPH_OSD_OP_TRIMTRUNC = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 9,
|
||||
|
||||
CEPH_OSD_OP_TMAPUP = CEPH_OSD_OP_MODE_RMW | CEPH_OSD_OP_TYPE_DATA | 10,
|
||||
CEPH_OSD_OP_TMAPPUT = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 11,
|
||||
CEPH_OSD_OP_TMAPGET = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 12,
|
||||
|
||||
CEPH_OSD_OP_CREATE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 13,
|
||||
CEPH_OSD_OP_ROLLBACK= CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 14,
|
||||
|
||||
/** attrs **/
|
||||
/* read */
|
||||
CEPH_OSD_OP_GETXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 1,
|
||||
CEPH_OSD_OP_GETXATTRS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 2,
|
||||
CEPH_OSD_OP_CMPXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 3,
|
||||
|
||||
/* write */
|
||||
CEPH_OSD_OP_SETXATTR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 1,
|
||||
CEPH_OSD_OP_SETXATTRS = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 2,
|
||||
CEPH_OSD_OP_RESETXATTRS = CEPH_OSD_OP_MODE_WR|CEPH_OSD_OP_TYPE_ATTR | 3,
|
||||
CEPH_OSD_OP_RMXATTR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 4,
|
||||
|
||||
/** subop **/
|
||||
CEPH_OSD_OP_PULL = CEPH_OSD_OP_MODE_SUB | 1,
|
||||
CEPH_OSD_OP_PUSH = CEPH_OSD_OP_MODE_SUB | 2,
|
||||
CEPH_OSD_OP_BALANCEREADS = CEPH_OSD_OP_MODE_SUB | 3,
|
||||
CEPH_OSD_OP_UNBALANCEREADS = CEPH_OSD_OP_MODE_SUB | 4,
|
||||
CEPH_OSD_OP_SCRUB = CEPH_OSD_OP_MODE_SUB | 5,
|
||||
|
||||
/** lock **/
|
||||
CEPH_OSD_OP_WRLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 1,
|
||||
CEPH_OSD_OP_WRUNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 2,
|
||||
CEPH_OSD_OP_RDLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 3,
|
||||
CEPH_OSD_OP_RDUNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 4,
|
||||
CEPH_OSD_OP_UPLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 5,
|
||||
CEPH_OSD_OP_DNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 6,
|
||||
|
||||
/** exec **/
|
||||
CEPH_OSD_OP_CALL = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_EXEC | 1,
|
||||
|
||||
/** pg **/
|
||||
CEPH_OSD_OP_PGLS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_PG | 1,
|
||||
};
|
||||
|
||||
static inline int ceph_osd_op_type_lock(int op)
|
||||
{
|
||||
return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_LOCK;
|
||||
}
|
||||
static inline int ceph_osd_op_type_data(int op)
|
||||
{
|
||||
return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_DATA;
|
||||
}
|
||||
static inline int ceph_osd_op_type_attr(int op)
|
||||
{
|
||||
return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_ATTR;
|
||||
}
|
||||
static inline int ceph_osd_op_type_exec(int op)
|
||||
{
|
||||
return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_EXEC;
|
||||
}
|
||||
static inline int ceph_osd_op_type_pg(int op)
|
||||
{
|
||||
return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_PG;
|
||||
}
|
||||
|
||||
static inline int ceph_osd_op_mode_subop(int op)
|
||||
{
|
||||
return (op & CEPH_OSD_OP_MODE) == CEPH_OSD_OP_MODE_SUB;
|
||||
}
|
||||
static inline int ceph_osd_op_mode_read(int op)
|
||||
{
|
||||
return (op & CEPH_OSD_OP_MODE) == CEPH_OSD_OP_MODE_RD;
|
||||
}
|
||||
static inline int ceph_osd_op_mode_modify(int op)
|
||||
{
|
||||
return (op & CEPH_OSD_OP_MODE) == CEPH_OSD_OP_MODE_WR;
|
||||
}
|
||||
|
||||
/*
|
||||
* note that the following tmap stuff is also defined in the ceph librados.h
|
||||
* any modification here needs to be updated there
|
||||
*/
|
||||
#define CEPH_OSD_TMAP_HDR 'h'
|
||||
#define CEPH_OSD_TMAP_SET 's'
|
||||
#define CEPH_OSD_TMAP_RM 'r'
|
||||
|
||||
extern const char *ceph_osd_op_name(int op);
|
||||
|
||||
|
||||
/*
|
||||
* osd op flags
|
||||
*
|
||||
* An op may be READ, WRITE, or READ|WRITE.
|
||||
*/
|
||||
enum {
|
||||
CEPH_OSD_FLAG_ACK = 1, /* want (or is) "ack" ack */
|
||||
CEPH_OSD_FLAG_ONNVRAM = 2, /* want (or is) "onnvram" ack */
|
||||
CEPH_OSD_FLAG_ONDISK = 4, /* want (or is) "ondisk" ack */
|
||||
CEPH_OSD_FLAG_RETRY = 8, /* resend attempt */
|
||||
CEPH_OSD_FLAG_READ = 16, /* op may read */
|
||||
CEPH_OSD_FLAG_WRITE = 32, /* op may write */
|
||||
CEPH_OSD_FLAG_ORDERSNAP = 64, /* EOLDSNAP if snapc is out of order */
|
||||
CEPH_OSD_FLAG_PEERSTAT = 128, /* msg includes osd_peer_stat */
|
||||
CEPH_OSD_FLAG_BALANCE_READS = 256,
|
||||
CEPH_OSD_FLAG_PARALLELEXEC = 512, /* execute op in parallel */
|
||||
CEPH_OSD_FLAG_PGOP = 1024, /* pg op, no object */
|
||||
CEPH_OSD_FLAG_EXEC = 2048, /* op may exec */
|
||||
CEPH_OSD_FLAG_EXEC_PUBLIC = 4096, /* op may exec (public) */
|
||||
};
|
||||
|
||||
enum {
|
||||
CEPH_OSD_OP_FLAG_EXCL = 1, /* EXCL object create */
|
||||
};
|
||||
|
||||
#define EOLDSNAPC ERESTART /* ORDERSNAP flag set; writer has old snapc*/
|
||||
#define EBLACKLISTED ESHUTDOWN /* blacklisted */
|
||||
|
||||
/* xattr comparison */
|
||||
enum {
|
||||
CEPH_OSD_CMPXATTR_OP_NOP = 0,
|
||||
CEPH_OSD_CMPXATTR_OP_EQ = 1,
|
||||
CEPH_OSD_CMPXATTR_OP_NE = 2,
|
||||
CEPH_OSD_CMPXATTR_OP_GT = 3,
|
||||
CEPH_OSD_CMPXATTR_OP_GTE = 4,
|
||||
CEPH_OSD_CMPXATTR_OP_LT = 5,
|
||||
CEPH_OSD_CMPXATTR_OP_LTE = 6
|
||||
};
|
||||
|
||||
enum {
|
||||
CEPH_OSD_CMPXATTR_MODE_STRING = 1,
|
||||
CEPH_OSD_CMPXATTR_MODE_U64 = 2
|
||||
};
|
||||
|
||||
/*
|
||||
* an individual object operation. each may be accompanied by some data
|
||||
* payload
|
||||
*/
|
||||
struct ceph_osd_op {
|
||||
__le16 op; /* CEPH_OSD_OP_* */
|
||||
__le32 flags; /* CEPH_OSD_FLAG_* */
|
||||
union {
|
||||
struct {
|
||||
__le64 offset, length;
|
||||
__le64 truncate_size;
|
||||
__le32 truncate_seq;
|
||||
} __attribute__ ((packed)) extent;
|
||||
struct {
|
||||
__le32 name_len;
|
||||
__le32 value_len;
|
||||
__u8 cmp_op; /* CEPH_OSD_CMPXATTR_OP_* */
|
||||
__u8 cmp_mode; /* CEPH_OSD_CMPXATTR_MODE_* */
|
||||
} __attribute__ ((packed)) xattr;
|
||||
struct {
|
||||
__u8 class_len;
|
||||
__u8 method_len;
|
||||
__u8 argc;
|
||||
__le32 indata_len;
|
||||
} __attribute__ ((packed)) cls;
|
||||
struct {
|
||||
__le64 cookie, count;
|
||||
} __attribute__ ((packed)) pgls;
|
||||
struct {
|
||||
__le64 snapid;
|
||||
} __attribute__ ((packed)) snap;
|
||||
};
|
||||
__le32 payload_len;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/*
|
||||
* osd request message header. each request may include multiple
|
||||
* ceph_osd_op object operations.
|
||||
*/
|
||||
struct ceph_osd_request_head {
|
||||
__le32 client_inc; /* client incarnation */
|
||||
struct ceph_object_layout layout; /* pgid */
|
||||
__le32 osdmap_epoch; /* client's osdmap epoch */
|
||||
|
||||
__le32 flags;
|
||||
|
||||
struct ceph_timespec mtime; /* for mutations only */
|
||||
struct ceph_eversion reassert_version; /* if we are replaying op */
|
||||
|
||||
__le32 object_len; /* length of object name */
|
||||
|
||||
__le64 snapid; /* snapid to read */
|
||||
__le64 snap_seq; /* writer's snap context */
|
||||
__le32 num_snaps;
|
||||
|
||||
__le16 num_ops;
|
||||
struct ceph_osd_op ops[]; /* followed by ops[], obj, ticket, snaps */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ceph_osd_reply_head {
|
||||
__le32 client_inc; /* client incarnation */
|
||||
__le32 flags;
|
||||
struct ceph_object_layout layout;
|
||||
__le32 osdmap_epoch;
|
||||
struct ceph_eversion reassert_version; /* for replaying uncommitted */
|
||||
|
||||
__le32 result; /* result code */
|
||||
|
||||
__le32 object_len; /* length of object name */
|
||||
__le32 num_ops;
|
||||
struct ceph_osd_op ops[0]; /* ops[], object */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,29 @@
|
||||
#ifndef _FS_CEPH_TYPES_H
|
||||
#define _FS_CEPH_TYPES_H
|
||||
|
||||
/* needed before including ceph_fs.h */
|
||||
#include <linux/in.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/fcntl.h>
|
||||
#include <linux/string.h>
|
||||
|
||||
#include "ceph_fs.h"
|
||||
#include "ceph_frag.h"
|
||||
#include "ceph_hash.h"
|
||||
|
||||
/*
|
||||
* Identify inodes by both their ino AND snapshot id (a u64).
|
||||
*/
|
||||
struct ceph_vino {
|
||||
u64 ino;
|
||||
u64 snap;
|
||||
};
|
||||
|
||||
|
||||
/* context for the caps reservation mechanism */
|
||||
struct ceph_cap_reservation {
|
||||
int count;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -75,7 +75,7 @@ struct cgroup_subsys_state {
|
||||
|
||||
unsigned long flags;
|
||||
/* ID for this css, if possible */
|
||||
struct css_id *id;
|
||||
struct css_id __rcu *id;
|
||||
};
|
||||
|
||||
/* bits in struct cgroup_subsys_state flags field */
|
||||
@@ -205,7 +205,7 @@ struct cgroup {
|
||||
struct list_head children; /* my children */
|
||||
|
||||
struct cgroup *parent; /* my parent */
|
||||
struct dentry *dentry; /* cgroup fs entry, RCU protected */
|
||||
struct dentry __rcu *dentry; /* cgroup fs entry, RCU protected */
|
||||
|
||||
/* Private pointers for each registered subsystem */
|
||||
struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT];
|
||||
|
||||
@@ -16,7 +16,11 @@
|
||||
# define __release(x) __context__(x,-1)
|
||||
# define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0)
|
||||
# define __percpu __attribute__((noderef, address_space(3)))
|
||||
#ifdef CONFIG_SPARSE_RCU_POINTER
|
||||
# define __rcu __attribute__((noderef, address_space(4)))
|
||||
#else
|
||||
# define __rcu
|
||||
#endif
|
||||
extern void __chk_user_ptr(const volatile void __user *);
|
||||
extern void __chk_io_ptr(const volatile void __iomem *);
|
||||
#else
|
||||
|
||||
@@ -9,37 +9,7 @@
|
||||
* These are the only things you should do on a core-file: use only these
|
||||
* functions to write out all the necessary info.
|
||||
*/
|
||||
static inline int dump_write(struct file *file, const void *addr, int nr)
|
||||
{
|
||||
return file->f_op->write(file, addr, nr, &file->f_pos) == nr;
|
||||
}
|
||||
|
||||
static inline int dump_seek(struct file *file, loff_t off)
|
||||
{
|
||||
int ret = 1;
|
||||
|
||||
if (file->f_op->llseek && file->f_op->llseek != no_llseek) {
|
||||
if (file->f_op->llseek(file, off, SEEK_CUR) < 0)
|
||||
return 0;
|
||||
} else {
|
||||
char *buf = (char *)get_zeroed_page(GFP_KERNEL);
|
||||
|
||||
if (!buf)
|
||||
return 0;
|
||||
while (off > 0) {
|
||||
unsigned long n = off;
|
||||
|
||||
if (n > PAGE_SIZE)
|
||||
n = PAGE_SIZE;
|
||||
if (!dump_write(file, buf, n)) {
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
off -= n;
|
||||
}
|
||||
free_page((unsigned long)buf);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
extern int dump_write(struct file *file, const void *addr, int nr);
|
||||
extern int dump_seek(struct file *file, loff_t off);
|
||||
|
||||
#endif /* _LINUX_COREDUMP_H */
|
||||
|
||||
@@ -53,6 +53,7 @@ struct cpuidle_state {
|
||||
#define CPUIDLE_FLAG_BALANCED (0x40) /* medium latency, moderate savings */
|
||||
#define CPUIDLE_FLAG_DEEP (0x80) /* high latency, large savings */
|
||||
#define CPUIDLE_FLAG_IGNORE (0x100) /* ignore during this idle period */
|
||||
#define CPUIDLE_FLAG_TLB_FLUSHED (0x200) /* tlb will be flushed */
|
||||
|
||||
#define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000)
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ struct thread_group_cred {
|
||||
atomic_t usage;
|
||||
pid_t tgid; /* thread group process ID */
|
||||
spinlock_t lock;
|
||||
struct key *session_keyring; /* keyring inherited over fork */
|
||||
struct key __rcu *session_keyring; /* keyring inherited over fork */
|
||||
struct key *process_keyring; /* keyring private to this process */
|
||||
struct rcu_head rcu; /* RCU deletion hook */
|
||||
};
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
#ifndef CEPH_CRUSH_CRUSH_H
|
||||
#define CEPH_CRUSH_CRUSH_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
/*
|
||||
* CRUSH is a pseudo-random data distribution algorithm that
|
||||
* efficiently distributes input values (typically, data objects)
|
||||
* across a heterogeneous, structured storage cluster.
|
||||
*
|
||||
* The algorithm was originally described in detail in this paper
|
||||
* (although the algorithm has evolved somewhat since then):
|
||||
*
|
||||
* http://www.ssrc.ucsc.edu/Papers/weil-sc06.pdf
|
||||
*
|
||||
* LGPL2
|
||||
*/
|
||||
|
||||
|
||||
#define CRUSH_MAGIC 0x00010000ul /* for detecting algorithm revisions */
|
||||
|
||||
|
||||
#define CRUSH_MAX_DEPTH 10 /* max crush hierarchy depth */
|
||||
#define CRUSH_MAX_SET 10 /* max size of a mapping result */
|
||||
|
||||
|
||||
/*
|
||||
* CRUSH uses user-defined "rules" to describe how inputs should be
|
||||
* mapped to devices. A rule consists of sequence of steps to perform
|
||||
* to generate the set of output devices.
|
||||
*/
|
||||
struct crush_rule_step {
|
||||
__u32 op;
|
||||
__s32 arg1;
|
||||
__s32 arg2;
|
||||
};
|
||||
|
||||
/* step op codes */
|
||||
enum {
|
||||
CRUSH_RULE_NOOP = 0,
|
||||
CRUSH_RULE_TAKE = 1, /* arg1 = value to start with */
|
||||
CRUSH_RULE_CHOOSE_FIRSTN = 2, /* arg1 = num items to pick */
|
||||
/* arg2 = type */
|
||||
CRUSH_RULE_CHOOSE_INDEP = 3, /* same */
|
||||
CRUSH_RULE_EMIT = 4, /* no args */
|
||||
CRUSH_RULE_CHOOSE_LEAF_FIRSTN = 6,
|
||||
CRUSH_RULE_CHOOSE_LEAF_INDEP = 7,
|
||||
};
|
||||
|
||||
/*
|
||||
* for specifying choose num (arg1) relative to the max parameter
|
||||
* passed to do_rule
|
||||
*/
|
||||
#define CRUSH_CHOOSE_N 0
|
||||
#define CRUSH_CHOOSE_N_MINUS(x) (-(x))
|
||||
|
||||
/*
|
||||
* The rule mask is used to describe what the rule is intended for.
|
||||
* Given a ruleset and size of output set, we search through the
|
||||
* rule list for a matching rule_mask.
|
||||
*/
|
||||
struct crush_rule_mask {
|
||||
__u8 ruleset;
|
||||
__u8 type;
|
||||
__u8 min_size;
|
||||
__u8 max_size;
|
||||
};
|
||||
|
||||
struct crush_rule {
|
||||
__u32 len;
|
||||
struct crush_rule_mask mask;
|
||||
struct crush_rule_step steps[0];
|
||||
};
|
||||
|
||||
#define crush_rule_size(len) (sizeof(struct crush_rule) + \
|
||||
(len)*sizeof(struct crush_rule_step))
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* A bucket is a named container of other items (either devices or
|
||||
* other buckets). Items within a bucket are chosen using one of a
|
||||
* few different algorithms. The table summarizes how the speed of
|
||||
* each option measures up against mapping stability when items are
|
||||
* added or removed.
|
||||
*
|
||||
* Bucket Alg Speed Additions Removals
|
||||
* ------------------------------------------------
|
||||
* uniform O(1) poor poor
|
||||
* list O(n) optimal poor
|
||||
* tree O(log n) good good
|
||||
* straw O(n) optimal optimal
|
||||
*/
|
||||
enum {
|
||||
CRUSH_BUCKET_UNIFORM = 1,
|
||||
CRUSH_BUCKET_LIST = 2,
|
||||
CRUSH_BUCKET_TREE = 3,
|
||||
CRUSH_BUCKET_STRAW = 4
|
||||
};
|
||||
extern const char *crush_bucket_alg_name(int alg);
|
||||
|
||||
struct crush_bucket {
|
||||
__s32 id; /* this'll be negative */
|
||||
__u16 type; /* non-zero; type=0 is reserved for devices */
|
||||
__u8 alg; /* one of CRUSH_BUCKET_* */
|
||||
__u8 hash; /* which hash function to use, CRUSH_HASH_* */
|
||||
__u32 weight; /* 16-bit fixed point */
|
||||
__u32 size; /* num items */
|
||||
__s32 *items;
|
||||
|
||||
/*
|
||||
* cached random permutation: used for uniform bucket and for
|
||||
* the linear search fallback for the other bucket types.
|
||||
*/
|
||||
__u32 perm_x; /* @x for which *perm is defined */
|
||||
__u32 perm_n; /* num elements of *perm that are permuted/defined */
|
||||
__u32 *perm;
|
||||
};
|
||||
|
||||
struct crush_bucket_uniform {
|
||||
struct crush_bucket h;
|
||||
__u32 item_weight; /* 16-bit fixed point; all items equally weighted */
|
||||
};
|
||||
|
||||
struct crush_bucket_list {
|
||||
struct crush_bucket h;
|
||||
__u32 *item_weights; /* 16-bit fixed point */
|
||||
__u32 *sum_weights; /* 16-bit fixed point. element i is sum
|
||||
of weights 0..i, inclusive */
|
||||
};
|
||||
|
||||
struct crush_bucket_tree {
|
||||
struct crush_bucket h; /* note: h.size is _tree_ size, not number of
|
||||
actual items */
|
||||
__u8 num_nodes;
|
||||
__u32 *node_weights;
|
||||
};
|
||||
|
||||
struct crush_bucket_straw {
|
||||
struct crush_bucket h;
|
||||
__u32 *item_weights; /* 16-bit fixed point */
|
||||
__u32 *straws; /* 16-bit fixed point */
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* CRUSH map includes all buckets, rules, etc.
|
||||
*/
|
||||
struct crush_map {
|
||||
struct crush_bucket **buckets;
|
||||
struct crush_rule **rules;
|
||||
|
||||
/*
|
||||
* Parent pointers to identify the parent bucket a device or
|
||||
* bucket in the hierarchy. If an item appears more than
|
||||
* once, this is the _last_ time it appeared (where buckets
|
||||
* are processed in bucket id order, from -1 on down to
|
||||
* -max_buckets.
|
||||
*/
|
||||
__u32 *bucket_parents;
|
||||
__u32 *device_parents;
|
||||
|
||||
__s32 max_buckets;
|
||||
__u32 max_rules;
|
||||
__s32 max_devices;
|
||||
};
|
||||
|
||||
|
||||
/* crush.c */
|
||||
extern int crush_get_bucket_item_weight(struct crush_bucket *b, int pos);
|
||||
extern void crush_calc_parents(struct crush_map *map);
|
||||
extern void crush_destroy_bucket_uniform(struct crush_bucket_uniform *b);
|
||||
extern void crush_destroy_bucket_list(struct crush_bucket_list *b);
|
||||
extern void crush_destroy_bucket_tree(struct crush_bucket_tree *b);
|
||||
extern void crush_destroy_bucket_straw(struct crush_bucket_straw *b);
|
||||
extern void crush_destroy_bucket(struct crush_bucket *b);
|
||||
extern void crush_destroy(struct crush_map *map);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef CEPH_CRUSH_HASH_H
|
||||
#define CEPH_CRUSH_HASH_H
|
||||
|
||||
#define CRUSH_HASH_RJENKINS1 0
|
||||
|
||||
#define CRUSH_HASH_DEFAULT CRUSH_HASH_RJENKINS1
|
||||
|
||||
extern const char *crush_hash_name(int type);
|
||||
|
||||
extern __u32 crush_hash32(int type, __u32 a);
|
||||
extern __u32 crush_hash32_2(int type, __u32 a, __u32 b);
|
||||
extern __u32 crush_hash32_3(int type, __u32 a, __u32 b, __u32 c);
|
||||
extern __u32 crush_hash32_4(int type, __u32 a, __u32 b, __u32 c, __u32 d);
|
||||
extern __u32 crush_hash32_5(int type, __u32 a, __u32 b, __u32 c, __u32 d,
|
||||
__u32 e);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef CEPH_CRUSH_MAPPER_H
|
||||
#define CEPH_CRUSH_MAPPER_H
|
||||
|
||||
/*
|
||||
* CRUSH functions for find rules and then mapping an input to an
|
||||
* output set.
|
||||
*
|
||||
* LGPL2
|
||||
*/
|
||||
|
||||
#include "crush.h"
|
||||
|
||||
extern int crush_find_rule(struct crush_map *map, int pool, int type, int size);
|
||||
extern int crush_do_rule(struct crush_map *map,
|
||||
int ruleno,
|
||||
int x, int *result, int result_max,
|
||||
int forcefeed, /* -1 for none */
|
||||
__u32 *weights);
|
||||
|
||||
#endif
|
||||
@@ -165,8 +165,10 @@ enum {
|
||||
DCCPO_TIMESTAMP_ECHO = 42,
|
||||
DCCPO_ELAPSED_TIME = 43,
|
||||
DCCPO_MAX = 45,
|
||||
DCCPO_MIN_CCID_SPECIFIC = 128,
|
||||
DCCPO_MAX_CCID_SPECIFIC = 255,
|
||||
DCCPO_MIN_RX_CCID_SPECIFIC = 128, /* from sender to receiver */
|
||||
DCCPO_MAX_RX_CCID_SPECIFIC = 191,
|
||||
DCCPO_MIN_TX_CCID_SPECIFIC = 192, /* from receiver to sender */
|
||||
DCCPO_MAX_TX_CCID_SPECIFIC = 255,
|
||||
};
|
||||
/* maximum size of a single TLV-encoded DCCP option (sans type/len bytes) */
|
||||
#define DCCP_SINGLE_OPT_MAXLEN 253
|
||||
|
||||
@@ -49,7 +49,6 @@ struct task_struct;
|
||||
|
||||
#ifdef CONFIG_LOCKDEP
|
||||
extern void debug_show_all_locks(void);
|
||||
extern void __debug_show_held_locks(struct task_struct *task);
|
||||
extern void debug_show_held_locks(struct task_struct *task);
|
||||
extern void debug_check_no_locks_freed(const void *from, unsigned long len);
|
||||
extern void debug_check_no_locks_held(struct task_struct *task);
|
||||
@@ -58,10 +57,6 @@ static inline void debug_show_all_locks(void)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void __debug_show_held_locks(struct task_struct *task)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void debug_show_held_locks(struct task_struct *task)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -751,4 +751,11 @@ do { \
|
||||
MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor))
|
||||
#define MODULE_ALIAS_CHARDEV_MAJOR(major) \
|
||||
MODULE_ALIAS("char-major-" __stringify(major) "-*")
|
||||
|
||||
#ifdef CONFIG_SYSFS_DEPRECATED
|
||||
extern long sysfs_deprecated;
|
||||
#else
|
||||
#define sysfs_deprecated 0
|
||||
#endif
|
||||
|
||||
#endif /* _DEVICE_H_ */
|
||||
|
||||
+2
-2
@@ -48,10 +48,10 @@ typedef void dlm_lockspace_t;
|
||||
*
|
||||
* 0 if lock request was successful
|
||||
* -EAGAIN if request would block and is flagged DLM_LKF_NOQUEUE
|
||||
* -ENOMEM if there is no memory to process request
|
||||
* -EINVAL if there are invalid parameters
|
||||
* -DLM_EUNLOCK if unlock request was successful
|
||||
* -DLM_ECANCEL if a cancel completed successfully
|
||||
* -EDEADLK if a deadlock was detected
|
||||
* -ETIMEDOUT if the lock request was canceled due to a timeout
|
||||
*/
|
||||
|
||||
#define DLM_SBF_DEMOTED 0x01
|
||||
|
||||
@@ -548,7 +548,7 @@ static inline bool dma_dev_has_pq_continue(struct dma_device *dma)
|
||||
return (dma->max_pq & DMA_HAS_PQ_CONTINUE) == DMA_HAS_PQ_CONTINUE;
|
||||
}
|
||||
|
||||
static unsigned short dma_dev_to_maxpq(struct dma_device *dma)
|
||||
static inline unsigned short dma_dev_to_maxpq(struct dma_device *dma)
|
||||
{
|
||||
return dma->max_pq & ~DMA_HAS_PQ_CONTINUE;
|
||||
}
|
||||
|
||||
@@ -57,15 +57,15 @@ extern int dmar_table_init(void);
|
||||
extern int dmar_dev_scope_init(void);
|
||||
|
||||
/* Intel IOMMU detection */
|
||||
extern void detect_intel_iommu(void);
|
||||
extern int detect_intel_iommu(void);
|
||||
extern int enable_drhd_fault_handling(void);
|
||||
|
||||
extern int parse_ioapics_under_ir(void);
|
||||
extern int alloc_iommu(struct dmar_drhd_unit *);
|
||||
#else
|
||||
static inline void detect_intel_iommu(void)
|
||||
static inline int detect_intel_iommu(void)
|
||||
{
|
||||
return;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static inline int dmar_table_init(void)
|
||||
@@ -106,6 +106,7 @@ struct irte {
|
||||
__u64 high;
|
||||
};
|
||||
};
|
||||
|
||||
#ifdef CONFIG_INTR_REMAP
|
||||
extern int intr_remapping_enabled;
|
||||
extern int intr_remapping_supported(void);
|
||||
@@ -119,11 +120,8 @@ extern int alloc_irte(struct intel_iommu *iommu, int irq, u16 count);
|
||||
extern int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index,
|
||||
u16 sub_handle);
|
||||
extern int map_irq_to_irte_handle(int irq, u16 *sub_handle);
|
||||
extern int clear_irte_irq(int irq, struct intel_iommu *iommu, u16 index);
|
||||
extern int flush_irte(int irq);
|
||||
extern int free_irte(int irq);
|
||||
|
||||
extern int irq_remapped(int irq);
|
||||
extern struct intel_iommu *map_dev_to_ir(struct pci_dev *dev);
|
||||
extern struct intel_iommu *map_ioapic_to_ir(int apic);
|
||||
extern struct intel_iommu *map_hpet_to_ir(u8 id);
|
||||
@@ -177,7 +175,6 @@ static inline int set_msi_sid(struct irte *irte, struct pci_dev *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define irq_remapped(irq) (0)
|
||||
#define enable_intr_remapping(mode) (-1)
|
||||
#define disable_intr_remapping() (0)
|
||||
#define reenable_intr_remapping(mode) (0)
|
||||
@@ -187,8 +184,9 @@ static inline int set_msi_sid(struct irte *irte, struct pci_dev *dev)
|
||||
/* Can't use the common MSI interrupt functions
|
||||
* since DMAR is not a pci device
|
||||
*/
|
||||
extern void dmar_msi_unmask(unsigned int irq);
|
||||
extern void dmar_msi_mask(unsigned int irq);
|
||||
struct irq_data;
|
||||
extern void dmar_msi_unmask(struct irq_data *data);
|
||||
extern void dmar_msi_mask(struct irq_data *data);
|
||||
extern void dmar_msi_read(int irq, struct msi_msg *msg);
|
||||
extern void dmar_msi_write(int irq, struct msi_msg *msg);
|
||||
extern int dmar_set_interrupt(struct intel_iommu *iommu);
|
||||
|
||||
+17
-5
@@ -53,10 +53,10 @@
|
||||
|
||||
|
||||
extern const char *drbd_buildtag(void);
|
||||
#define REL_VERSION "8.3.8.1"
|
||||
#define REL_VERSION "8.3.9rc2"
|
||||
#define API_VERSION 88
|
||||
#define PRO_VERSION_MIN 86
|
||||
#define PRO_VERSION_MAX 94
|
||||
#define PRO_VERSION_MAX 95
|
||||
|
||||
|
||||
enum drbd_io_error_p {
|
||||
@@ -91,6 +91,11 @@ enum drbd_after_sb_p {
|
||||
ASB_VIOLENTLY
|
||||
};
|
||||
|
||||
enum drbd_on_no_data {
|
||||
OND_IO_ERROR,
|
||||
OND_SUSPEND_IO
|
||||
};
|
||||
|
||||
/* KEEP the order, do not delete or insert. Only append. */
|
||||
enum drbd_ret_codes {
|
||||
ERR_CODE_BASE = 100,
|
||||
@@ -140,6 +145,7 @@ enum drbd_ret_codes {
|
||||
ERR_CONNECTED = 151, /* DRBD 8.3 only */
|
||||
ERR_PERM = 152,
|
||||
ERR_NEED_APV_93 = 153,
|
||||
ERR_STONITH_AND_PROT_A = 154,
|
||||
|
||||
/* insert new ones above this line */
|
||||
AFTER_LAST_ERR_CODE
|
||||
@@ -226,13 +232,17 @@ union drbd_state {
|
||||
unsigned conn:5 ; /* 17/32 cstates */
|
||||
unsigned disk:4 ; /* 8/16 from D_DISKLESS to D_UP_TO_DATE */
|
||||
unsigned pdsk:4 ; /* 8/16 from D_DISKLESS to D_UP_TO_DATE */
|
||||
unsigned susp:1 ; /* 2/2 IO suspended no/yes */
|
||||
unsigned susp:1 ; /* 2/2 IO suspended no/yes (by user) */
|
||||
unsigned aftr_isp:1 ; /* isp .. imposed sync pause */
|
||||
unsigned peer_isp:1 ;
|
||||
unsigned user_isp:1 ;
|
||||
unsigned _pad:11; /* 0 unused */
|
||||
unsigned susp_nod:1 ; /* IO suspended because no data */
|
||||
unsigned susp_fen:1 ; /* IO suspended because fence peer handler runs*/
|
||||
unsigned _pad:9; /* 0 unused */
|
||||
#elif defined(__BIG_ENDIAN_BITFIELD)
|
||||
unsigned _pad:11; /* 0 unused */
|
||||
unsigned _pad:9;
|
||||
unsigned susp_fen:1 ;
|
||||
unsigned susp_nod:1 ;
|
||||
unsigned user_isp:1 ;
|
||||
unsigned peer_isp:1 ;
|
||||
unsigned aftr_isp:1 ; /* isp .. imposed sync pause */
|
||||
@@ -312,6 +322,8 @@ enum drbd_timeout_flag {
|
||||
|
||||
#define DRBD_MAGIC 0x83740267
|
||||
#define BE_DRBD_MAGIC __constant_cpu_to_be32(DRBD_MAGIC)
|
||||
#define DRBD_MAGIC_BIG 0x835a
|
||||
#define BE_DRBD_MAGIC_BIG __constant_cpu_to_be16(DRBD_MAGIC_BIG)
|
||||
|
||||
/* these are of type "int" */
|
||||
#define DRBD_MD_INDEX_INTERNAL -1
|
||||
|
||||
+17
-12
@@ -128,26 +128,31 @@
|
||||
#define DRBD_AFTER_SB_1P_DEF ASB_DISCONNECT
|
||||
#define DRBD_AFTER_SB_2P_DEF ASB_DISCONNECT
|
||||
#define DRBD_RR_CONFLICT_DEF ASB_DISCONNECT
|
||||
#define DRBD_ON_NO_DATA_DEF OND_IO_ERROR
|
||||
|
||||
#define DRBD_MAX_BIO_BVECS_MIN 0
|
||||
#define DRBD_MAX_BIO_BVECS_MAX 128
|
||||
#define DRBD_MAX_BIO_BVECS_DEF 0
|
||||
|
||||
#define DRBD_DP_VOLUME_MIN 4
|
||||
#define DRBD_DP_VOLUME_MAX 1048576
|
||||
#define DRBD_DP_VOLUME_DEF 16384
|
||||
#define DRBD_C_PLAN_AHEAD_MIN 0
|
||||
#define DRBD_C_PLAN_AHEAD_MAX 300
|
||||
#define DRBD_C_PLAN_AHEAD_DEF 0 /* RS rate controller disabled by default */
|
||||
|
||||
#define DRBD_DP_INTERVAL_MIN 1
|
||||
#define DRBD_DP_INTERVAL_MAX 600
|
||||
#define DRBD_DP_INTERVAL_DEF 5
|
||||
#define DRBD_C_DELAY_TARGET_MIN 1
|
||||
#define DRBD_C_DELAY_TARGET_MAX 100
|
||||
#define DRBD_C_DELAY_TARGET_DEF 10
|
||||
|
||||
#define DRBD_RS_THROTTLE_TH_MIN 1
|
||||
#define DRBD_RS_THROTTLE_TH_MAX 600
|
||||
#define DRBD_RS_THROTTLE_TH_DEF 20
|
||||
#define DRBD_C_FILL_TARGET_MIN 0
|
||||
#define DRBD_C_FILL_TARGET_MAX (1<<20) /* 500MByte in sec */
|
||||
#define DRBD_C_FILL_TARGET_DEF 0 /* By default disabled -> controlled by delay_target */
|
||||
|
||||
#define DRBD_RS_HOLD_OFF_TH_MIN 1
|
||||
#define DRBD_RS_HOLD_OFF_TH_MAX 6000
|
||||
#define DRBD_RS_HOLD_OFF_TH_DEF 100
|
||||
#define DRBD_C_MAX_RATE_MIN 250 /* kByte/sec */
|
||||
#define DRBD_C_MAX_RATE_MAX (4 << 20)
|
||||
#define DRBD_C_MAX_RATE_DEF 102400
|
||||
|
||||
#define DRBD_C_MIN_RATE_MIN 0 /* kByte/sec */
|
||||
#define DRBD_C_MIN_RATE_MAX (4 << 20)
|
||||
#define DRBD_C_MIN_RATE_DEF 4096
|
||||
|
||||
#undef RANGE
|
||||
#endif
|
||||
|
||||
@@ -87,6 +87,12 @@ NL_PACKET(syncer_conf, 8,
|
||||
NL_STRING( 51, T_MAY_IGNORE, cpu_mask, 32)
|
||||
NL_STRING( 64, T_MAY_IGNORE, csums_alg, SHARED_SECRET_MAX)
|
||||
NL_BIT( 65, T_MAY_IGNORE, use_rle)
|
||||
NL_INTEGER( 75, T_MAY_IGNORE, on_no_data)
|
||||
NL_INTEGER( 76, T_MAY_IGNORE, c_plan_ahead)
|
||||
NL_INTEGER( 77, T_MAY_IGNORE, c_delay_target)
|
||||
NL_INTEGER( 78, T_MAY_IGNORE, c_fill_target)
|
||||
NL_INTEGER( 79, T_MAY_IGNORE, c_max_rate)
|
||||
NL_INTEGER( 80, T_MAY_IGNORE, c_min_rate)
|
||||
)
|
||||
|
||||
NL_PACKET(invalidate, 9, )
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef _DYNAMIC_DEBUG_H
|
||||
#define _DYNAMIC_DEBUG_H
|
||||
|
||||
#include <linux/jump_label.h>
|
||||
|
||||
/* dynamic_printk_enabled, and dynamic_printk_enabled2 are bitmasks in which
|
||||
* bit n is set to 1 if any modname hashes into the bucket n, 0 otherwise. They
|
||||
* use independent hash functions, to reduce the chance of false positives.
|
||||
@@ -22,8 +24,6 @@ struct _ddebug {
|
||||
const char *function;
|
||||
const char *filename;
|
||||
const char *format;
|
||||
char primary_hash;
|
||||
char secondary_hash;
|
||||
unsigned int lineno:24;
|
||||
/*
|
||||
* The flags field controls the behaviour at the callsite.
|
||||
@@ -33,6 +33,7 @@ struct _ddebug {
|
||||
#define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */
|
||||
#define _DPRINTK_FLAGS_DEFAULT 0
|
||||
unsigned int flags:8;
|
||||
char enabled;
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
|
||||
@@ -42,33 +43,35 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n,
|
||||
#if defined(CONFIG_DYNAMIC_DEBUG)
|
||||
extern int ddebug_remove_module(const char *mod_name);
|
||||
|
||||
#define __dynamic_dbg_enabled(dd) ({ \
|
||||
int __ret = 0; \
|
||||
if (unlikely((dynamic_debug_enabled & (1LL << DEBUG_HASH)) && \
|
||||
(dynamic_debug_enabled2 & (1LL << DEBUG_HASH2)))) \
|
||||
if (unlikely(dd.flags)) \
|
||||
__ret = 1; \
|
||||
__ret; })
|
||||
|
||||
#define dynamic_pr_debug(fmt, ...) do { \
|
||||
__label__ do_printk; \
|
||||
__label__ out; \
|
||||
static struct _ddebug descriptor \
|
||||
__used \
|
||||
__attribute__((section("__verbose"), aligned(8))) = \
|
||||
{ KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \
|
||||
DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \
|
||||
if (__dynamic_dbg_enabled(descriptor)) \
|
||||
printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \
|
||||
{ KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \
|
||||
_DPRINTK_FLAGS_DEFAULT }; \
|
||||
JUMP_LABEL(&descriptor.enabled, do_printk); \
|
||||
goto out; \
|
||||
do_printk: \
|
||||
printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \
|
||||
out: ; \
|
||||
} while (0)
|
||||
|
||||
|
||||
#define dynamic_dev_dbg(dev, fmt, ...) do { \
|
||||
__label__ do_printk; \
|
||||
__label__ out; \
|
||||
static struct _ddebug descriptor \
|
||||
__used \
|
||||
__attribute__((section("__verbose"), aligned(8))) = \
|
||||
{ KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \
|
||||
DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \
|
||||
if (__dynamic_dbg_enabled(descriptor)) \
|
||||
dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \
|
||||
{ KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \
|
||||
_DPRINTK_FLAGS_DEFAULT }; \
|
||||
JUMP_LABEL(&descriptor.enabled, do_printk); \
|
||||
goto out; \
|
||||
do_printk: \
|
||||
dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \
|
||||
out: ; \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
@@ -80,7 +83,7 @@ static inline int ddebug_remove_module(const char *mod)
|
||||
|
||||
#define dynamic_pr_debug(fmt, ...) \
|
||||
do { if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); } while (0)
|
||||
#define dynamic_dev_dbg(dev, format, ...) \
|
||||
#define dynamic_dev_dbg(dev, fmt, ...) \
|
||||
do { if (0) dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); } while (0)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
#ifndef _LINUX_EARLY_RES_H
|
||||
#define _LINUX_EARLY_RES_H
|
||||
#ifdef __KERNEL__
|
||||
|
||||
extern void reserve_early(u64 start, u64 end, char *name);
|
||||
extern void reserve_early_overlap_ok(u64 start, u64 end, char *name);
|
||||
extern void free_early(u64 start, u64 end);
|
||||
void free_early_partial(u64 start, u64 end);
|
||||
extern void early_res_to_bootmem(u64 start, u64 end);
|
||||
|
||||
void reserve_early_without_check(u64 start, u64 end, char *name);
|
||||
u64 find_early_area(u64 ei_start, u64 ei_last, u64 start, u64 end,
|
||||
u64 size, u64 align);
|
||||
u64 find_early_area_size(u64 ei_start, u64 ei_last, u64 start,
|
||||
u64 *sizep, u64 align);
|
||||
u64 find_fw_memmap_area(u64 start, u64 end, u64 size, u64 align);
|
||||
u64 get_max_mapped(void);
|
||||
#include <linux/range.h>
|
||||
int get_free_all_memory_range(struct range **rangep, int nodeid);
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* _LINUX_EARLY_RES_H */
|
||||
@@ -13,6 +13,7 @@
|
||||
#define _LINUX_EDAC_H_
|
||||
|
||||
#include <asm/atomic.h>
|
||||
#include <linux/sysdev.h>
|
||||
|
||||
#define EDAC_OPSTATE_INVAL -1
|
||||
#define EDAC_OPSTATE_POLL 0
|
||||
@@ -22,9 +23,12 @@
|
||||
extern int edac_op_state;
|
||||
extern int edac_err_assert;
|
||||
extern atomic_t edac_handlers;
|
||||
extern struct sysdev_class edac_class;
|
||||
|
||||
extern int edac_handler_set(void);
|
||||
extern void edac_atomic_assert_error(void);
|
||||
extern struct sysdev_class *edac_get_sysfs_class(void);
|
||||
extern void edac_put_sysfs_class(void);
|
||||
|
||||
static inline void opstate_init(void)
|
||||
{
|
||||
|
||||
@@ -93,6 +93,7 @@ struct elevator_queue
|
||||
struct elevator_type *elevator_type;
|
||||
struct mutex sysfs_lock;
|
||||
struct hlist_head *hash;
|
||||
unsigned int registered:1;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -121,6 +122,8 @@ extern void elv_completed_request(struct request_queue *, struct request *);
|
||||
extern int elv_set_request(struct request_queue *, struct request *, gfp_t);
|
||||
extern void elv_put_request(struct request_queue *, struct request *);
|
||||
extern void elv_drain_elevator(struct request_queue *);
|
||||
extern void elv_quiesce_start(struct request_queue *);
|
||||
extern void elv_quiesce_end(struct request_queue *);
|
||||
|
||||
/*
|
||||
* io scheduler registration
|
||||
|
||||
@@ -71,7 +71,7 @@ static inline int is_zero_ether_addr(const u8 *addr)
|
||||
*/
|
||||
static inline int is_multicast_ether_addr(const u8 *addr)
|
||||
{
|
||||
return (0x01 & addr[0]);
|
||||
return 0x01 & addr[0];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,7 +82,7 @@ static inline int is_multicast_ether_addr(const u8 *addr)
|
||||
*/
|
||||
static inline int is_local_ether_addr(const u8 *addr)
|
||||
{
|
||||
return (0x02 & addr[0]);
|
||||
return 0x02 & addr[0];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -237,13 +237,29 @@ static inline bool is_etherdev_addr(const struct net_device *dev,
|
||||
* entry points.
|
||||
*/
|
||||
|
||||
static inline int compare_ether_header(const void *a, const void *b)
|
||||
static inline unsigned long compare_ether_header(const void *a, const void *b)
|
||||
{
|
||||
#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
|
||||
unsigned long fold;
|
||||
|
||||
/*
|
||||
* We want to compare 14 bytes:
|
||||
* [a0 ... a13] ^ [b0 ... b13]
|
||||
* Use two long XOR, ORed together, with an overlap of two bytes.
|
||||
* [a0 a1 a2 a3 a4 a5 a6 a7 ] ^ [b0 b1 b2 b3 b4 b5 b6 b7 ] |
|
||||
* [a6 a7 a8 a9 a10 a11 a12 a13] ^ [b6 b7 b8 b9 b10 b11 b12 b13]
|
||||
* This means the [a6 a7] ^ [b6 b7] part is done two times.
|
||||
*/
|
||||
fold = *(unsigned long *)a ^ *(unsigned long *)b;
|
||||
fold |= *(unsigned long *)(a + 6) ^ *(unsigned long *)(b + 6);
|
||||
return fold;
|
||||
#else
|
||||
u32 *a32 = (u32 *)((u8 *)a + 2);
|
||||
u32 *b32 = (u32 *)((u8 *)b + 2);
|
||||
|
||||
return (*(u16 *)a ^ *(u16 *)b) | (a32[0] ^ b32[0]) |
|
||||
(a32[1] ^ b32[1]) | (a32[2] ^ b32[2]);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* _LINUX_ETHERDEVICE_H */
|
||||
|
||||
+139
-51
@@ -14,6 +14,7 @@
|
||||
#define _LINUX_ETHTOOL_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/if_ether.h>
|
||||
|
||||
/* This should work for both 32 and 64 bit userland. */
|
||||
struct ethtool_cmd {
|
||||
@@ -308,15 +309,28 @@ struct ethtool_perm_addr {
|
||||
* flag differs from the read-only value.
|
||||
*/
|
||||
enum ethtool_flags {
|
||||
ETH_FLAG_TXVLAN = (1 << 7), /* TX VLAN offload enabled */
|
||||
ETH_FLAG_RXVLAN = (1 << 8), /* RX VLAN offload enabled */
|
||||
ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */
|
||||
ETH_FLAG_NTUPLE = (1 << 27), /* N-tuple filters enabled */
|
||||
ETH_FLAG_RXHASH = (1 << 28),
|
||||
};
|
||||
|
||||
/* The following structures are for supporting RX network flow
|
||||
* classification configuration. Note, all multibyte fields, e.g.,
|
||||
* ip4src, ip4dst, psrc, pdst, spi, etc. are expected to be in network
|
||||
* byte order.
|
||||
* classification and RX n-tuple configuration. Note, all multibyte
|
||||
* fields, e.g., ip4src, ip4dst, psrc, pdst, spi, etc. are expected to
|
||||
* be in network byte order.
|
||||
*/
|
||||
|
||||
/**
|
||||
* struct ethtool_tcpip4_spec - flow specification for TCP/IPv4 etc.
|
||||
* @ip4src: Source host
|
||||
* @ip4dst: Destination host
|
||||
* @psrc: Source port
|
||||
* @pdst: Destination port
|
||||
* @tos: Type-of-service
|
||||
*
|
||||
* This can be used to specify a TCP/IPv4, UDP/IPv4 or SCTP/IPv4 flow.
|
||||
*/
|
||||
struct ethtool_tcpip4_spec {
|
||||
__be32 ip4src;
|
||||
@@ -326,6 +340,15 @@ struct ethtool_tcpip4_spec {
|
||||
__u8 tos;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ethtool_ah_espip4_spec - flow specification for IPsec/IPv4
|
||||
* @ip4src: Source host
|
||||
* @ip4dst: Destination host
|
||||
* @spi: Security parameters index
|
||||
* @tos: Type-of-service
|
||||
*
|
||||
* This can be used to specify an IPsec transport or tunnel over IPv4.
|
||||
*/
|
||||
struct ethtool_ah_espip4_spec {
|
||||
__be32 ip4src;
|
||||
__be32 ip4dst;
|
||||
@@ -333,21 +356,17 @@ struct ethtool_ah_espip4_spec {
|
||||
__u8 tos;
|
||||
};
|
||||
|
||||
struct ethtool_rawip4_spec {
|
||||
__be32 ip4src;
|
||||
__be32 ip4dst;
|
||||
__u8 hdata[64];
|
||||
};
|
||||
|
||||
struct ethtool_ether_spec {
|
||||
__be16 ether_type;
|
||||
__u8 frame_size;
|
||||
__u8 eframe[16];
|
||||
};
|
||||
|
||||
#define ETH_RX_NFC_IP4 1
|
||||
#define ETH_RX_NFC_IP6 2
|
||||
|
||||
/**
|
||||
* struct ethtool_usrip4_spec - general flow specification for IPv4
|
||||
* @ip4src: Source host
|
||||
* @ip4dst: Destination host
|
||||
* @l4_4_bytes: First 4 bytes of transport (layer 4) header
|
||||
* @tos: Type-of-service
|
||||
* @ip_ver: Value must be %ETH_RX_NFC_IP4; mask must be 0
|
||||
* @proto: Transport protocol number; mask must be 0
|
||||
*/
|
||||
struct ethtool_usrip4_spec {
|
||||
__be32 ip4src;
|
||||
__be32 ip4dst;
|
||||
@@ -357,6 +376,15 @@ struct ethtool_usrip4_spec {
|
||||
__u8 proto;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ethtool_rx_flow_spec - specification for RX flow filter
|
||||
* @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
|
||||
* @h_u: Flow fields to match (dependent on @flow_type)
|
||||
* @m_u: Masks for flow field bits to be ignored
|
||||
* @ring_cookie: RX ring/queue index to deliver to, or %RX_CLS_FLOW_DISC
|
||||
* if packets should be discarded
|
||||
* @location: Index of filter in hardware table
|
||||
*/
|
||||
struct ethtool_rx_flow_spec {
|
||||
__u32 flow_type;
|
||||
union {
|
||||
@@ -365,36 +393,91 @@ struct ethtool_rx_flow_spec {
|
||||
struct ethtool_tcpip4_spec sctp_ip4_spec;
|
||||
struct ethtool_ah_espip4_spec ah_ip4_spec;
|
||||
struct ethtool_ah_espip4_spec esp_ip4_spec;
|
||||
struct ethtool_rawip4_spec raw_ip4_spec;
|
||||
struct ethtool_ether_spec ether_spec;
|
||||
struct ethtool_usrip4_spec usr_ip4_spec;
|
||||
__u8 hdata[64];
|
||||
} h_u, m_u; /* entry, mask */
|
||||
struct ethhdr ether_spec;
|
||||
__u8 hdata[72];
|
||||
} h_u, m_u;
|
||||
__u64 ring_cookie;
|
||||
__u32 location;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ethtool_rxnfc - command to get or set RX flow classification rules
|
||||
* @cmd: Specific command number - %ETHTOOL_GRXFH, %ETHTOOL_SRXFH,
|
||||
* %ETHTOOL_GRXRINGS, %ETHTOOL_GRXCLSRLCNT, %ETHTOOL_GRXCLSRULE,
|
||||
* %ETHTOOL_GRXCLSRLALL, %ETHTOOL_SRXCLSRLDEL or %ETHTOOL_SRXCLSRLINS
|
||||
* @flow_type: Type of flow to be affected, e.g. %TCP_V4_FLOW
|
||||
* @data: Command-dependent value
|
||||
* @fs: Flow filter specification
|
||||
* @rule_cnt: Number of rules to be affected
|
||||
* @rule_locs: Array of valid rule indices
|
||||
*
|
||||
* For %ETHTOOL_GRXFH and %ETHTOOL_SRXFH, @data is a bitmask indicating
|
||||
* the fields included in the flow hash, e.g. %RXH_IP_SRC. The following
|
||||
* structure fields must not be used.
|
||||
*
|
||||
* For %ETHTOOL_GRXRINGS, @data is set to the number of RX rings/queues
|
||||
* on return.
|
||||
*
|
||||
* For %ETHTOOL_GRXCLSRLCNT, @rule_cnt is set to the number of defined
|
||||
* rules on return.
|
||||
*
|
||||
* For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the index of an
|
||||
* existing filter rule on entry and @fs contains the rule on return.
|
||||
*
|
||||
* For %ETHTOOL_GRXCLSRLALL, @rule_cnt specifies the array size of the
|
||||
* user buffer for @rule_locs on entry. On return, @data is the size
|
||||
* of the filter table and @rule_locs contains the indices of the
|
||||
* defined rules.
|
||||
*
|
||||
* For %ETHTOOL_SRXCLSRLINS, @fs specifies the filter rule to add or
|
||||
* update. @fs.@location specifies the index to use and must not be
|
||||
* ignored.
|
||||
*
|
||||
* For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the index of an
|
||||
* existing filter rule on entry.
|
||||
*
|
||||
* Implementation of indexed classification rules generally requires a
|
||||
* TCAM.
|
||||
*/
|
||||
struct ethtool_rxnfc {
|
||||
__u32 cmd;
|
||||
__u32 flow_type;
|
||||
/* The rx flow hash value or the rule DB size */
|
||||
__u64 data;
|
||||
/* The following fields are not valid and must not be used for
|
||||
* the ETHTOOL_{G,X}RXFH commands. */
|
||||
struct ethtool_rx_flow_spec fs;
|
||||
__u32 rule_cnt;
|
||||
__u32 rule_locs[0];
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ethtool_rxfh_indir - command to get or set RX flow hash indirection
|
||||
* @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR
|
||||
* @size: On entry, the array size of the user buffer. On return from
|
||||
* %ETHTOOL_GRXFHINDIR, the array size of the hardware indirection table.
|
||||
* @ring_index: RX ring/queue index for each hash value
|
||||
*/
|
||||
struct ethtool_rxfh_indir {
|
||||
__u32 cmd;
|
||||
/* On entry, this is the array size of the user buffer. On
|
||||
* return from ETHTOOL_GRXFHINDIR, this is the array size of
|
||||
* the hardware indirection table. */
|
||||
__u32 size;
|
||||
__u32 ring_index[0]; /* ring/queue index for each hash value */
|
||||
__u32 ring_index[0];
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ethtool_rx_ntuple_flow_spec - specification for RX flow filter
|
||||
* @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
|
||||
* @h_u: Flow field values to match (dependent on @flow_type)
|
||||
* @m_u: Masks for flow field value bits to be ignored
|
||||
* @vlan_tag: VLAN tag to match
|
||||
* @vlan_tag_mask: Mask for VLAN tag bits to be ignored
|
||||
* @data: Driver-dependent data to match
|
||||
* @data_mask: Mask for driver-dependent data bits to be ignored
|
||||
* @action: RX ring/queue index to deliver to (non-negative) or other action
|
||||
* (negative, e.g. %ETHTOOL_RXNTUPLE_ACTION_DROP)
|
||||
*
|
||||
* For flow types %TCP_V4_FLOW, %UDP_V4_FLOW and %SCTP_V4_FLOW, where
|
||||
* a field value and mask are both zero this is treated as if all mask
|
||||
* bits are set i.e. the field is ignored.
|
||||
*/
|
||||
struct ethtool_rx_ntuple_flow_spec {
|
||||
__u32 flow_type;
|
||||
union {
|
||||
@@ -403,22 +486,26 @@ struct ethtool_rx_ntuple_flow_spec {
|
||||
struct ethtool_tcpip4_spec sctp_ip4_spec;
|
||||
struct ethtool_ah_espip4_spec ah_ip4_spec;
|
||||
struct ethtool_ah_espip4_spec esp_ip4_spec;
|
||||
struct ethtool_rawip4_spec raw_ip4_spec;
|
||||
struct ethtool_ether_spec ether_spec;
|
||||
struct ethtool_usrip4_spec usr_ip4_spec;
|
||||
__u8 hdata[64];
|
||||
} h_u, m_u; /* entry, mask */
|
||||
struct ethhdr ether_spec;
|
||||
__u8 hdata[72];
|
||||
} h_u, m_u;
|
||||
|
||||
__u16 vlan_tag;
|
||||
__u16 vlan_tag_mask;
|
||||
__u64 data; /* user-defined flow spec data */
|
||||
__u64 data_mask; /* user-defined flow spec mask */
|
||||
__u64 data;
|
||||
__u64 data_mask;
|
||||
|
||||
/* signed to distinguish between queue and actions (DROP) */
|
||||
__s32 action;
|
||||
#define ETHTOOL_RXNTUPLE_ACTION_DROP -1
|
||||
#define ETHTOOL_RXNTUPLE_ACTION_DROP (-1) /* drop packet */
|
||||
#define ETHTOOL_RXNTUPLE_ACTION_CLEAR (-2) /* clear filter */
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ethtool_rx_ntuple - command to set or clear RX flow filter
|
||||
* @cmd: Command number - %ETHTOOL_SRXNTUPLE
|
||||
* @fs: Flow filter specification
|
||||
*/
|
||||
struct ethtool_rx_ntuple {
|
||||
__u32 cmd;
|
||||
struct ethtool_rx_ntuple_flow_spec fs;
|
||||
@@ -759,22 +846,23 @@ struct ethtool_ops {
|
||||
#define WAKE_MAGIC (1 << 5)
|
||||
#define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */
|
||||
|
||||
/* L3-L4 network traffic flow types */
|
||||
#define TCP_V4_FLOW 0x01
|
||||
#define UDP_V4_FLOW 0x02
|
||||
#define SCTP_V4_FLOW 0x03
|
||||
#define AH_ESP_V4_FLOW 0x04
|
||||
#define TCP_V6_FLOW 0x05
|
||||
#define UDP_V6_FLOW 0x06
|
||||
#define SCTP_V6_FLOW 0x07
|
||||
#define AH_ESP_V6_FLOW 0x08
|
||||
#define AH_V4_FLOW 0x09
|
||||
#define ESP_V4_FLOW 0x0a
|
||||
#define AH_V6_FLOW 0x0b
|
||||
#define ESP_V6_FLOW 0x0c
|
||||
#define IP_USER_FLOW 0x0d
|
||||
#define IPV4_FLOW 0x10
|
||||
#define IPV6_FLOW 0x11
|
||||
/* L2-L4 network traffic flow types */
|
||||
#define TCP_V4_FLOW 0x01 /* hash or spec (tcp_ip4_spec) */
|
||||
#define UDP_V4_FLOW 0x02 /* hash or spec (udp_ip4_spec) */
|
||||
#define SCTP_V4_FLOW 0x03 /* hash or spec (sctp_ip4_spec) */
|
||||
#define AH_ESP_V4_FLOW 0x04 /* hash only */
|
||||
#define TCP_V6_FLOW 0x05 /* hash only */
|
||||
#define UDP_V6_FLOW 0x06 /* hash only */
|
||||
#define SCTP_V6_FLOW 0x07 /* hash only */
|
||||
#define AH_ESP_V6_FLOW 0x08 /* hash only */
|
||||
#define AH_V4_FLOW 0x09 /* hash or spec (ah_ip4_spec) */
|
||||
#define ESP_V4_FLOW 0x0a /* hash or spec (esp_ip4_spec) */
|
||||
#define AH_V6_FLOW 0x0b /* hash only */
|
||||
#define ESP_V6_FLOW 0x0c /* hash only */
|
||||
#define IP_USER_FLOW 0x0d /* spec only (usr_ip4_spec) */
|
||||
#define IPV4_FLOW 0x10 /* hash only */
|
||||
#define IPV6_FLOW 0x11 /* hash only */
|
||||
#define ETHER_FLOW 0x12 /* spec only (ether_spec) */
|
||||
|
||||
/* L3-L4 network traffic flow hash options */
|
||||
#define RXH_L2DA (1 << 1)
|
||||
|
||||
@@ -67,6 +67,19 @@ enum fid_type {
|
||||
* 32 bit parent block number, 32 bit parent generation number
|
||||
*/
|
||||
FILEID_UDF_WITH_PARENT = 0x52,
|
||||
|
||||
/*
|
||||
* 64 bit checkpoint number, 64 bit inode number,
|
||||
* 32 bit generation number.
|
||||
*/
|
||||
FILEID_NILFS_WITHOUT_PARENT = 0x61,
|
||||
|
||||
/*
|
||||
* 64 bit checkpoint number, 64 bit inode number,
|
||||
* 32 bit generation number, 32 bit parent generation.
|
||||
* 64 bit parent inode number.
|
||||
*/
|
||||
FILEID_NILFS_WITH_PARENT = 0x62,
|
||||
};
|
||||
|
||||
struct fid {
|
||||
|
||||
@@ -31,7 +31,7 @@ struct embedded_fd_set {
|
||||
|
||||
struct fdtable {
|
||||
unsigned int max_fds;
|
||||
struct file ** fd; /* current fd array */
|
||||
struct file __rcu **fd; /* current fd array */
|
||||
fd_set *close_on_exec;
|
||||
fd_set *open_fds;
|
||||
struct rcu_head rcu;
|
||||
@@ -46,7 +46,7 @@ struct files_struct {
|
||||
* read mostly part
|
||||
*/
|
||||
atomic_t count;
|
||||
struct fdtable *fdt;
|
||||
struct fdtable __rcu *fdt;
|
||||
struct fdtable fdtab;
|
||||
/*
|
||||
* written part on a separate cache line in SMP
|
||||
@@ -55,7 +55,7 @@ struct files_struct {
|
||||
int next_fd;
|
||||
struct embedded_fd_set close_on_exec_init;
|
||||
struct embedded_fd_set open_fds_init;
|
||||
struct file * fd_array[NR_OPEN_DEFAULT];
|
||||
struct file __rcu * fd_array[NR_OPEN_DEFAULT];
|
||||
};
|
||||
|
||||
#define rcu_dereference_check_fdtable(files, fdtfd) \
|
||||
|
||||
+26
-21
@@ -135,12 +135,12 @@ struct inodes_stat_t {
|
||||
* immediately after submission. The write equivalent
|
||||
* of READ_SYNC.
|
||||
* WRITE_ODIRECT_PLUG Special case write for O_DIRECT only.
|
||||
* WRITE_BARRIER Like WRITE_SYNC, but tells the block layer that all
|
||||
* previously submitted writes must be safely on storage
|
||||
* before this one is started. Also guarantees that when
|
||||
* this write is complete, it itself is also safely on
|
||||
* storage. Prevents reordering of writes on both sides
|
||||
* of this IO.
|
||||
* WRITE_FLUSH Like WRITE_SYNC but with preceding cache flush.
|
||||
* WRITE_FUA Like WRITE_SYNC but data is guaranteed to be on
|
||||
* non-volatile media on completion.
|
||||
* WRITE_FLUSH_FUA Combination of WRITE_FLUSH and FUA. The IO is preceded
|
||||
* by a cache flush and data is guaranteed to be on
|
||||
* non-volatile media on completion.
|
||||
*
|
||||
*/
|
||||
#define RW_MASK REQ_WRITE
|
||||
@@ -156,16 +156,12 @@ struct inodes_stat_t {
|
||||
#define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG)
|
||||
#define WRITE_ODIRECT_PLUG (WRITE | REQ_SYNC)
|
||||
#define WRITE_META (WRITE | REQ_META)
|
||||
#define WRITE_BARRIER (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \
|
||||
REQ_HARDBARRIER)
|
||||
|
||||
/*
|
||||
* These aren't really reads or writes, they pass down information about
|
||||
* parts of device that are now unused by the file system.
|
||||
*/
|
||||
#define DISCARD_NOBARRIER (WRITE | REQ_DISCARD)
|
||||
#define DISCARD_BARRIER (WRITE | REQ_DISCARD | REQ_HARDBARRIER)
|
||||
#define DISCARD_SECURE (DISCARD_NOBARRIER | REQ_SECURE)
|
||||
#define WRITE_FLUSH (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \
|
||||
REQ_FLUSH)
|
||||
#define WRITE_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \
|
||||
REQ_FUA)
|
||||
#define WRITE_FLUSH_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \
|
||||
REQ_FLUSH | REQ_FUA)
|
||||
|
||||
#define SEL_IN 1
|
||||
#define SEL_OUT 2
|
||||
@@ -1093,10 +1089,6 @@ struct file_lock {
|
||||
|
||||
#include <linux/fcntl.h>
|
||||
|
||||
/* temporary stubs for BKL removal */
|
||||
#define lock_flocks() lock_kernel()
|
||||
#define unlock_flocks() unlock_kernel()
|
||||
|
||||
extern void send_sigio(struct fown_struct *fown, int fd, int band);
|
||||
|
||||
#ifdef CONFIG_FILE_LOCKING
|
||||
@@ -1135,6 +1127,8 @@ extern int vfs_setlease(struct file *, long, struct file_lock **);
|
||||
extern int lease_modify(struct file_lock **, int);
|
||||
extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
|
||||
extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
|
||||
extern void lock_flocks(void);
|
||||
extern void unlock_flocks(void);
|
||||
#else /* !CONFIG_FILE_LOCKING */
|
||||
static inline int fcntl_getlk(struct file *file, struct flock __user *user)
|
||||
{
|
||||
@@ -1277,6 +1271,14 @@ static inline int lock_may_write(struct inode *inode, loff_t start,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static inline void lock_flocks(void)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void unlock_flocks(void)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* !CONFIG_FILE_LOCKING */
|
||||
|
||||
|
||||
@@ -1384,7 +1386,7 @@ struct super_block {
|
||||
* Saved mount options for lazy filesystems using
|
||||
* generic_show_options()
|
||||
*/
|
||||
char *s_options;
|
||||
char __rcu *s_options;
|
||||
};
|
||||
|
||||
extern struct timespec current_fs_time(struct super_block *sb);
|
||||
@@ -2378,6 +2380,8 @@ extern ssize_t simple_write_to_buffer(void *to, size_t available, loff_t *ppos,
|
||||
|
||||
extern int generic_file_fsync(struct file *, int);
|
||||
|
||||
extern int generic_check_addressable(unsigned, u64);
|
||||
|
||||
#ifdef CONFIG_MIGRATION
|
||||
extern int buffer_migrate_page(struct address_space *,
|
||||
struct page *, struct page *);
|
||||
@@ -2454,6 +2458,7 @@ static const struct file_operations __fops = { \
|
||||
.release = simple_attr_release, \
|
||||
.read = simple_attr_read, \
|
||||
.write = simple_attr_write, \
|
||||
.llseek = generic_file_llseek, \
|
||||
};
|
||||
|
||||
static inline void __attribute__((format(printf, 1, 2)))
|
||||
|
||||
@@ -58,17 +58,35 @@ enum fsl_usb2_phy_modes {
|
||||
FSL_USB2_PHY_SERIAL,
|
||||
};
|
||||
|
||||
struct clk;
|
||||
struct platform_device;
|
||||
|
||||
struct fsl_usb2_platform_data {
|
||||
/* board specific information */
|
||||
enum fsl_usb2_operating_modes operating_mode;
|
||||
enum fsl_usb2_phy_modes phy_mode;
|
||||
unsigned int port_enables;
|
||||
unsigned int workaround;
|
||||
|
||||
int (*init)(struct platform_device *);
|
||||
void (*exit)(struct platform_device *);
|
||||
void __iomem *regs; /* ioremap'd register base */
|
||||
struct clk *clk;
|
||||
unsigned big_endian_mmio:1;
|
||||
unsigned big_endian_desc:1;
|
||||
unsigned es:1; /* need USBMODE:ES */
|
||||
unsigned le_setup_buf:1;
|
||||
unsigned have_sysif_regs:1;
|
||||
unsigned invert_drvvbus:1;
|
||||
unsigned invert_pwr_fault:1;
|
||||
};
|
||||
|
||||
/* Flags in fsl_usb2_mph_platform_data */
|
||||
#define FSL_USB2_PORT0_ENABLED 0x00000001
|
||||
#define FSL_USB2_PORT1_ENABLED 0x00000002
|
||||
|
||||
#define FLS_USB2_WORKAROUND_ENGCM09152 (1 << 0)
|
||||
|
||||
struct spi_device;
|
||||
|
||||
struct fsl_spi_platform_data {
|
||||
|
||||
@@ -191,8 +191,8 @@ struct ftrace_event_call {
|
||||
unsigned int flags;
|
||||
|
||||
#ifdef CONFIG_PERF_EVENTS
|
||||
int perf_refcount;
|
||||
struct hlist_head *perf_events;
|
||||
int perf_refcount;
|
||||
struct hlist_head __percpu *perf_events;
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -252,8 +252,8 @@ DECLARE_PER_CPU(struct pt_regs, perf_trace_regs);
|
||||
|
||||
extern int perf_trace_init(struct perf_event *event);
|
||||
extern void perf_trace_destroy(struct perf_event *event);
|
||||
extern int perf_trace_enable(struct perf_event *event);
|
||||
extern void perf_trace_disable(struct perf_event *event);
|
||||
extern int perf_trace_add(struct perf_event *event, int flags);
|
||||
extern void perf_trace_del(struct perf_event *event, int flags);
|
||||
extern int ftrace_profile_set_filter(struct perf_event *event, int event_id,
|
||||
char *filter_str);
|
||||
extern void ftrace_profile_free_filter(struct perf_event *event);
|
||||
|
||||
+55
-5
@@ -12,6 +12,7 @@
|
||||
#include <linux/types.h>
|
||||
#include <linux/kdev_t.h>
|
||||
#include <linux/rcupdate.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#ifdef CONFIG_BLOCK
|
||||
|
||||
@@ -86,7 +87,15 @@ struct disk_stats {
|
||||
unsigned long io_ticks;
|
||||
unsigned long time_in_queue;
|
||||
};
|
||||
|
||||
|
||||
#define PARTITION_META_INFO_VOLNAMELTH 64
|
||||
#define PARTITION_META_INFO_UUIDLTH 16
|
||||
|
||||
struct partition_meta_info {
|
||||
u8 uuid[PARTITION_META_INFO_UUIDLTH]; /* always big endian */
|
||||
u8 volname[PARTITION_META_INFO_VOLNAMELTH];
|
||||
};
|
||||
|
||||
struct hd_struct {
|
||||
sector_t start_sect;
|
||||
sector_t nr_sects;
|
||||
@@ -95,6 +104,7 @@ struct hd_struct {
|
||||
struct device __dev;
|
||||
struct kobject *holder_dir;
|
||||
int policy, partno;
|
||||
struct partition_meta_info *info;
|
||||
#ifdef CONFIG_FAIL_MAKE_REQUEST
|
||||
int make_it_fail;
|
||||
#endif
|
||||
@@ -129,8 +139,9 @@ struct blk_scsi_cmd_filter {
|
||||
struct disk_part_tbl {
|
||||
struct rcu_head rcu_head;
|
||||
int len;
|
||||
struct hd_struct *last_lookup;
|
||||
struct hd_struct *part[];
|
||||
struct hd_struct __rcu *last_lookup;
|
||||
struct gendisk *disk;
|
||||
struct hd_struct __rcu *part[];
|
||||
};
|
||||
|
||||
struct gendisk {
|
||||
@@ -149,7 +160,7 @@ struct gendisk {
|
||||
* non-critical accesses use RCU. Always access through
|
||||
* helpers.
|
||||
*/
|
||||
struct disk_part_tbl *part_tbl;
|
||||
struct disk_part_tbl __rcu *part_tbl;
|
||||
struct hd_struct part0;
|
||||
|
||||
const struct block_device_operations *fops;
|
||||
@@ -181,6 +192,30 @@ static inline struct gendisk *part_to_disk(struct hd_struct *part)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline void part_pack_uuid(const u8 *uuid_str, u8 *to)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 16; ++i) {
|
||||
*to++ = (hex_to_bin(*uuid_str) << 4) |
|
||||
(hex_to_bin(*(uuid_str + 1)));
|
||||
uuid_str += 2;
|
||||
switch (i) {
|
||||
case 3:
|
||||
case 5:
|
||||
case 7:
|
||||
case 9:
|
||||
uuid_str++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline char *part_unpack_uuid(const u8 *uuid, char *out)
|
||||
{
|
||||
sprintf(out, "%pU", uuid);
|
||||
return out;
|
||||
}
|
||||
|
||||
static inline int disk_max_parts(struct gendisk *disk)
|
||||
{
|
||||
if (disk->flags & GENHD_FL_EXT_DEVT)
|
||||
@@ -342,6 +377,19 @@ static inline int part_in_flight(struct hd_struct *part)
|
||||
return part->in_flight[0] + part->in_flight[1];
|
||||
}
|
||||
|
||||
static inline struct partition_meta_info *alloc_part_info(struct gendisk *disk)
|
||||
{
|
||||
if (disk)
|
||||
return kzalloc_node(sizeof(struct partition_meta_info),
|
||||
GFP_KERNEL, disk->node_id);
|
||||
return kzalloc(sizeof(struct partition_meta_info), GFP_KERNEL);
|
||||
}
|
||||
|
||||
static inline void free_part_info(struct hd_struct *part)
|
||||
{
|
||||
kfree(part->info);
|
||||
}
|
||||
|
||||
/* block/blk-core.c */
|
||||
extern void part_round_stats(int cpu, struct hd_struct *part);
|
||||
|
||||
@@ -533,7 +581,9 @@ extern int disk_expand_part_tbl(struct gendisk *disk, int target);
|
||||
extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev);
|
||||
extern struct hd_struct * __must_check add_partition(struct gendisk *disk,
|
||||
int partno, sector_t start,
|
||||
sector_t len, int flags);
|
||||
sector_t len, int flags,
|
||||
struct partition_meta_info
|
||||
*info);
|
||||
extern void delete_partition(struct gendisk *, int);
|
||||
extern void printk_all_partitions(void);
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <linux/lockdep.h>
|
||||
#include <linux/ftrace_irq.h>
|
||||
#include <asm/hardirq.h>
|
||||
#include <asm/system.h>
|
||||
|
||||
/*
|
||||
* We put the hardirq and softirq counter into the preemption
|
||||
@@ -64,6 +63,8 @@
|
||||
#define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT)
|
||||
#define NMI_OFFSET (1UL << NMI_SHIFT)
|
||||
|
||||
#define SOFTIRQ_DISABLE_OFFSET (2 * SOFTIRQ_OFFSET)
|
||||
|
||||
#ifndef PREEMPT_ACTIVE
|
||||
#define PREEMPT_ACTIVE_BITS 1
|
||||
#define PREEMPT_ACTIVE_SHIFT (NMI_SHIFT + NMI_BITS)
|
||||
@@ -82,10 +83,13 @@
|
||||
/*
|
||||
* Are we doing bottom half or hardware interrupt processing?
|
||||
* Are we in a softirq context? Interrupt context?
|
||||
* in_softirq - Are we currently processing softirq or have bh disabled?
|
||||
* in_serving_softirq - Are we currently processing softirq?
|
||||
*/
|
||||
#define in_irq() (hardirq_count())
|
||||
#define in_softirq() (softirq_count())
|
||||
#define in_interrupt() (irq_count())
|
||||
#define in_serving_softirq() (softirq_count() & SOFTIRQ_OFFSET)
|
||||
|
||||
/*
|
||||
* Are we in NMI context?
|
||||
@@ -132,14 +136,16 @@ extern void synchronize_irq(unsigned int irq);
|
||||
|
||||
struct task_struct;
|
||||
|
||||
#ifndef CONFIG_VIRT_CPU_ACCOUNTING
|
||||
#if !defined(CONFIG_VIRT_CPU_ACCOUNTING) && !defined(CONFIG_IRQ_TIME_ACCOUNTING)
|
||||
static inline void account_system_vtime(struct task_struct *tsk)
|
||||
{
|
||||
}
|
||||
#else
|
||||
extern void account_system_vtime(struct task_struct *tsk);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NO_HZ)
|
||||
#if defined(CONFIG_TINY_RCU)
|
||||
#if defined(CONFIG_TINY_RCU) || defined(CONFIG_TINY_PREEMPT_RCU)
|
||||
extern void rcu_enter_nohz(void);
|
||||
extern void rcu_exit_nohz(void);
|
||||
|
||||
|
||||
@@ -9,8 +9,9 @@ struct ht_irq_msg {
|
||||
/* Helper functions.. */
|
||||
void fetch_ht_irq_msg(unsigned int irq, struct ht_irq_msg *msg);
|
||||
void write_ht_irq_msg(unsigned int irq, struct ht_irq_msg *msg);
|
||||
void mask_ht_irq(unsigned int irq);
|
||||
void unmask_ht_irq(unsigned int irq);
|
||||
struct irq_data;
|
||||
void mask_ht_irq(struct irq_data *data);
|
||||
void unmask_ht_irq(struct irq_data *data);
|
||||
|
||||
/* The arch hook for getting things started */
|
||||
int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev);
|
||||
|
||||
+2
-2
@@ -50,14 +50,14 @@
|
||||
|
||||
struct idr_layer {
|
||||
unsigned long bitmap; /* A zero bit means "space here" */
|
||||
struct idr_layer *ary[1<<IDR_BITS];
|
||||
struct idr_layer __rcu *ary[1<<IDR_BITS];
|
||||
int count; /* When zero, we can release it */
|
||||
int layer; /* distance from leaf */
|
||||
struct rcu_head rcu_head;
|
||||
};
|
||||
|
||||
struct idr {
|
||||
struct idr_layer *top;
|
||||
struct idr_layer __rcu *top;
|
||||
struct idr_layer *id_free;
|
||||
int layers; /* only valid without concurrent changes */
|
||||
int id_free_cnt;
|
||||
|
||||
+56
-15
@@ -986,6 +986,7 @@ struct ieee80211_ht_info {
|
||||
#define WLAN_AUTH_OPEN 0
|
||||
#define WLAN_AUTH_SHARED_KEY 1
|
||||
#define WLAN_AUTH_FT 2
|
||||
#define WLAN_AUTH_SAE 3
|
||||
#define WLAN_AUTH_LEAP 128
|
||||
|
||||
#define WLAN_AUTH_CHALLENGE_LEN 128
|
||||
@@ -1072,6 +1073,10 @@ enum ieee80211_statuscode {
|
||||
WLAN_STATUS_NO_DIRECT_LINK = 48,
|
||||
WLAN_STATUS_STA_NOT_PRESENT = 49,
|
||||
WLAN_STATUS_STA_NOT_QSTA = 50,
|
||||
/* 802.11s */
|
||||
WLAN_STATUS_ANTI_CLOG_REQUIRED = 76,
|
||||
WLAN_STATUS_FCG_NOT_SUPP = 78,
|
||||
WLAN_STATUS_STA_NO_TBTT = 78,
|
||||
};
|
||||
|
||||
|
||||
@@ -1112,6 +1117,22 @@ enum ieee80211_reasoncode {
|
||||
WLAN_REASON_QSTA_REQUIRE_SETUP = 38,
|
||||
WLAN_REASON_QSTA_TIMEOUT = 39,
|
||||
WLAN_REASON_QSTA_CIPHER_NOT_SUPP = 45,
|
||||
/* 802.11s */
|
||||
WLAN_REASON_MESH_PEER_CANCELED = 52,
|
||||
WLAN_REASON_MESH_MAX_PEERS = 53,
|
||||
WLAN_REASON_MESH_CONFIG = 54,
|
||||
WLAN_REASON_MESH_CLOSE = 55,
|
||||
WLAN_REASON_MESH_MAX_RETRIES = 56,
|
||||
WLAN_REASON_MESH_CONFIRM_TIMEOUT = 57,
|
||||
WLAN_REASON_MESH_INVALID_GTK = 58,
|
||||
WLAN_REASON_MESH_INCONSISTENT_PARAM = 59,
|
||||
WLAN_REASON_MESH_INVALID_SECURITY = 60,
|
||||
WLAN_REASON_MESH_PATH_ERROR = 61,
|
||||
WLAN_REASON_MESH_PATH_NOFORWARD = 62,
|
||||
WLAN_REASON_MESH_PATH_DEST_UNREACHABLE = 63,
|
||||
WLAN_REASON_MAC_EXISTS_IN_MBSS = 64,
|
||||
WLAN_REASON_MESH_CHAN_REGULATORY = 65,
|
||||
WLAN_REASON_MESH_CHAN = 66,
|
||||
};
|
||||
|
||||
|
||||
@@ -1139,20 +1160,33 @@ enum ieee80211_eid {
|
||||
WLAN_EID_TS_DELAY = 43,
|
||||
WLAN_EID_TCLAS_PROCESSING = 44,
|
||||
WLAN_EID_QOS_CAPA = 46,
|
||||
/* 802.11s
|
||||
*
|
||||
* All mesh EID numbers are pending IEEE 802.11 ANA approval.
|
||||
* The numbers have been incremented from those suggested in
|
||||
* 802.11s/D2.0 so that MESH_CONFIG does not conflict with
|
||||
* EXT_SUPP_RATES.
|
||||
/* 802.11s */
|
||||
WLAN_EID_MESH_CONFIG = 113,
|
||||
WLAN_EID_MESH_ID = 114,
|
||||
WLAN_EID_LINK_METRIC_REPORT = 115,
|
||||
WLAN_EID_CONGESTION_NOTIFICATION = 116,
|
||||
/* Note that the Peer Link IE has been replaced with the similar
|
||||
* Peer Management IE. We will keep the former definition until mesh
|
||||
* code is changed to comply with latest 802.11s drafts.
|
||||
*/
|
||||
WLAN_EID_MESH_CONFIG = 51,
|
||||
WLAN_EID_MESH_ID = 52,
|
||||
WLAN_EID_PEER_LINK = 55,
|
||||
WLAN_EID_PREQ = 68,
|
||||
WLAN_EID_PREP = 69,
|
||||
WLAN_EID_PERR = 70,
|
||||
WLAN_EID_RANN = 49, /* compatible with FreeBSD */
|
||||
WLAN_EID_PEER_LINK = 55, /* no longer in 802.11s drafts */
|
||||
WLAN_EID_PEER_MGMT = 117,
|
||||
WLAN_EID_CHAN_SWITCH_PARAM = 118,
|
||||
WLAN_EID_MESH_AWAKE_WINDOW = 119,
|
||||
WLAN_EID_BEACON_TIMING = 120,
|
||||
WLAN_EID_MCCAOP_SETUP_REQ = 121,
|
||||
WLAN_EID_MCCAOP_SETUP_RESP = 122,
|
||||
WLAN_EID_MCCAOP_ADVERT = 123,
|
||||
WLAN_EID_MCCAOP_TEARDOWN = 124,
|
||||
WLAN_EID_GANN = 125,
|
||||
WLAN_EID_RANN = 126,
|
||||
WLAN_EID_PREQ = 130,
|
||||
WLAN_EID_PREP = 131,
|
||||
WLAN_EID_PERR = 132,
|
||||
WLAN_EID_PXU = 137,
|
||||
WLAN_EID_PXUC = 138,
|
||||
WLAN_EID_AUTH_MESH_PEER_EXCH = 139,
|
||||
WLAN_EID_MIC = 140,
|
||||
|
||||
WLAN_EID_PWR_CONSTRAINT = 32,
|
||||
WLAN_EID_PWR_CAPABILITY = 33,
|
||||
@@ -1211,9 +1245,14 @@ enum ieee80211_category {
|
||||
WLAN_CATEGORY_HT = 7,
|
||||
WLAN_CATEGORY_SA_QUERY = 8,
|
||||
WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9,
|
||||
WLAN_CATEGORY_MESH_ACTION = 13,
|
||||
WLAN_CATEGORY_MULTIHOP_ACTION = 14,
|
||||
WLAN_CATEGORY_SELF_PROTECTED = 15,
|
||||
WLAN_CATEGORY_WMM = 17,
|
||||
WLAN_CATEGORY_MESH_PLINK = 30, /* Pending ANA approval */
|
||||
WLAN_CATEGORY_MESH_PATH_SEL = 32, /* Pending ANA approval */
|
||||
/* TODO: remove MESH_PLINK and MESH_PATH_SEL after */
|
||||
/* mesh is updated to current 802.11s draft */
|
||||
WLAN_CATEGORY_MESH_PLINK = 30,
|
||||
WLAN_CATEGORY_MESH_PATH_SEL = 32,
|
||||
WLAN_CATEGORY_VENDOR_SPECIFIC_PROTECTED = 126,
|
||||
WLAN_CATEGORY_VENDOR_SPECIFIC = 127,
|
||||
};
|
||||
@@ -1351,6 +1390,8 @@ enum ieee80211_sa_query_action {
|
||||
/* AKM suite selectors */
|
||||
#define WLAN_AKM_SUITE_8021X 0x000FAC01
|
||||
#define WLAN_AKM_SUITE_PSK 0x000FAC02
|
||||
#define WLAN_AKM_SUITE_SAE 0x000FAC08
|
||||
#define WLAN_AKM_SUITE_FT_OVER_SAE 0x000FAC09
|
||||
|
||||
#define WLAN_MAX_KEY_LEN 32
|
||||
|
||||
|
||||
@@ -75,6 +75,8 @@
|
||||
#define IFF_DISABLE_NETPOLL 0x2000 /* disable netpoll at run-time */
|
||||
#define IFF_MACVLAN_PORT 0x4000 /* device used as macvlan port */
|
||||
#define IFF_BRIDGE_PORT 0x8000 /* device used as bridge port */
|
||||
#define IFF_OVS_DATAPATH 0x10000 /* device used as Open vSwitch
|
||||
* datapath port */
|
||||
|
||||
#define IF_GET_IFACE 0x0001 /* for querying only */
|
||||
#define IF_GET_PROTO 0x0002
|
||||
|
||||
@@ -84,6 +84,9 @@
|
||||
#define BOND_DEFAULT_MAX_BONDS 1 /* Default maximum number of devices to support */
|
||||
|
||||
#define BOND_DEFAULT_TX_QUEUES 16 /* Default number of tx queues per device */
|
||||
|
||||
#define BOND_DEFAULT_RESEND_IGMP 1 /* Default number of IGMP membership reports */
|
||||
|
||||
/* hashing types */
|
||||
#define BOND_XMIT_POLICY_LAYER2 0 /* layer 2 (MAC only), default */
|
||||
#define BOND_XMIT_POLICY_LAYER34 1 /* layer 3+4 (IP ^ (TCP || UDP)) */
|
||||
|
||||
@@ -137,8 +137,6 @@ extern struct ctl_table ether_table[];
|
||||
|
||||
extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len);
|
||||
|
||||
#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _LINUX_IF_ETHER_H */
|
||||
|
||||
@@ -40,6 +40,12 @@ struct macvlan_rx_stats {
|
||||
unsigned long rx_errors;
|
||||
};
|
||||
|
||||
/*
|
||||
* Maximum times a macvtap device can be opened. This can be used to
|
||||
* configure the number of receive queue, e.g. for multiqueue virtio.
|
||||
*/
|
||||
#define MAX_MACVTAP_QUEUES (NR_CPUS < 16 ? NR_CPUS : 16)
|
||||
|
||||
struct macvlan_dev {
|
||||
struct net_device *dev;
|
||||
struct list_head list;
|
||||
@@ -50,7 +56,8 @@ struct macvlan_dev {
|
||||
enum macvlan_mode mode;
|
||||
int (*receive)(struct sk_buff *skb);
|
||||
int (*forward)(struct net_device *dev, struct sk_buff *skb);
|
||||
struct macvtap_queue *tap;
|
||||
struct macvtap_queue *taps[MAX_MACVTAP_QUEUES];
|
||||
int numvtaps;
|
||||
};
|
||||
|
||||
static inline void macvlan_count_rx(const struct macvlan_dev *vlan,
|
||||
|
||||
+34
-16
@@ -40,25 +40,35 @@
|
||||
* PPPoE addressing definition
|
||||
*/
|
||||
typedef __be16 sid_t;
|
||||
struct pppoe_addr{
|
||||
sid_t sid; /* Session identifier */
|
||||
unsigned char remote[ETH_ALEN]; /* Remote address */
|
||||
char dev[IFNAMSIZ]; /* Local device to use */
|
||||
struct pppoe_addr {
|
||||
sid_t sid; /* Session identifier */
|
||||
unsigned char remote[ETH_ALEN]; /* Remote address */
|
||||
char dev[IFNAMSIZ]; /* Local device to use */
|
||||
};
|
||||
|
||||
/************************************************************************
|
||||
* Protocols supported by AF_PPPOX
|
||||
*/
|
||||
* PPTP addressing definition
|
||||
*/
|
||||
struct pptp_addr {
|
||||
__be16 call_id;
|
||||
struct in_addr sin_addr;
|
||||
};
|
||||
|
||||
/************************************************************************
|
||||
* Protocols supported by AF_PPPOX
|
||||
*/
|
||||
#define PX_PROTO_OE 0 /* Currently just PPPoE */
|
||||
#define PX_PROTO_OL2TP 1 /* Now L2TP also */
|
||||
#define PX_MAX_PROTO 2
|
||||
#define PX_PROTO_PPTP 2
|
||||
#define PX_MAX_PROTO 3
|
||||
|
||||
struct sockaddr_pppox {
|
||||
sa_family_t sa_family; /* address family, AF_PPPOX */
|
||||
unsigned int sa_protocol; /* protocol identifier */
|
||||
union{
|
||||
struct pppoe_addr pppoe;
|
||||
}sa_addr;
|
||||
struct sockaddr_pppox {
|
||||
sa_family_t sa_family; /* address family, AF_PPPOX */
|
||||
unsigned int sa_protocol; /* protocol identifier */
|
||||
union {
|
||||
struct pppoe_addr pppoe;
|
||||
struct pptp_addr pptp;
|
||||
} sa_addr;
|
||||
} __attribute__((packed));
|
||||
|
||||
/* The use of the above union isn't viable because the size of this
|
||||
@@ -150,15 +160,23 @@ struct pppoe_opt {
|
||||
relayed to (PPPoE relaying) */
|
||||
};
|
||||
|
||||
struct pptp_opt {
|
||||
struct pptp_addr src_addr;
|
||||
struct pptp_addr dst_addr;
|
||||
u32 ack_sent, ack_recv;
|
||||
u32 seq_sent, seq_recv;
|
||||
int ppp_flags;
|
||||
};
|
||||
#include <net/sock.h>
|
||||
|
||||
struct pppox_sock {
|
||||
/* struct sock must be the first member of pppox_sock */
|
||||
struct sock sk;
|
||||
struct ppp_channel chan;
|
||||
struct sock sk;
|
||||
struct ppp_channel chan;
|
||||
struct pppox_sock *next; /* for hash table */
|
||||
union {
|
||||
struct pppoe_opt pppoe;
|
||||
struct pptp_opt pptp;
|
||||
} proto;
|
||||
__be16 num;
|
||||
};
|
||||
@@ -186,7 +204,7 @@ struct pppox_proto {
|
||||
struct module *owner;
|
||||
};
|
||||
|
||||
extern int register_pppox_proto(int proto_num, struct pppox_proto *pp);
|
||||
extern int register_pppox_proto(int proto_num, const struct pppox_proto *pp);
|
||||
extern void unregister_pppox_proto(int proto_num);
|
||||
extern void pppox_unbind_sock(struct sock *sk);/* delete ppp-channel binding */
|
||||
extern int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
|
||||
|
||||
+26
-5
@@ -16,6 +16,7 @@
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
|
||||
#define VLAN_HLEN 4 /* The additional bytes (on top of the Ethernet header)
|
||||
* that VLAN requires.
|
||||
@@ -68,6 +69,7 @@ static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb)
|
||||
#define VLAN_CFI_MASK 0x1000 /* Canonical Format Indicator */
|
||||
#define VLAN_TAG_PRESENT VLAN_CFI_MASK
|
||||
#define VLAN_VID_MASK 0x0fff /* VLAN Identifier */
|
||||
#define VLAN_N_VID 4096
|
||||
|
||||
/* found in socket.c */
|
||||
extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *));
|
||||
@@ -76,9 +78,8 @@ extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *));
|
||||
* depends on completely exhausting the VLAN identifier space. Thus
|
||||
* it gives constant time look-up, but in many cases it wastes memory.
|
||||
*/
|
||||
#define VLAN_GROUP_ARRAY_LEN 4096
|
||||
#define VLAN_GROUP_ARRAY_SPLIT_PARTS 8
|
||||
#define VLAN_GROUP_ARRAY_PART_LEN (VLAN_GROUP_ARRAY_LEN/VLAN_GROUP_ARRAY_SPLIT_PARTS)
|
||||
#define VLAN_GROUP_ARRAY_PART_LEN (VLAN_N_VID/VLAN_GROUP_ARRAY_SPLIT_PARTS)
|
||||
|
||||
struct vlan_group {
|
||||
struct net_device *real_dev; /* The ethernet(like) device
|
||||
@@ -114,12 +115,24 @@ static inline void vlan_group_set_device(struct vlan_group *vg,
|
||||
#define vlan_tx_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT)
|
||||
|
||||
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
|
||||
/* Must be invoked with rcu_read_lock or with RTNL. */
|
||||
static inline struct net_device *vlan_find_dev(struct net_device *real_dev,
|
||||
u16 vlan_id)
|
||||
{
|
||||
struct vlan_group *grp = rcu_dereference_rtnl(real_dev->vlgrp);
|
||||
|
||||
if (grp)
|
||||
return vlan_group_get_device(grp, vlan_id);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
extern struct net_device *vlan_dev_real_dev(const struct net_device *dev);
|
||||
extern u16 vlan_dev_vlan_id(const struct net_device *dev);
|
||||
|
||||
extern int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
|
||||
u16 vlan_tci, int polling);
|
||||
extern int vlan_hwaccel_do_receive(struct sk_buff *skb);
|
||||
extern bool vlan_hwaccel_do_receive(struct sk_buff **skb);
|
||||
extern gro_result_t
|
||||
vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp,
|
||||
unsigned int vlan_tci, struct sk_buff *skb);
|
||||
@@ -128,6 +141,12 @@ vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp,
|
||||
unsigned int vlan_tci);
|
||||
|
||||
#else
|
||||
static inline struct net_device *vlan_find_dev(struct net_device *real_dev,
|
||||
u16 vlan_id)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev)
|
||||
{
|
||||
BUG();
|
||||
@@ -147,9 +166,11 @@ static inline int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
|
||||
return NET_XMIT_SUCCESS;
|
||||
}
|
||||
|
||||
static inline int vlan_hwaccel_do_receive(struct sk_buff *skb)
|
||||
static inline bool vlan_hwaccel_do_receive(struct sk_buff **skb)
|
||||
{
|
||||
return 0;
|
||||
if ((*skb)->vlan_tci & VLAN_VID_MASK)
|
||||
(*skb)->pkt_type = PACKET_OTHERHOST;
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline gro_result_t
|
||||
|
||||
@@ -250,6 +250,25 @@ struct sockaddr_in {
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#include <linux/errno.h>
|
||||
|
||||
static inline int proto_ports_offset(int proto)
|
||||
{
|
||||
switch (proto) {
|
||||
case IPPROTO_TCP:
|
||||
case IPPROTO_UDP:
|
||||
case IPPROTO_DCCP:
|
||||
case IPPROTO_ESP: /* SPI */
|
||||
case IPPROTO_SCTP:
|
||||
case IPPROTO_UDPLITE:
|
||||
return 0;
|
||||
case IPPROTO_AH: /* SPI */
|
||||
return 4;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
static inline bool ipv4_is_loopback(__be32 addr)
|
||||
{
|
||||
return (addr & htonl(0xff000000)) == htonl(0x7f000000);
|
||||
|
||||
@@ -268,6 +268,10 @@ struct in6_flowlabel_req {
|
||||
/* RFC5082: Generalized Ttl Security Mechanism */
|
||||
#define IPV6_MINHOPCOUNT 73
|
||||
|
||||
#define IPV6_ORIGDSTADDR 74
|
||||
#define IPV6_RECVORIGDSTADDR IPV6_ORIGDSTADDR
|
||||
#define IPV6_TRANSPARENT 75
|
||||
|
||||
/*
|
||||
* Multicast Routing:
|
||||
* see include/linux/mroute6.h.
|
||||
|
||||
+11
-10
@@ -9,6 +9,7 @@
|
||||
#include <linux/rcupdate.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/sysctl.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -158,7 +159,12 @@ struct in_ifaddr {
|
||||
extern int register_inetaddr_notifier(struct notifier_block *nb);
|
||||
extern int unregister_inetaddr_notifier(struct notifier_block *nb);
|
||||
|
||||
extern struct net_device *ip_dev_find(struct net *net, __be32 addr);
|
||||
extern struct net_device *__ip_dev_find(struct net *net, __be32 addr, bool devref);
|
||||
static inline struct net_device *ip_dev_find(struct net *net, __be32 addr)
|
||||
{
|
||||
return __ip_dev_find(net, addr, true);
|
||||
}
|
||||
|
||||
extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b);
|
||||
extern int devinet_ioctl(struct net *net, unsigned int cmd, void __user *);
|
||||
extern void devinet_init(void);
|
||||
@@ -198,14 +204,10 @@ static __inline__ int bad_mask(__be32 mask, __be32 addr)
|
||||
|
||||
static inline struct in_device *__in_dev_get_rcu(const struct net_device *dev)
|
||||
{
|
||||
struct in_device *in_dev = dev->ip_ptr;
|
||||
if (in_dev)
|
||||
in_dev = rcu_dereference(in_dev);
|
||||
return in_dev;
|
||||
return rcu_dereference(dev->ip_ptr);
|
||||
}
|
||||
|
||||
static __inline__ struct in_device *
|
||||
in_dev_get(const struct net_device *dev)
|
||||
static inline struct in_device *in_dev_get(const struct net_device *dev)
|
||||
{
|
||||
struct in_device *in_dev;
|
||||
|
||||
@@ -217,10 +219,9 @@ in_dev_get(const struct net_device *dev)
|
||||
return in_dev;
|
||||
}
|
||||
|
||||
static __inline__ struct in_device *
|
||||
__in_dev_get_rtnl(const struct net_device *dev)
|
||||
static inline struct in_device *__in_dev_get_rtnl(const struct net_device *dev)
|
||||
{
|
||||
return (struct in_device*)dev->ip_ptr;
|
||||
return rcu_dereference_check(dev->ip_ptr, lockdep_rtnl_is_held());
|
||||
}
|
||||
|
||||
extern void in_dev_finish_destroy(struct in_device *idev);
|
||||
|
||||
+10
-3
@@ -46,16 +46,23 @@
|
||||
#define __exitdata __section(.exit.data)
|
||||
#define __exit_call __used __section(.exitcall.exit)
|
||||
|
||||
/* modpost check for section mismatches during the kernel build.
|
||||
/*
|
||||
* modpost check for section mismatches during the kernel build.
|
||||
* A section mismatch happens when there are references from a
|
||||
* code or data section to an init section (both code or data).
|
||||
* The init sections are (for most archs) discarded by the kernel
|
||||
* when early init has completed so all such references are potential bugs.
|
||||
* For exit sections the same issue exists.
|
||||
*
|
||||
* The following markers are used for the cases where the reference to
|
||||
* the *init / *exit section (code or data) is valid and will teach
|
||||
* modpost not to issue a warning.
|
||||
* The markers follow same syntax rules as __init / __initdata. */
|
||||
* modpost not to issue a warning. Intended semantics is that a code or
|
||||
* data tagged __ref* can reference code or data from init section without
|
||||
* producing a warning (of course, no warning does not mean code is
|
||||
* correct, so optimally document why the __ref is needed and why it's OK).
|
||||
*
|
||||
* The markers follow same syntax rules as __init / __initdata.
|
||||
*/
|
||||
#define __ref __section(.ref.text) noinline
|
||||
#define __refdata __section(.ref.data)
|
||||
#define __refconst __section(.ref.rodata)
|
||||
|
||||
@@ -82,11 +82,17 @@ extern struct group_info init_groups;
|
||||
# define CAP_INIT_BSET CAP_FULL_SET
|
||||
|
||||
#ifdef CONFIG_TREE_PREEMPT_RCU
|
||||
#define INIT_TASK_RCU_TREE_PREEMPT() \
|
||||
.rcu_blocked_node = NULL,
|
||||
#else
|
||||
#define INIT_TASK_RCU_TREE_PREEMPT(tsk)
|
||||
#endif
|
||||
#ifdef CONFIG_PREEMPT_RCU
|
||||
#define INIT_TASK_RCU_PREEMPT(tsk) \
|
||||
.rcu_read_lock_nesting = 0, \
|
||||
.rcu_read_unlock_special = 0, \
|
||||
.rcu_blocked_node = NULL, \
|
||||
.rcu_node_entry = LIST_HEAD_INIT(tsk.rcu_node_entry),
|
||||
.rcu_node_entry = LIST_HEAD_INIT(tsk.rcu_node_entry), \
|
||||
INIT_TASK_RCU_TREE_PREEMPT()
|
||||
#else
|
||||
#define INIT_TASK_RCU_PREEMPT(tsk)
|
||||
#endif
|
||||
@@ -137,8 +143,8 @@ extern struct cred init_cred;
|
||||
.children = LIST_HEAD_INIT(tsk.children), \
|
||||
.sibling = LIST_HEAD_INIT(tsk.sibling), \
|
||||
.group_leader = &tsk, \
|
||||
.real_cred = &init_cred, \
|
||||
.cred = &init_cred, \
|
||||
RCU_INIT_POINTER(.real_cred, &init_cred), \
|
||||
RCU_INIT_POINTER(.cred, &init_cred), \
|
||||
.cred_guard_mutex = \
|
||||
__MUTEX_INITIALIZER(tsk.cred_guard_mutex), \
|
||||
.comm = "swapper", \
|
||||
|
||||
@@ -1196,7 +1196,7 @@ struct input_dev {
|
||||
int (*flush)(struct input_dev *dev, struct file *file);
|
||||
int (*event)(struct input_dev *dev, unsigned int type, unsigned int code, int value);
|
||||
|
||||
struct input_handle *grab;
|
||||
struct input_handle __rcu *grab;
|
||||
|
||||
spinlock_t event_lock;
|
||||
struct mutex mutex;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <asm/atomic.h>
|
||||
#include <asm/ptrace.h>
|
||||
#include <asm/system.h>
|
||||
#include <trace/events/irq.h>
|
||||
|
||||
/*
|
||||
* These correspond to the IORESOURCE_IRQ_* defines in
|
||||
@@ -407,10 +408,14 @@ asmlinkage void do_softirq(void);
|
||||
asmlinkage void __do_softirq(void);
|
||||
extern void open_softirq(int nr, void (*action)(struct softirq_action *));
|
||||
extern void softirq_init(void);
|
||||
#define __raise_softirq_irqoff(nr) do { or_softirq_pending(1UL << (nr)); } while (0)
|
||||
static inline void __raise_softirq_irqoff(unsigned int nr)
|
||||
{
|
||||
trace_softirq_raise((struct softirq_action *)(unsigned long)nr, NULL);
|
||||
or_softirq_pending(1UL << nr);
|
||||
}
|
||||
|
||||
extern void raise_softirq_irqoff(unsigned int nr);
|
||||
extern void raise_softirq(unsigned int nr);
|
||||
extern void wakeup_softirqd(void);
|
||||
|
||||
/* This is the worklist that queues up per-cpu softirq work.
|
||||
*
|
||||
@@ -641,11 +646,8 @@ static inline void init_irq_proc(void)
|
||||
struct seq_file;
|
||||
int show_interrupts(struct seq_file *p, void *v);
|
||||
|
||||
struct irq_desc;
|
||||
|
||||
extern int early_irq_init(void);
|
||||
extern int arch_probe_nr_irqs(void);
|
||||
extern int arch_early_irq_init(void);
|
||||
extern int arch_init_chip_data(struct irq_desc *desc, int node);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -53,7 +53,7 @@ struct io_context {
|
||||
|
||||
struct radix_tree_root radix_root;
|
||||
struct hlist_head cic_list;
|
||||
void *ioc_data;
|
||||
void __rcu *ioc_data;
|
||||
};
|
||||
|
||||
static inline struct io_context *ioc_task_link(struct io_context *ioc)
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
|
||||
/*
|
||||
* IPVS Connection Flags
|
||||
* Only flags 0..15 are sent to backup server
|
||||
*/
|
||||
#define IP_VS_CONN_F_FWD_MASK 0x0007 /* mask for the fwd methods */
|
||||
#define IP_VS_CONN_F_MASQ 0x0000 /* masquerading/NAT */
|
||||
@@ -88,9 +89,20 @@
|
||||
#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */
|
||||
#define IP_VS_CONN_F_ONE_PACKET 0x2000 /* forward only one packet */
|
||||
|
||||
/* Flags that are not sent to backup server start from bit 16 */
|
||||
#define IP_VS_CONN_F_NFCT (1 << 16) /* use netfilter conntrack */
|
||||
|
||||
/* Connection flags from destination that can be changed by user space */
|
||||
#define IP_VS_CONN_F_DEST_MASK (IP_VS_CONN_F_FWD_MASK | \
|
||||
IP_VS_CONN_F_ONE_PACKET | \
|
||||
IP_VS_CONN_F_NFCT | \
|
||||
0)
|
||||
|
||||
#define IP_VS_SCHEDNAME_MAXLEN 16
|
||||
#define IP_VS_PENAME_MAXLEN 16
|
||||
#define IP_VS_IFNAME_MAXLEN 16
|
||||
|
||||
#define IP_VS_PEDATA_MAXLEN 255
|
||||
|
||||
/*
|
||||
* The struct ip_vs_service_user and struct ip_vs_dest_user are
|
||||
@@ -324,6 +336,9 @@ enum {
|
||||
IPVS_SVC_ATTR_NETMASK, /* persistent netmask */
|
||||
|
||||
IPVS_SVC_ATTR_STATS, /* nested attribute for service stats */
|
||||
|
||||
IPVS_SVC_ATTR_PE_NAME, /* name of ct retriever */
|
||||
|
||||
__IPVS_SVC_ATTR_MAX,
|
||||
};
|
||||
|
||||
|
||||
@@ -341,7 +341,9 @@ struct ipv6_pinfo {
|
||||
odstopts:1,
|
||||
rxflow:1,
|
||||
rxtclass:1,
|
||||
rxpmtu:1;
|
||||
rxpmtu:1,
|
||||
rxorigdstaddr:1;
|
||||
/* 2 bits hole */
|
||||
} bits;
|
||||
__u16 all;
|
||||
} rxopt;
|
||||
|
||||
+196
-301
@@ -72,6 +72,10 @@ typedef void (*irq_flow_handler_t)(unsigned int irq,
|
||||
#define IRQ_ONESHOT 0x08000000 /* IRQ is not unmasked after hardirq */
|
||||
#define IRQ_NESTED_THREAD 0x10000000 /* IRQ is nested into another, no own handler thread */
|
||||
|
||||
#define IRQF_MODIFY_MASK \
|
||||
(IRQ_TYPE_SENSE_MASK | IRQ_NOPROBE | IRQ_NOREQUEST | \
|
||||
IRQ_NOAUTOEN | IRQ_MOVE_PCNTXT | IRQ_LEVEL)
|
||||
|
||||
#ifdef CONFIG_IRQ_PER_CPU
|
||||
# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU)
|
||||
# define IRQ_NO_BALANCING_MASK (IRQ_PER_CPU | IRQ_NO_BALANCING)
|
||||
@@ -80,36 +84,77 @@ typedef void (*irq_flow_handler_t)(unsigned int irq,
|
||||
# define IRQ_NO_BALANCING_MASK IRQ_NO_BALANCING
|
||||
#endif
|
||||
|
||||
struct proc_dir_entry;
|
||||
struct msi_desc;
|
||||
|
||||
/**
|
||||
* struct irq_data - per irq and irq chip data passed down to chip functions
|
||||
* @irq: interrupt number
|
||||
* @node: node index useful for balancing
|
||||
* @chip: low level interrupt hardware access
|
||||
* @handler_data: per-IRQ data for the irq_chip methods
|
||||
* @chip_data: platform-specific per-chip private data for the chip
|
||||
* methods, to allow shared chip implementations
|
||||
* @msi_desc: MSI descriptor
|
||||
* @affinity: IRQ affinity on SMP
|
||||
*
|
||||
* The fields here need to overlay the ones in irq_desc until we
|
||||
* cleaned up the direct references and switched everything over to
|
||||
* irq_data.
|
||||
*/
|
||||
struct irq_data {
|
||||
unsigned int irq;
|
||||
unsigned int node;
|
||||
struct irq_chip *chip;
|
||||
void *handler_data;
|
||||
void *chip_data;
|
||||
struct msi_desc *msi_desc;
|
||||
#ifdef CONFIG_SMP
|
||||
cpumask_var_t affinity;
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
* struct irq_chip - hardware interrupt chip descriptor
|
||||
*
|
||||
* @name: name for /proc/interrupts
|
||||
* @startup: start up the interrupt (defaults to ->enable if NULL)
|
||||
* @shutdown: shut down the interrupt (defaults to ->disable if NULL)
|
||||
* @enable: enable the interrupt (defaults to chip->unmask if NULL)
|
||||
* @disable: disable the interrupt
|
||||
* @ack: start of a new interrupt
|
||||
* @mask: mask an interrupt source
|
||||
* @mask_ack: ack and mask an interrupt source
|
||||
* @unmask: unmask an interrupt source
|
||||
* @eoi: end of interrupt - chip level
|
||||
* @end: end of interrupt - flow level
|
||||
* @set_affinity: set the CPU affinity on SMP machines
|
||||
* @retrigger: resend an IRQ to the CPU
|
||||
* @set_type: set the flow type (IRQ_TYPE_LEVEL/etc.) of an IRQ
|
||||
* @set_wake: enable/disable power-management wake-on of an IRQ
|
||||
* @startup: deprecated, replaced by irq_startup
|
||||
* @shutdown: deprecated, replaced by irq_shutdown
|
||||
* @enable: deprecated, replaced by irq_enable
|
||||
* @disable: deprecated, replaced by irq_disable
|
||||
* @ack: deprecated, replaced by irq_ack
|
||||
* @mask: deprecated, replaced by irq_mask
|
||||
* @mask_ack: deprecated, replaced by irq_mask_ack
|
||||
* @unmask: deprecated, replaced by irq_unmask
|
||||
* @eoi: deprecated, replaced by irq_eoi
|
||||
* @end: deprecated, will go away with __do_IRQ()
|
||||
* @set_affinity: deprecated, replaced by irq_set_affinity
|
||||
* @retrigger: deprecated, replaced by irq_retrigger
|
||||
* @set_type: deprecated, replaced by irq_set_type
|
||||
* @set_wake: deprecated, replaced by irq_wake
|
||||
* @bus_lock: deprecated, replaced by irq_bus_lock
|
||||
* @bus_sync_unlock: deprecated, replaced by irq_bus_sync_unlock
|
||||
*
|
||||
* @bus_lock: function to lock access to slow bus (i2c) chips
|
||||
* @bus_sync_unlock: function to sync and unlock slow bus (i2c) chips
|
||||
* @irq_startup: start up the interrupt (defaults to ->enable if NULL)
|
||||
* @irq_shutdown: shut down the interrupt (defaults to ->disable if NULL)
|
||||
* @irq_enable: enable the interrupt (defaults to chip->unmask if NULL)
|
||||
* @irq_disable: disable the interrupt
|
||||
* @irq_ack: start of a new interrupt
|
||||
* @irq_mask: mask an interrupt source
|
||||
* @irq_mask_ack: ack and mask an interrupt source
|
||||
* @irq_unmask: unmask an interrupt source
|
||||
* @irq_eoi: end of interrupt
|
||||
* @irq_set_affinity: set the CPU affinity on SMP machines
|
||||
* @irq_retrigger: resend an IRQ to the CPU
|
||||
* @irq_set_type: set the flow type (IRQ_TYPE_LEVEL/etc.) of an IRQ
|
||||
* @irq_set_wake: enable/disable power-management wake-on of an IRQ
|
||||
* @irq_bus_lock: function to lock access to slow bus (i2c) chips
|
||||
* @irq_bus_sync_unlock:function to sync and unlock slow bus (i2c) chips
|
||||
*
|
||||
* @release: release function solely used by UML
|
||||
* @typename: obsoleted by name, kept as migration helper
|
||||
*/
|
||||
struct irq_chip {
|
||||
const char *name;
|
||||
#ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
|
||||
unsigned int (*startup)(unsigned int irq);
|
||||
void (*shutdown)(unsigned int irq);
|
||||
void (*enable)(unsigned int irq);
|
||||
@@ -130,154 +175,66 @@ struct irq_chip {
|
||||
|
||||
void (*bus_lock)(unsigned int irq);
|
||||
void (*bus_sync_unlock)(unsigned int irq);
|
||||
#endif
|
||||
unsigned int (*irq_startup)(struct irq_data *data);
|
||||
void (*irq_shutdown)(struct irq_data *data);
|
||||
void (*irq_enable)(struct irq_data *data);
|
||||
void (*irq_disable)(struct irq_data *data);
|
||||
|
||||
void (*irq_ack)(struct irq_data *data);
|
||||
void (*irq_mask)(struct irq_data *data);
|
||||
void (*irq_mask_ack)(struct irq_data *data);
|
||||
void (*irq_unmask)(struct irq_data *data);
|
||||
void (*irq_eoi)(struct irq_data *data);
|
||||
|
||||
int (*irq_set_affinity)(struct irq_data *data, const struct cpumask *dest, bool force);
|
||||
int (*irq_retrigger)(struct irq_data *data);
|
||||
int (*irq_set_type)(struct irq_data *data, unsigned int flow_type);
|
||||
int (*irq_set_wake)(struct irq_data *data, unsigned int on);
|
||||
|
||||
void (*irq_bus_lock)(struct irq_data *data);
|
||||
void (*irq_bus_sync_unlock)(struct irq_data *data);
|
||||
|
||||
/* Currently used only by UML, might disappear one day.*/
|
||||
#ifdef CONFIG_IRQ_RELEASE_METHOD
|
||||
void (*release)(unsigned int irq, void *dev_id);
|
||||
#endif
|
||||
/*
|
||||
* For compatibility, ->typename is copied into ->name.
|
||||
* Will disappear.
|
||||
*/
|
||||
const char *typename;
|
||||
};
|
||||
|
||||
struct timer_rand_state;
|
||||
struct irq_2_iommu;
|
||||
/**
|
||||
* struct irq_desc - interrupt descriptor
|
||||
* @irq: interrupt number for this descriptor
|
||||
* @timer_rand_state: pointer to timer rand state struct
|
||||
* @kstat_irqs: irq stats per cpu
|
||||
* @irq_2_iommu: iommu with this irq
|
||||
* @handle_irq: highlevel irq-events handler [if NULL, __do_IRQ()]
|
||||
* @chip: low level interrupt hardware access
|
||||
* @msi_desc: MSI descriptor
|
||||
* @handler_data: per-IRQ data for the irq_chip methods
|
||||
* @chip_data: platform-specific per-chip private data for the chip
|
||||
* methods, to allow shared chip implementations
|
||||
* @action: the irq action chain
|
||||
* @status: status information
|
||||
* @depth: disable-depth, for nested irq_disable() calls
|
||||
* @wake_depth: enable depth, for multiple set_irq_wake() callers
|
||||
* @irq_count: stats field to detect stalled irqs
|
||||
* @last_unhandled: aging timer for unhandled count
|
||||
* @irqs_unhandled: stats field for spurious unhandled interrupts
|
||||
* @lock: locking for SMP
|
||||
* @affinity: IRQ affinity on SMP
|
||||
* @node: node index useful for balancing
|
||||
* @pending_mask: pending rebalanced interrupts
|
||||
* @threads_active: number of irqaction threads currently running
|
||||
* @wait_for_threads: wait queue for sync_irq to wait for threaded handlers
|
||||
* @dir: /proc/irq/ procfs entry
|
||||
* @name: flow handler name for /proc/interrupts output
|
||||
*/
|
||||
struct irq_desc {
|
||||
unsigned int irq;
|
||||
struct timer_rand_state *timer_rand_state;
|
||||
unsigned int *kstat_irqs;
|
||||
#ifdef CONFIG_INTR_REMAP
|
||||
struct irq_2_iommu *irq_2_iommu;
|
||||
#endif
|
||||
irq_flow_handler_t handle_irq;
|
||||
struct irq_chip *chip;
|
||||
struct msi_desc *msi_desc;
|
||||
void *handler_data;
|
||||
void *chip_data;
|
||||
struct irqaction *action; /* IRQ action list */
|
||||
unsigned int status; /* IRQ status */
|
||||
|
||||
unsigned int depth; /* nested irq disables */
|
||||
unsigned int wake_depth; /* nested wake enables */
|
||||
unsigned int irq_count; /* For detecting broken IRQs */
|
||||
unsigned long last_unhandled; /* Aging timer for unhandled count */
|
||||
unsigned int irqs_unhandled;
|
||||
raw_spinlock_t lock;
|
||||
#ifdef CONFIG_SMP
|
||||
cpumask_var_t affinity;
|
||||
const struct cpumask *affinity_hint;
|
||||
unsigned int node;
|
||||
#ifdef CONFIG_GENERIC_PENDING_IRQ
|
||||
cpumask_var_t pending_mask;
|
||||
#endif
|
||||
#endif
|
||||
atomic_t threads_active;
|
||||
wait_queue_head_t wait_for_threads;
|
||||
#ifdef CONFIG_PROC_FS
|
||||
struct proc_dir_entry *dir;
|
||||
#endif
|
||||
const char *name;
|
||||
} ____cacheline_internodealigned_in_smp;
|
||||
|
||||
extern void arch_init_copy_chip_data(struct irq_desc *old_desc,
|
||||
struct irq_desc *desc, int node);
|
||||
extern void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc);
|
||||
|
||||
#ifndef CONFIG_SPARSE_IRQ
|
||||
extern struct irq_desc irq_desc[NR_IRQS];
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NUMA_IRQ_DESC
|
||||
extern struct irq_desc *move_irq_desc(struct irq_desc *old_desc, int node);
|
||||
#else
|
||||
static inline struct irq_desc *move_irq_desc(struct irq_desc *desc, int node)
|
||||
{
|
||||
return desc;
|
||||
}
|
||||
#endif
|
||||
|
||||
extern struct irq_desc *irq_to_desc_alloc_node(unsigned int irq, int node);
|
||||
/* This include will go away once we isolated irq_desc usage to core code */
|
||||
#include <linux/irqdesc.h>
|
||||
|
||||
/*
|
||||
* Pick up the arch-dependent methods:
|
||||
*/
|
||||
#include <asm/hw_irq.h>
|
||||
|
||||
#ifndef NR_IRQS_LEGACY
|
||||
# define NR_IRQS_LEGACY 0
|
||||
#endif
|
||||
|
||||
#ifndef ARCH_IRQ_INIT_FLAGS
|
||||
# define ARCH_IRQ_INIT_FLAGS 0
|
||||
#endif
|
||||
|
||||
#define IRQ_DEFAULT_INIT_FLAGS (IRQ_DISABLED | ARCH_IRQ_INIT_FLAGS)
|
||||
|
||||
struct irqaction;
|
||||
extern int setup_irq(unsigned int irq, struct irqaction *new);
|
||||
extern void remove_irq(unsigned int irq, struct irqaction *act);
|
||||
|
||||
#ifdef CONFIG_GENERIC_HARDIRQS
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
|
||||
#ifdef CONFIG_GENERIC_PENDING_IRQ
|
||||
|
||||
#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_PENDING_IRQ)
|
||||
void move_native_irq(int irq);
|
||||
void move_masked_irq(int irq);
|
||||
|
||||
#else /* CONFIG_GENERIC_PENDING_IRQ */
|
||||
|
||||
static inline void move_irq(int irq)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void move_native_irq(int irq)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void move_masked_irq(int irq)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* CONFIG_GENERIC_PENDING_IRQ */
|
||||
|
||||
#else /* CONFIG_SMP */
|
||||
|
||||
#define move_native_irq(x)
|
||||
#define move_masked_irq(x)
|
||||
|
||||
#endif /* CONFIG_SMP */
|
||||
#else
|
||||
static inline void move_native_irq(int irq) { }
|
||||
static inline void move_masked_irq(int irq) { }
|
||||
#endif
|
||||
|
||||
extern int no_irq_affinity;
|
||||
|
||||
static inline int irq_balancing_disabled(unsigned int irq)
|
||||
{
|
||||
struct irq_desc *desc;
|
||||
|
||||
desc = irq_to_desc(irq);
|
||||
return desc->status & IRQ_NO_BALANCING_MASK;
|
||||
}
|
||||
|
||||
/* Handle irq action chains: */
|
||||
extern irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action);
|
||||
|
||||
@@ -293,42 +250,10 @@ extern void handle_percpu_irq(unsigned int irq, struct irq_desc *desc);
|
||||
extern void handle_bad_irq(unsigned int irq, struct irq_desc *desc);
|
||||
extern void handle_nested_irq(unsigned int irq);
|
||||
|
||||
/*
|
||||
* Monolithic do_IRQ implementation.
|
||||
*/
|
||||
#ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
|
||||
extern unsigned int __do_IRQ(unsigned int irq);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Architectures call this to let the generic IRQ layer
|
||||
* handle an interrupt. If the descriptor is attached to an
|
||||
* irqchip-style controller then we call the ->handle_irq() handler,
|
||||
* and it calls __do_IRQ() if it's attached to an irqtype-style controller.
|
||||
*/
|
||||
static inline void generic_handle_irq_desc(unsigned int irq, struct irq_desc *desc)
|
||||
{
|
||||
#ifdef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
|
||||
desc->handle_irq(irq, desc);
|
||||
#else
|
||||
if (likely(desc->handle_irq))
|
||||
desc->handle_irq(irq, desc);
|
||||
else
|
||||
__do_IRQ(irq);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void generic_handle_irq(unsigned int irq)
|
||||
{
|
||||
generic_handle_irq_desc(irq, irq_to_desc(irq));
|
||||
}
|
||||
|
||||
/* Handling of unhandled and spurious interrupts: */
|
||||
extern void note_interrupt(unsigned int irq, struct irq_desc *desc,
|
||||
irqreturn_t action_ret);
|
||||
|
||||
/* Resending of interrupts :*/
|
||||
void check_irq_resend(struct irq_desc *desc, unsigned int irq);
|
||||
|
||||
/* Enable/disable irq debugging output: */
|
||||
extern int noirqdebug_setup(char *str);
|
||||
@@ -351,16 +276,6 @@ extern void
|
||||
__set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
|
||||
const char *name);
|
||||
|
||||
/* caller has locked the irq_desc and both params are valid */
|
||||
static inline void __set_irq_handler_unlocked(int irq,
|
||||
irq_flow_handler_t handler)
|
||||
{
|
||||
struct irq_desc *desc;
|
||||
|
||||
desc = irq_to_desc(irq);
|
||||
desc->handle_irq = handler;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set a highlevel flow handler for a given IRQ:
|
||||
*/
|
||||
@@ -384,26 +299,42 @@ set_irq_chained_handler(unsigned int irq,
|
||||
|
||||
extern void set_irq_nested_thread(unsigned int irq, int nest);
|
||||
|
||||
extern void set_irq_noprobe(unsigned int irq);
|
||||
extern void set_irq_probe(unsigned int irq);
|
||||
void irq_modify_status(unsigned int irq, unsigned long clr, unsigned long set);
|
||||
|
||||
static inline void irq_set_status_flags(unsigned int irq, unsigned long set)
|
||||
{
|
||||
irq_modify_status(irq, 0, set);
|
||||
}
|
||||
|
||||
static inline void irq_clear_status_flags(unsigned int irq, unsigned long clr)
|
||||
{
|
||||
irq_modify_status(irq, clr, 0);
|
||||
}
|
||||
|
||||
static inline void set_irq_noprobe(unsigned int irq)
|
||||
{
|
||||
irq_modify_status(irq, 0, IRQ_NOPROBE);
|
||||
}
|
||||
|
||||
static inline void set_irq_probe(unsigned int irq)
|
||||
{
|
||||
irq_modify_status(irq, IRQ_NOPROBE, 0);
|
||||
}
|
||||
|
||||
/* Handle dynamic irq creation and destruction */
|
||||
extern unsigned int create_irq_nr(unsigned int irq_want, int node);
|
||||
extern int create_irq(void);
|
||||
extern void destroy_irq(unsigned int irq);
|
||||
|
||||
/* Test to see if a driver has successfully requested an irq */
|
||||
static inline int irq_has_action(unsigned int irq)
|
||||
{
|
||||
struct irq_desc *desc = irq_to_desc(irq);
|
||||
return desc->action != NULL;
|
||||
}
|
||||
|
||||
/* Dynamic irq helper functions */
|
||||
extern void dynamic_irq_init(unsigned int irq);
|
||||
void dynamic_irq_init_keep_chip_data(unsigned int irq);
|
||||
/*
|
||||
* Dynamic irq helper functions. Obsolete. Use irq_alloc_desc* and
|
||||
* irq_free_desc instead.
|
||||
*/
|
||||
extern void dynamic_irq_cleanup(unsigned int irq);
|
||||
void dynamic_irq_cleanup_keep_chip_data(unsigned int irq);
|
||||
static inline void dynamic_irq_init(unsigned int irq)
|
||||
{
|
||||
dynamic_irq_cleanup(irq);
|
||||
}
|
||||
|
||||
/* Set/get chip/data for an IRQ: */
|
||||
extern int set_irq_chip(unsigned int irq, struct irq_chip *chip);
|
||||
@@ -411,114 +342,78 @@ extern int set_irq_data(unsigned int irq, void *data);
|
||||
extern int set_irq_chip_data(unsigned int irq, void *data);
|
||||
extern int set_irq_type(unsigned int irq, unsigned int type);
|
||||
extern int set_irq_msi(unsigned int irq, struct msi_desc *entry);
|
||||
extern struct irq_data *irq_get_irq_data(unsigned int irq);
|
||||
|
||||
#define get_irq_chip(irq) (irq_to_desc(irq)->chip)
|
||||
#define get_irq_chip_data(irq) (irq_to_desc(irq)->chip_data)
|
||||
#define get_irq_data(irq) (irq_to_desc(irq)->handler_data)
|
||||
#define get_irq_msi(irq) (irq_to_desc(irq)->msi_desc)
|
||||
static inline struct irq_chip *get_irq_chip(unsigned int irq)
|
||||
{
|
||||
struct irq_data *d = irq_get_irq_data(irq);
|
||||
return d ? d->chip : NULL;
|
||||
}
|
||||
|
||||
#define get_irq_desc_chip(desc) ((desc)->chip)
|
||||
#define get_irq_desc_chip_data(desc) ((desc)->chip_data)
|
||||
#define get_irq_desc_data(desc) ((desc)->handler_data)
|
||||
#define get_irq_desc_msi(desc) ((desc)->msi_desc)
|
||||
static inline struct irq_chip *irq_data_get_irq_chip(struct irq_data *d)
|
||||
{
|
||||
return d->chip;
|
||||
}
|
||||
|
||||
static inline void *get_irq_chip_data(unsigned int irq)
|
||||
{
|
||||
struct irq_data *d = irq_get_irq_data(irq);
|
||||
return d ? d->chip_data : NULL;
|
||||
}
|
||||
|
||||
static inline void *irq_data_get_irq_chip_data(struct irq_data *d)
|
||||
{
|
||||
return d->chip_data;
|
||||
}
|
||||
|
||||
static inline void *get_irq_data(unsigned int irq)
|
||||
{
|
||||
struct irq_data *d = irq_get_irq_data(irq);
|
||||
return d ? d->handler_data : NULL;
|
||||
}
|
||||
|
||||
static inline void *irq_data_get_irq_data(struct irq_data *d)
|
||||
{
|
||||
return d->handler_data;
|
||||
}
|
||||
|
||||
static inline struct msi_desc *get_irq_msi(unsigned int irq)
|
||||
{
|
||||
struct irq_data *d = irq_get_irq_data(irq);
|
||||
return d ? d->msi_desc : NULL;
|
||||
}
|
||||
|
||||
static inline struct msi_desc *irq_data_get_msi(struct irq_data *d)
|
||||
{
|
||||
return d->msi_desc;
|
||||
}
|
||||
|
||||
int irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node);
|
||||
void irq_free_descs(unsigned int irq, unsigned int cnt);
|
||||
int irq_reserve_irqs(unsigned int from, unsigned int cnt);
|
||||
|
||||
static inline int irq_alloc_desc(int node)
|
||||
{
|
||||
return irq_alloc_descs(-1, 0, 1, node);
|
||||
}
|
||||
|
||||
static inline int irq_alloc_desc_at(unsigned int at, int node)
|
||||
{
|
||||
return irq_alloc_descs(at, at, 1, node);
|
||||
}
|
||||
|
||||
static inline int irq_alloc_desc_from(unsigned int from, int node)
|
||||
{
|
||||
return irq_alloc_descs(-1, from, 1, node);
|
||||
}
|
||||
|
||||
static inline void irq_free_desc(unsigned int irq)
|
||||
{
|
||||
irq_free_descs(irq, 1);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_GENERIC_HARDIRQS */
|
||||
|
||||
#endif /* !CONFIG_S390 */
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
/**
|
||||
* alloc_desc_masks - allocate cpumasks for irq_desc
|
||||
* @desc: pointer to irq_desc struct
|
||||
* @node: node which will be handling the cpumasks
|
||||
* @boot: true if need bootmem
|
||||
*
|
||||
* Allocates affinity and pending_mask cpumask if required.
|
||||
* Returns true if successful (or not required).
|
||||
*/
|
||||
static inline bool alloc_desc_masks(struct irq_desc *desc, int node,
|
||||
bool boot)
|
||||
{
|
||||
gfp_t gfp = GFP_ATOMIC;
|
||||
|
||||
if (boot)
|
||||
gfp = GFP_NOWAIT;
|
||||
|
||||
#ifdef CONFIG_CPUMASK_OFFSTACK
|
||||
if (!alloc_cpumask_var_node(&desc->affinity, gfp, node))
|
||||
return false;
|
||||
|
||||
#ifdef CONFIG_GENERIC_PENDING_IRQ
|
||||
if (!alloc_cpumask_var_node(&desc->pending_mask, gfp, node)) {
|
||||
free_cpumask_var(desc->affinity);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline void init_desc_masks(struct irq_desc *desc)
|
||||
{
|
||||
cpumask_setall(desc->affinity);
|
||||
#ifdef CONFIG_GENERIC_PENDING_IRQ
|
||||
cpumask_clear(desc->pending_mask);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* init_copy_desc_masks - copy cpumasks for irq_desc
|
||||
* @old_desc: pointer to old irq_desc struct
|
||||
* @new_desc: pointer to new irq_desc struct
|
||||
*
|
||||
* Insures affinity and pending_masks are copied to new irq_desc.
|
||||
* If !CONFIG_CPUMASKS_OFFSTACK the cpumasks are embedded in the
|
||||
* irq_desc struct so the copy is redundant.
|
||||
*/
|
||||
|
||||
static inline void init_copy_desc_masks(struct irq_desc *old_desc,
|
||||
struct irq_desc *new_desc)
|
||||
{
|
||||
#ifdef CONFIG_CPUMASK_OFFSTACK
|
||||
cpumask_copy(new_desc->affinity, old_desc->affinity);
|
||||
|
||||
#ifdef CONFIG_GENERIC_PENDING_IRQ
|
||||
cpumask_copy(new_desc->pending_mask, old_desc->pending_mask);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void free_desc_masks(struct irq_desc *old_desc,
|
||||
struct irq_desc *new_desc)
|
||||
{
|
||||
free_cpumask_var(old_desc->affinity);
|
||||
|
||||
#ifdef CONFIG_GENERIC_PENDING_IRQ
|
||||
free_cpumask_var(old_desc->pending_mask);
|
||||
#endif
|
||||
}
|
||||
|
||||
#else /* !CONFIG_SMP */
|
||||
|
||||
static inline bool alloc_desc_masks(struct irq_desc *desc, int node,
|
||||
bool boot)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline void init_desc_masks(struct irq_desc *desc)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void init_copy_desc_masks(struct irq_desc *old_desc,
|
||||
struct irq_desc *new_desc)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void free_desc_masks(struct irq_desc *old_desc,
|
||||
struct irq_desc *new_desc)
|
||||
{
|
||||
}
|
||||
#endif /* CONFIG_SMP */
|
||||
|
||||
#endif /* _LINUX_IRQ_H */
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef _LINUX_IRQ_WORK_H
|
||||
#define _LINUX_IRQ_WORK_H
|
||||
|
||||
struct irq_work {
|
||||
struct irq_work *next;
|
||||
void (*func)(struct irq_work *);
|
||||
};
|
||||
|
||||
static inline
|
||||
void init_irq_work(struct irq_work *entry, void (*func)(struct irq_work *))
|
||||
{
|
||||
entry->next = NULL;
|
||||
entry->func = func;
|
||||
}
|
||||
|
||||
bool irq_work_queue(struct irq_work *entry);
|
||||
void irq_work_run(void);
|
||||
void irq_work_sync(struct irq_work *entry);
|
||||
|
||||
#endif /* _LINUX_IRQ_WORK_H */
|
||||
@@ -0,0 +1,159 @@
|
||||
#ifndef _LINUX_IRQDESC_H
|
||||
#define _LINUX_IRQDESC_H
|
||||
|
||||
/*
|
||||
* Core internal functions to deal with irq descriptors
|
||||
*
|
||||
* This include will move to kernel/irq once we cleaned up the tree.
|
||||
* For now it's included from <linux/irq.h>
|
||||
*/
|
||||
|
||||
struct proc_dir_entry;
|
||||
struct timer_rand_state;
|
||||
/**
|
||||
* struct irq_desc - interrupt descriptor
|
||||
* @irq_data: per irq and chip data passed down to chip functions
|
||||
* @timer_rand_state: pointer to timer rand state struct
|
||||
* @kstat_irqs: irq stats per cpu
|
||||
* @handle_irq: highlevel irq-events handler [if NULL, __do_IRQ()]
|
||||
* @action: the irq action chain
|
||||
* @status: status information
|
||||
* @depth: disable-depth, for nested irq_disable() calls
|
||||
* @wake_depth: enable depth, for multiple set_irq_wake() callers
|
||||
* @irq_count: stats field to detect stalled irqs
|
||||
* @last_unhandled: aging timer for unhandled count
|
||||
* @irqs_unhandled: stats field for spurious unhandled interrupts
|
||||
* @lock: locking for SMP
|
||||
* @pending_mask: pending rebalanced interrupts
|
||||
* @threads_active: number of irqaction threads currently running
|
||||
* @wait_for_threads: wait queue for sync_irq to wait for threaded handlers
|
||||
* @dir: /proc/irq/ procfs entry
|
||||
* @name: flow handler name for /proc/interrupts output
|
||||
*/
|
||||
struct irq_desc {
|
||||
|
||||
#ifdef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
|
||||
struct irq_data irq_data;
|
||||
#else
|
||||
/*
|
||||
* This union will go away, once we fixed the direct access to
|
||||
* irq_desc all over the place. The direct fields are a 1:1
|
||||
* overlay of irq_data.
|
||||
*/
|
||||
union {
|
||||
struct irq_data irq_data;
|
||||
struct {
|
||||
unsigned int irq;
|
||||
unsigned int node;
|
||||
struct irq_chip *chip;
|
||||
void *handler_data;
|
||||
void *chip_data;
|
||||
struct msi_desc *msi_desc;
|
||||
#ifdef CONFIG_SMP
|
||||
cpumask_var_t affinity;
|
||||
#endif
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
||||
struct timer_rand_state *timer_rand_state;
|
||||
unsigned int *kstat_irqs;
|
||||
irq_flow_handler_t handle_irq;
|
||||
struct irqaction *action; /* IRQ action list */
|
||||
unsigned int status; /* IRQ status */
|
||||
|
||||
unsigned int depth; /* nested irq disables */
|
||||
unsigned int wake_depth; /* nested wake enables */
|
||||
unsigned int irq_count; /* For detecting broken IRQs */
|
||||
unsigned long last_unhandled; /* Aging timer for unhandled count */
|
||||
unsigned int irqs_unhandled;
|
||||
raw_spinlock_t lock;
|
||||
#ifdef CONFIG_SMP
|
||||
const struct cpumask *affinity_hint;
|
||||
#ifdef CONFIG_GENERIC_PENDING_IRQ
|
||||
cpumask_var_t pending_mask;
|
||||
#endif
|
||||
#endif
|
||||
atomic_t threads_active;
|
||||
wait_queue_head_t wait_for_threads;
|
||||
#ifdef CONFIG_PROC_FS
|
||||
struct proc_dir_entry *dir;
|
||||
#endif
|
||||
const char *name;
|
||||
} ____cacheline_internodealigned_in_smp;
|
||||
|
||||
#ifndef CONFIG_SPARSE_IRQ
|
||||
extern struct irq_desc irq_desc[NR_IRQS];
|
||||
#endif
|
||||
|
||||
/* Will be removed once the last users in power and sh are gone */
|
||||
extern struct irq_desc *irq_to_desc_alloc_node(unsigned int irq, int node);
|
||||
static inline struct irq_desc *move_irq_desc(struct irq_desc *desc, int node)
|
||||
{
|
||||
return desc;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_GENERIC_HARDIRQS
|
||||
|
||||
#define get_irq_desc_chip(desc) ((desc)->irq_data.chip)
|
||||
#define get_irq_desc_chip_data(desc) ((desc)->irq_data.chip_data)
|
||||
#define get_irq_desc_data(desc) ((desc)->irq_data.handler_data)
|
||||
#define get_irq_desc_msi(desc) ((desc)->irq_data.msi_desc)
|
||||
|
||||
/*
|
||||
* Monolithic do_IRQ implementation.
|
||||
*/
|
||||
#ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
|
||||
extern unsigned int __do_IRQ(unsigned int irq);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Architectures call this to let the generic IRQ layer
|
||||
* handle an interrupt. If the descriptor is attached to an
|
||||
* irqchip-style controller then we call the ->handle_irq() handler,
|
||||
* and it calls __do_IRQ() if it's attached to an irqtype-style controller.
|
||||
*/
|
||||
static inline void generic_handle_irq_desc(unsigned int irq, struct irq_desc *desc)
|
||||
{
|
||||
#ifdef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
|
||||
desc->handle_irq(irq, desc);
|
||||
#else
|
||||
if (likely(desc->handle_irq))
|
||||
desc->handle_irq(irq, desc);
|
||||
else
|
||||
__do_IRQ(irq);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void generic_handle_irq(unsigned int irq)
|
||||
{
|
||||
generic_handle_irq_desc(irq, irq_to_desc(irq));
|
||||
}
|
||||
|
||||
/* Test to see if a driver has successfully requested an irq */
|
||||
static inline int irq_has_action(unsigned int irq)
|
||||
{
|
||||
struct irq_desc *desc = irq_to_desc(irq);
|
||||
return desc->action != NULL;
|
||||
}
|
||||
|
||||
static inline int irq_balancing_disabled(unsigned int irq)
|
||||
{
|
||||
struct irq_desc *desc;
|
||||
|
||||
desc = irq_to_desc(irq);
|
||||
return desc->status & IRQ_NO_BALANCING_MASK;
|
||||
}
|
||||
|
||||
/* caller has locked the irq_desc and both params are valid */
|
||||
static inline void __set_irq_handler_unlocked(int irq,
|
||||
irq_flow_handler_t handler)
|
||||
{
|
||||
struct irq_desc *desc;
|
||||
|
||||
desc = irq_to_desc(irq);
|
||||
desc->handle_irq = handler;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+65
-44
@@ -12,6 +12,7 @@
|
||||
#define _LINUX_TRACE_IRQFLAGS_H
|
||||
|
||||
#include <linux/typecheck.h>
|
||||
#include <asm/irqflags.h>
|
||||
|
||||
#ifdef CONFIG_TRACE_IRQFLAGS
|
||||
extern void trace_softirqs_on(unsigned long ip);
|
||||
@@ -52,17 +53,45 @@
|
||||
# define start_critical_timings() do { } while (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Wrap the arch provided IRQ routines to provide appropriate checks.
|
||||
*/
|
||||
#define raw_local_irq_disable() arch_local_irq_disable()
|
||||
#define raw_local_irq_enable() arch_local_irq_enable()
|
||||
#define raw_local_irq_save(flags) \
|
||||
do { \
|
||||
typecheck(unsigned long, flags); \
|
||||
flags = arch_local_irq_save(); \
|
||||
} while (0)
|
||||
#define raw_local_irq_restore(flags) \
|
||||
do { \
|
||||
typecheck(unsigned long, flags); \
|
||||
arch_local_irq_restore(flags); \
|
||||
} while (0)
|
||||
#define raw_local_save_flags(flags) \
|
||||
do { \
|
||||
typecheck(unsigned long, flags); \
|
||||
flags = arch_local_save_flags(); \
|
||||
} while (0)
|
||||
#define raw_irqs_disabled_flags(flags) \
|
||||
({ \
|
||||
typecheck(unsigned long, flags); \
|
||||
arch_irqs_disabled_flags(flags); \
|
||||
})
|
||||
#define raw_irqs_disabled() (arch_irqs_disabled())
|
||||
#define raw_safe_halt() arch_safe_halt()
|
||||
|
||||
/*
|
||||
* The local_irq_*() APIs are equal to the raw_local_irq*()
|
||||
* if !TRACE_IRQFLAGS.
|
||||
*/
|
||||
#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
|
||||
|
||||
#include <asm/irqflags.h>
|
||||
|
||||
#define local_irq_enable() \
|
||||
do { trace_hardirqs_on(); raw_local_irq_enable(); } while (0)
|
||||
#define local_irq_disable() \
|
||||
do { raw_local_irq_disable(); trace_hardirqs_off(); } while (0)
|
||||
#define local_irq_save(flags) \
|
||||
do { \
|
||||
typecheck(unsigned long, flags); \
|
||||
raw_local_irq_save(flags); \
|
||||
trace_hardirqs_off(); \
|
||||
} while (0)
|
||||
@@ -70,7 +99,6 @@
|
||||
|
||||
#define local_irq_restore(flags) \
|
||||
do { \
|
||||
typecheck(unsigned long, flags); \
|
||||
if (raw_irqs_disabled_flags(flags)) { \
|
||||
raw_local_irq_restore(flags); \
|
||||
trace_hardirqs_off(); \
|
||||
@@ -79,51 +107,44 @@
|
||||
raw_local_irq_restore(flags); \
|
||||
} \
|
||||
} while (0)
|
||||
#else /* !CONFIG_TRACE_IRQFLAGS_SUPPORT */
|
||||
/*
|
||||
* The local_irq_*() APIs are equal to the raw_local_irq*()
|
||||
* if !TRACE_IRQFLAGS.
|
||||
*/
|
||||
# define raw_local_irq_disable() local_irq_disable()
|
||||
# define raw_local_irq_enable() local_irq_enable()
|
||||
# define raw_local_irq_save(flags) \
|
||||
do { \
|
||||
typecheck(unsigned long, flags); \
|
||||
local_irq_save(flags); \
|
||||
} while (0)
|
||||
# define raw_local_irq_restore(flags) \
|
||||
do { \
|
||||
typecheck(unsigned long, flags); \
|
||||
local_irq_restore(flags); \
|
||||
} while (0)
|
||||
#endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */
|
||||
|
||||
#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
|
||||
#define safe_halt() \
|
||||
do { \
|
||||
trace_hardirqs_on(); \
|
||||
raw_safe_halt(); \
|
||||
} while (0)
|
||||
|
||||
#define local_save_flags(flags) \
|
||||
do { \
|
||||
typecheck(unsigned long, flags); \
|
||||
raw_local_save_flags(flags); \
|
||||
} while (0)
|
||||
|
||||
#define irqs_disabled() \
|
||||
({ \
|
||||
unsigned long _flags; \
|
||||
\
|
||||
raw_local_save_flags(_flags); \
|
||||
raw_irqs_disabled_flags(_flags); \
|
||||
})
|
||||
#define irqs_disabled_flags(flags) \
|
||||
({ \
|
||||
raw_irqs_disabled_flags(flags); \
|
||||
})
|
||||
|
||||
#define irqs_disabled() \
|
||||
({ \
|
||||
unsigned long _flags; \
|
||||
raw_local_save_flags(_flags); \
|
||||
raw_irqs_disabled_flags(_flags); \
|
||||
})
|
||||
|
||||
#define safe_halt() \
|
||||
do { \
|
||||
trace_hardirqs_on(); \
|
||||
raw_safe_halt(); \
|
||||
} while (0)
|
||||
|
||||
|
||||
#else /* !CONFIG_TRACE_IRQFLAGS_SUPPORT */
|
||||
|
||||
#define local_irq_enable() do { raw_local_irq_enable(); } while (0)
|
||||
#define local_irq_disable() do { raw_local_irq_disable(); } while (0)
|
||||
#define local_irq_save(flags) \
|
||||
do { \
|
||||
raw_local_irq_save(flags); \
|
||||
} while (0)
|
||||
#define local_irq_restore(flags) do { raw_local_irq_restore(flags); } while (0)
|
||||
#define local_save_flags(flags) do { raw_local_save_flags(flags); } while (0)
|
||||
#define irqs_disabled() (raw_irqs_disabled())
|
||||
#define irqs_disabled_flags(flags) (raw_irqs_disabled_flags(flags))
|
||||
#define safe_halt() do { raw_safe_halt(); } while (0)
|
||||
|
||||
#define irqs_disabled_flags(flags) \
|
||||
({ \
|
||||
typecheck(unsigned long, flags); \
|
||||
raw_irqs_disabled_flags(flags); \
|
||||
})
|
||||
#endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
extern int nr_irqs;
|
||||
extern struct irq_desc *irq_to_desc(unsigned int irq);
|
||||
unsigned int irq_get_next_irq(unsigned int offset);
|
||||
|
||||
# define for_each_irq_desc(irq, desc) \
|
||||
for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; \
|
||||
@@ -47,6 +48,10 @@ extern struct irq_desc *irq_to_desc(unsigned int irq);
|
||||
#define irq_node(irq) 0
|
||||
#endif
|
||||
|
||||
# define for_each_active_irq(irq) \
|
||||
for (irq = irq_get_next_irq(0); irq < nr_irqs; \
|
||||
irq = irq_get_next_irq(irq + 1))
|
||||
|
||||
#endif /* CONFIG_GENERIC_HARDIRQS */
|
||||
|
||||
#define for_each_irq_nr(irq) \
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
#ifndef _LINUX_JUMP_LABEL_H
|
||||
#define _LINUX_JUMP_LABEL_H
|
||||
|
||||
#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_HAVE_ARCH_JUMP_LABEL)
|
||||
# include <asm/jump_label.h>
|
||||
# define HAVE_JUMP_LABEL
|
||||
#endif
|
||||
|
||||
enum jump_label_type {
|
||||
JUMP_LABEL_ENABLE,
|
||||
JUMP_LABEL_DISABLE
|
||||
};
|
||||
|
||||
struct module;
|
||||
|
||||
#ifdef HAVE_JUMP_LABEL
|
||||
|
||||
extern struct jump_entry __start___jump_table[];
|
||||
extern struct jump_entry __stop___jump_table[];
|
||||
|
||||
extern void arch_jump_label_transform(struct jump_entry *entry,
|
||||
enum jump_label_type type);
|
||||
extern void arch_jump_label_text_poke_early(jump_label_t addr);
|
||||
extern void jump_label_update(unsigned long key, enum jump_label_type type);
|
||||
extern void jump_label_apply_nops(struct module *mod);
|
||||
extern int jump_label_text_reserved(void *start, void *end);
|
||||
|
||||
#define jump_label_enable(key) \
|
||||
jump_label_update((unsigned long)key, JUMP_LABEL_ENABLE);
|
||||
|
||||
#define jump_label_disable(key) \
|
||||
jump_label_update((unsigned long)key, JUMP_LABEL_DISABLE);
|
||||
|
||||
#else
|
||||
|
||||
#define JUMP_LABEL(key, label) \
|
||||
do { \
|
||||
if (unlikely(*key)) \
|
||||
goto label; \
|
||||
} while (0)
|
||||
|
||||
#define jump_label_enable(cond_var) \
|
||||
do { \
|
||||
*(cond_var) = 1; \
|
||||
} while (0)
|
||||
|
||||
#define jump_label_disable(cond_var) \
|
||||
do { \
|
||||
*(cond_var) = 0; \
|
||||
} while (0)
|
||||
|
||||
static inline int jump_label_apply_nops(struct module *mod)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int jump_label_text_reserved(void *start, void *end)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#define COND_STMT(key, stmt) \
|
||||
do { \
|
||||
__label__ jl_enabled; \
|
||||
JUMP_LABEL(key, jl_enabled); \
|
||||
if (0) { \
|
||||
jl_enabled: \
|
||||
stmt; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,44 @@
|
||||
#ifndef _LINUX_JUMP_LABEL_REF_H
|
||||
#define _LINUX_JUMP_LABEL_REF_H
|
||||
|
||||
#include <linux/jump_label.h>
|
||||
#include <asm/atomic.h>
|
||||
|
||||
#ifdef HAVE_JUMP_LABEL
|
||||
|
||||
static inline void jump_label_inc(atomic_t *key)
|
||||
{
|
||||
if (atomic_add_return(1, key) == 1)
|
||||
jump_label_enable(key);
|
||||
}
|
||||
|
||||
static inline void jump_label_dec(atomic_t *key)
|
||||
{
|
||||
if (atomic_dec_and_test(key))
|
||||
jump_label_disable(key);
|
||||
}
|
||||
|
||||
#else /* !HAVE_JUMP_LABEL */
|
||||
|
||||
static inline void jump_label_inc(atomic_t *key)
|
||||
{
|
||||
atomic_inc(key);
|
||||
}
|
||||
|
||||
static inline void jump_label_dec(atomic_t *key)
|
||||
{
|
||||
atomic_dec(key);
|
||||
}
|
||||
|
||||
#undef JUMP_LABEL
|
||||
#define JUMP_LABEL(key, label) \
|
||||
do { \
|
||||
if (unlikely(__builtin_choose_expr( \
|
||||
__builtin_types_compatible_p(typeof(key), atomic_t *), \
|
||||
atomic_read((atomic_t *)(key)), *(key)))) \
|
||||
goto label; \
|
||||
} while (0)
|
||||
|
||||
#endif /* HAVE_JUMP_LABEL */
|
||||
|
||||
#endif /* _LINUX_JUMP_LABEL_REF_H */
|
||||
@@ -28,6 +28,41 @@ extern int kdb_poll_idx;
|
||||
extern int kdb_initial_cpu;
|
||||
extern atomic_t kdb_event;
|
||||
|
||||
/* Types and messages used for dynamically added kdb shell commands */
|
||||
|
||||
#define KDB_MAXARGS 16 /* Maximum number of arguments to a function */
|
||||
|
||||
typedef enum {
|
||||
KDB_REPEAT_NONE = 0, /* Do not repeat this command */
|
||||
KDB_REPEAT_NO_ARGS, /* Repeat the command without arguments */
|
||||
KDB_REPEAT_WITH_ARGS, /* Repeat the command including its arguments */
|
||||
} kdb_repeat_t;
|
||||
|
||||
typedef int (*kdb_func_t)(int, const char **);
|
||||
|
||||
/* KDB return codes from a command or internal kdb function */
|
||||
#define KDB_NOTFOUND (-1)
|
||||
#define KDB_ARGCOUNT (-2)
|
||||
#define KDB_BADWIDTH (-3)
|
||||
#define KDB_BADRADIX (-4)
|
||||
#define KDB_NOTENV (-5)
|
||||
#define KDB_NOENVVALUE (-6)
|
||||
#define KDB_NOTIMP (-7)
|
||||
#define KDB_ENVFULL (-8)
|
||||
#define KDB_ENVBUFFULL (-9)
|
||||
#define KDB_TOOMANYBPT (-10)
|
||||
#define KDB_TOOMANYDBREGS (-11)
|
||||
#define KDB_DUPBPT (-12)
|
||||
#define KDB_BPTNOTFOUND (-13)
|
||||
#define KDB_BADMODE (-14)
|
||||
#define KDB_BADINT (-15)
|
||||
#define KDB_INVADDRFMT (-16)
|
||||
#define KDB_BADREG (-17)
|
||||
#define KDB_BADCPUNUM (-18)
|
||||
#define KDB_BADLENGTH (-19)
|
||||
#define KDB_NOBP (-20)
|
||||
#define KDB_BADADDR (-21)
|
||||
|
||||
/*
|
||||
* kdb_diemsg
|
||||
*
|
||||
@@ -104,10 +139,26 @@ int kdb_process_cpu(const struct task_struct *p)
|
||||
|
||||
/* kdb access to register set for stack dumping */
|
||||
extern struct pt_regs *kdb_current_regs;
|
||||
#ifdef CONFIG_KALLSYMS
|
||||
extern const char *kdb_walk_kallsyms(loff_t *pos);
|
||||
#else /* ! CONFIG_KALLSYMS */
|
||||
static inline const char *kdb_walk_kallsyms(loff_t *pos)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif /* ! CONFIG_KALLSYMS */
|
||||
|
||||
/* Dynamic kdb shell command registration */
|
||||
extern int kdb_register(char *, kdb_func_t, char *, char *, short);
|
||||
extern int kdb_register_repeat(char *, kdb_func_t, char *, char *,
|
||||
short, kdb_repeat_t);
|
||||
extern int kdb_unregister(char *);
|
||||
#else /* ! CONFIG_KGDB_KDB */
|
||||
#define kdb_printf(...)
|
||||
#define kdb_init(x)
|
||||
#define kdb_register(...)
|
||||
#define kdb_register_repeat(...)
|
||||
#define kdb_uregister(x)
|
||||
#endif /* CONFIG_KGDB_KDB */
|
||||
enum {
|
||||
KDB_NOT_INITIALIZED,
|
||||
|
||||
+22
-1
@@ -58,7 +58,18 @@ extern const char linux_proc_banner[];
|
||||
|
||||
#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
|
||||
#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
|
||||
#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
|
||||
#define roundup(x, y) ( \
|
||||
{ \
|
||||
typeof(y) __y = y; \
|
||||
(((x) + (__y - 1)) / __y) * __y; \
|
||||
} \
|
||||
)
|
||||
#define rounddown(x, y) ( \
|
||||
{ \
|
||||
typeof(x) __x = (x); \
|
||||
__x - (__x % (y)); \
|
||||
} \
|
||||
)
|
||||
#define DIV_ROUND_CLOSEST(x, divisor)( \
|
||||
{ \
|
||||
typeof(divisor) __divisor = divisor; \
|
||||
@@ -640,6 +651,16 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
|
||||
(void) (&_max1 == &_max2); \
|
||||
_max1 > _max2 ? _max1 : _max2; })
|
||||
|
||||
/**
|
||||
* min_not_zero - return the minimum that is _not_ zero, unless both are zero
|
||||
* @x: value1
|
||||
* @y: value2
|
||||
*/
|
||||
#define min_not_zero(x, y) ({ \
|
||||
typeof(x) __x = (x); \
|
||||
typeof(y) __y = (y); \
|
||||
__x == 0 ? __y : ((__y == 0) ? __x : min(__x, __y)); })
|
||||
|
||||
/**
|
||||
* clamp - return a value clamped to a given range with strict typechecking
|
||||
* @val: current value
|
||||
|
||||
+2
-1
@@ -178,8 +178,9 @@ struct key {
|
||||
*/
|
||||
union {
|
||||
unsigned long value;
|
||||
void __rcu *rcudata;
|
||||
void *data;
|
||||
struct keyring_list *subscriptions;
|
||||
struct keyring_list __rcu *subscriptions;
|
||||
} payload;
|
||||
};
|
||||
|
||||
|
||||
@@ -191,6 +191,8 @@ static inline struct kobj_type *get_ktype(struct kobject *kobj)
|
||||
}
|
||||
|
||||
extern struct kobject *kset_find_obj(struct kset *, const char *);
|
||||
extern struct kobject *kset_find_obj_hinted(struct kset *, const char *,
|
||||
struct kobject *);
|
||||
|
||||
/* The global /sys/kernel/ kobject for people to chain off of */
|
||||
extern struct kobject *kernel_kobj;
|
||||
|
||||
@@ -205,7 +205,7 @@ struct kvm {
|
||||
|
||||
struct mutex irq_lock;
|
||||
#ifdef CONFIG_HAVE_KVM_IRQCHIP
|
||||
struct kvm_irq_routing_table *irq_routing;
|
||||
struct kvm_irq_routing_table __rcu *irq_routing;
|
||||
struct hlist_head mask_notifier_list;
|
||||
struct hlist_head irq_ack_notifier_list;
|
||||
#endif
|
||||
|
||||
+42
-23
@@ -37,6 +37,7 @@
|
||||
#include <scsi/scsi_host.h>
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/cdrom.h>
|
||||
#include <linux/sched.h>
|
||||
|
||||
/*
|
||||
* Define if arch has non-standard setup. This is a _PCI_ standard
|
||||
@@ -172,6 +173,7 @@ enum {
|
||||
ATA_LFLAG_NO_RETRY = (1 << 5), /* don't retry this link */
|
||||
ATA_LFLAG_DISABLED = (1 << 6), /* link is disabled */
|
||||
ATA_LFLAG_SW_ACTIVITY = (1 << 7), /* keep activity stats */
|
||||
ATA_LFLAG_NO_LPM = (1 << 8), /* disable LPM on this link */
|
||||
|
||||
/* struct ata_port flags */
|
||||
ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */
|
||||
@@ -196,7 +198,7 @@ enum {
|
||||
ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */
|
||||
ATA_FLAG_AN = (1 << 18), /* controller supports AN */
|
||||
ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */
|
||||
ATA_FLAG_IPM = (1 << 20), /* driver can handle IPM */
|
||||
ATA_FLAG_LPM = (1 << 20), /* driver can handle LPM */
|
||||
ATA_FLAG_EM = (1 << 21), /* driver supports enclosure
|
||||
* management */
|
||||
ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity
|
||||
@@ -324,12 +326,11 @@ enum {
|
||||
ATA_EH_HARDRESET = (1 << 2), /* meaningful only in ->prereset */
|
||||
ATA_EH_RESET = ATA_EH_SOFTRESET | ATA_EH_HARDRESET,
|
||||
ATA_EH_ENABLE_LINK = (1 << 3),
|
||||
ATA_EH_LPM = (1 << 4), /* link power management action */
|
||||
ATA_EH_PARK = (1 << 5), /* unload heads and stop I/O */
|
||||
|
||||
ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE | ATA_EH_PARK,
|
||||
ATA_EH_ALL_ACTIONS = ATA_EH_REVALIDATE | ATA_EH_RESET |
|
||||
ATA_EH_ENABLE_LINK | ATA_EH_LPM,
|
||||
ATA_EH_ENABLE_LINK,
|
||||
|
||||
/* ata_eh_info->flags */
|
||||
ATA_EHI_HOTPLUGGED = (1 << 0), /* could have been hotplugged */
|
||||
@@ -341,7 +342,7 @@ enum {
|
||||
ATA_EHI_DID_HARDRESET = (1 << 17), /* already soft-reset this port */
|
||||
ATA_EHI_PRINTINFO = (1 << 18), /* print configuration info */
|
||||
ATA_EHI_SETMODE = (1 << 19), /* configure transfer mode */
|
||||
ATA_EHI_POST_SETMODE = (1 << 20), /* revaildating after setmode */
|
||||
ATA_EHI_POST_SETMODE = (1 << 20), /* revalidating after setmode */
|
||||
|
||||
ATA_EHI_DID_RESET = ATA_EHI_DID_SOFTRESET | ATA_EHI_DID_HARDRESET,
|
||||
|
||||
@@ -377,7 +378,6 @@ enum {
|
||||
ATA_HORKAGE_BROKEN_HPA = (1 << 4), /* Broken HPA */
|
||||
ATA_HORKAGE_DISABLE = (1 << 5), /* Disable it */
|
||||
ATA_HORKAGE_HPA_SIZE = (1 << 6), /* native size off by one */
|
||||
ATA_HORKAGE_IPM = (1 << 7), /* Link PM problems */
|
||||
ATA_HORKAGE_IVB = (1 << 8), /* cbl det validity bit bugs */
|
||||
ATA_HORKAGE_STUCK_ERR = (1 << 9), /* stuck ERR on next PACKET */
|
||||
ATA_HORKAGE_BRIDGE_OK = (1 << 10), /* no bridge limits */
|
||||
@@ -464,6 +464,22 @@ enum ata_completion_errors {
|
||||
AC_ERR_NCQ = (1 << 10), /* marker for offending NCQ qc */
|
||||
};
|
||||
|
||||
/*
|
||||
* Link power management policy: If you alter this, you also need to
|
||||
* alter libata-scsi.c (for the ascii descriptions)
|
||||
*/
|
||||
enum ata_lpm_policy {
|
||||
ATA_LPM_UNKNOWN,
|
||||
ATA_LPM_MAX_POWER,
|
||||
ATA_LPM_MED_POWER,
|
||||
ATA_LPM_MIN_POWER,
|
||||
};
|
||||
|
||||
enum ata_lpm_hints {
|
||||
ATA_LPM_EMPTY = (1 << 0), /* port empty/probing */
|
||||
ATA_LPM_HIPM = (1 << 1), /* may use HIPM */
|
||||
};
|
||||
|
||||
/* forward declarations */
|
||||
struct scsi_device;
|
||||
struct ata_port_operations;
|
||||
@@ -478,16 +494,6 @@ typedef int (*ata_reset_fn_t)(struct ata_link *link, unsigned int *classes,
|
||||
unsigned long deadline);
|
||||
typedef void (*ata_postreset_fn_t)(struct ata_link *link, unsigned int *classes);
|
||||
|
||||
/*
|
||||
* host pm policy: If you alter this, you also need to alter libata-scsi.c
|
||||
* (for the ascii descriptions)
|
||||
*/
|
||||
enum link_pm {
|
||||
NOT_AVAILABLE,
|
||||
MIN_POWER,
|
||||
MAX_PERFORMANCE,
|
||||
MEDIUM_POWER,
|
||||
};
|
||||
extern struct device_attribute dev_attr_link_power_management_policy;
|
||||
extern struct device_attribute dev_attr_unload_heads;
|
||||
extern struct device_attribute dev_attr_em_message_type;
|
||||
@@ -530,6 +536,10 @@ struct ata_host {
|
||||
void *private_data;
|
||||
struct ata_port_operations *ops;
|
||||
unsigned long flags;
|
||||
|
||||
struct mutex eh_mutex;
|
||||
struct task_struct *eh_owner;
|
||||
|
||||
#ifdef CONFIG_ATA_ACPI
|
||||
acpi_handle acpi_handle;
|
||||
#endif
|
||||
@@ -560,13 +570,13 @@ struct ata_queued_cmd {
|
||||
unsigned int extrabytes;
|
||||
unsigned int curbytes;
|
||||
|
||||
struct scatterlist *cursg;
|
||||
unsigned int cursg_ofs;
|
||||
|
||||
struct scatterlist sgent;
|
||||
|
||||
struct scatterlist *sg;
|
||||
|
||||
struct scatterlist *cursg;
|
||||
unsigned int cursg_ofs;
|
||||
|
||||
unsigned int err_mask;
|
||||
struct ata_taskfile result_tf;
|
||||
ata_qc_cb_t complete_fn;
|
||||
@@ -604,6 +614,7 @@ struct ata_device {
|
||||
union acpi_object *gtf_cache;
|
||||
unsigned int gtf_filter;
|
||||
#endif
|
||||
struct device tdev;
|
||||
/* n_sector is CLEAR_BEGIN, read comment above CLEAR_BEGIN */
|
||||
u64 n_sectors; /* size of device, if ATA */
|
||||
u64 n_native_sectors; /* native size, if ATA */
|
||||
@@ -690,6 +701,7 @@ struct ata_link {
|
||||
struct ata_port *ap;
|
||||
int pmp; /* port multiplier port # */
|
||||
|
||||
struct device tdev;
|
||||
unsigned int active_tag; /* active tag on this link */
|
||||
u32 sactive; /* active NCQ commands */
|
||||
|
||||
@@ -699,6 +711,7 @@ struct ata_link {
|
||||
unsigned int hw_sata_spd_limit;
|
||||
unsigned int sata_spd_limit;
|
||||
unsigned int sata_spd; /* current SATA PHY speed */
|
||||
enum ata_lpm_policy lpm_policy;
|
||||
|
||||
/* record runtime error info, protected by host_set lock */
|
||||
struct ata_eh_info eh_info;
|
||||
@@ -707,6 +720,8 @@ struct ata_link {
|
||||
|
||||
struct ata_device device[ATA_MAX_DEVICES];
|
||||
};
|
||||
#define ATA_LINK_CLEAR_BEGIN offsetof(struct ata_link, active_tag)
|
||||
#define ATA_LINK_CLEAR_END offsetof(struct ata_link, device[0])
|
||||
|
||||
struct ata_port {
|
||||
struct Scsi_Host *scsi_host; /* our co-allocated scsi host */
|
||||
@@ -752,6 +767,7 @@ struct ata_port {
|
||||
struct ata_port_stats stats;
|
||||
struct ata_host *host;
|
||||
struct device *dev;
|
||||
struct device tdev;
|
||||
|
||||
struct mutex scsi_scan_mutex;
|
||||
struct delayed_work hotplug_task;
|
||||
@@ -767,7 +783,7 @@ struct ata_port {
|
||||
|
||||
pm_message_t pm_mesg;
|
||||
int *pm_result;
|
||||
enum link_pm pm_policy;
|
||||
enum ata_lpm_policy target_lpm_policy;
|
||||
|
||||
struct timer_list fastdrain_timer;
|
||||
unsigned long fastdrain_cnt;
|
||||
@@ -833,8 +849,8 @@ struct ata_port_operations {
|
||||
int (*scr_write)(struct ata_link *link, unsigned int sc_reg, u32 val);
|
||||
void (*pmp_attach)(struct ata_port *ap);
|
||||
void (*pmp_detach)(struct ata_port *ap);
|
||||
int (*enable_pm)(struct ata_port *ap, enum link_pm policy);
|
||||
void (*disable_pm)(struct ata_port *ap);
|
||||
int (*set_lpm)(struct ata_link *link, enum ata_lpm_policy policy,
|
||||
unsigned hints);
|
||||
|
||||
/*
|
||||
* Start, stop, suspend and resume
|
||||
@@ -946,6 +962,8 @@ extern int sata_link_debounce(struct ata_link *link,
|
||||
const unsigned long *params, unsigned long deadline);
|
||||
extern int sata_link_resume(struct ata_link *link, const unsigned long *params,
|
||||
unsigned long deadline);
|
||||
extern int sata_link_scr_lpm(struct ata_link *link, enum ata_lpm_policy policy,
|
||||
bool spm_wakeup);
|
||||
extern int sata_link_hardreset(struct ata_link *link,
|
||||
const unsigned long *timing, unsigned long deadline,
|
||||
bool *online, int (*check_ready)(struct ata_link *));
|
||||
@@ -991,8 +1009,9 @@ extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg);
|
||||
extern void ata_host_resume(struct ata_host *host);
|
||||
#endif
|
||||
extern int ata_ratelimit(void);
|
||||
extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,
|
||||
unsigned long interval, unsigned long timeout);
|
||||
extern void ata_msleep(struct ata_port *ap, unsigned int msecs);
|
||||
extern u32 ata_wait_register(struct ata_port *ap, void __iomem *reg, u32 mask,
|
||||
u32 val, unsigned long interval, unsigned long timeout);
|
||||
extern int atapi_cmd_type(u8 opcode);
|
||||
extern void ata_tf_to_fis(const struct ata_taskfile *tf,
|
||||
u8 pmp, int is_cmd, u8 *fis);
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include <linux/stddef.h>
|
||||
#include <linux/poison.h>
|
||||
#include <linux/prefetch.h>
|
||||
#include <asm/system.h>
|
||||
|
||||
/*
|
||||
* Simple doubly linked list implementation.
|
||||
|
||||
+12
-9
@@ -31,6 +31,17 @@ extern int lock_stat;
|
||||
|
||||
#define MAX_LOCKDEP_SUBCLASSES 8UL
|
||||
|
||||
/*
|
||||
* NR_LOCKDEP_CACHING_CLASSES ... Number of classes
|
||||
* cached in the instance of lockdep_map
|
||||
*
|
||||
* Currently main class (subclass == 0) and signle depth subclass
|
||||
* are cached in lockdep_map. This optimization is mainly targeting
|
||||
* on rq->lock. double_rq_lock() acquires this highly competitive with
|
||||
* single depth.
|
||||
*/
|
||||
#define NR_LOCKDEP_CACHING_CLASSES 2
|
||||
|
||||
/*
|
||||
* Lock-classes are keyed via unique addresses, by embedding the
|
||||
* lockclass-key into the kernel (or module) .data section. (For
|
||||
@@ -138,7 +149,7 @@ void clear_lock_stats(struct lock_class *class);
|
||||
*/
|
||||
struct lockdep_map {
|
||||
struct lock_class_key *key;
|
||||
struct lock_class *class_cache;
|
||||
struct lock_class *class_cache[NR_LOCKDEP_CACHING_CLASSES];
|
||||
const char *name;
|
||||
#ifdef CONFIG_LOCK_STAT
|
||||
int cpu;
|
||||
@@ -424,14 +435,6 @@ do { \
|
||||
|
||||
#endif /* CONFIG_LOCKDEP */
|
||||
|
||||
#ifdef CONFIG_GENERIC_HARDIRQS
|
||||
extern void early_init_irq_lock_class(void);
|
||||
#else
|
||||
static inline void early_init_irq_lock_class(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_TRACE_IRQFLAGS
|
||||
extern void early_boot_irqs_off(void);
|
||||
extern void early_boot_irqs_on(void);
|
||||
|
||||
+129
-51
@@ -2,6 +2,7 @@
|
||||
#define _LINUX_MEMBLOCK_H
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#ifdef CONFIG_HAVE_MEMBLOCK
|
||||
/*
|
||||
* Logical memory blocks.
|
||||
*
|
||||
@@ -16,73 +17,150 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/mm.h>
|
||||
|
||||
#define MAX_MEMBLOCK_REGIONS 128
|
||||
#include <asm/memblock.h>
|
||||
|
||||
struct memblock_property {
|
||||
u64 base;
|
||||
u64 size;
|
||||
};
|
||||
#define INIT_MEMBLOCK_REGIONS 128
|
||||
#define MEMBLOCK_ERROR 0
|
||||
|
||||
struct memblock_region {
|
||||
unsigned long cnt;
|
||||
u64 size;
|
||||
struct memblock_property region[MAX_MEMBLOCK_REGIONS+1];
|
||||
phys_addr_t base;
|
||||
phys_addr_t size;
|
||||
};
|
||||
|
||||
struct memblock_type {
|
||||
unsigned long cnt; /* number of regions */
|
||||
unsigned long max; /* size of the allocated array */
|
||||
struct memblock_region *regions;
|
||||
};
|
||||
|
||||
struct memblock {
|
||||
unsigned long debug;
|
||||
u64 rmo_size;
|
||||
struct memblock_region memory;
|
||||
struct memblock_region reserved;
|
||||
phys_addr_t current_limit;
|
||||
phys_addr_t memory_size; /* Updated by memblock_analyze() */
|
||||
struct memblock_type memory;
|
||||
struct memblock_type reserved;
|
||||
};
|
||||
|
||||
extern struct memblock memblock;
|
||||
extern int memblock_debug;
|
||||
extern int memblock_can_resize;
|
||||
|
||||
extern void __init memblock_init(void);
|
||||
extern void __init memblock_analyze(void);
|
||||
extern long memblock_add(u64 base, u64 size);
|
||||
extern long memblock_remove(u64 base, u64 size);
|
||||
extern long __init memblock_free(u64 base, u64 size);
|
||||
extern long __init memblock_reserve(u64 base, u64 size);
|
||||
extern u64 __init memblock_alloc_nid(u64 size, u64 align, int nid,
|
||||
u64 (*nid_range)(u64, u64, int *));
|
||||
extern u64 __init memblock_alloc(u64 size, u64 align);
|
||||
extern u64 __init memblock_alloc_base(u64 size,
|
||||
u64, u64 max_addr);
|
||||
extern u64 __init __memblock_alloc_base(u64 size,
|
||||
u64 align, u64 max_addr);
|
||||
extern u64 __init memblock_phys_mem_size(void);
|
||||
extern u64 memblock_end_of_DRAM(void);
|
||||
extern void __init memblock_enforce_memory_limit(u64 memory_limit);
|
||||
extern int __init memblock_is_reserved(u64 addr);
|
||||
extern int memblock_is_region_reserved(u64 base, u64 size);
|
||||
extern int memblock_find(struct memblock_property *res);
|
||||
#define memblock_dbg(fmt, ...) \
|
||||
if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
|
||||
|
||||
u64 memblock_find_in_range(u64 start, u64 end, u64 size, u64 align);
|
||||
int memblock_free_reserved_regions(void);
|
||||
int memblock_reserve_reserved_regions(void);
|
||||
|
||||
extern void memblock_init(void);
|
||||
extern void memblock_analyze(void);
|
||||
extern long memblock_add(phys_addr_t base, phys_addr_t size);
|
||||
extern long memblock_remove(phys_addr_t base, phys_addr_t size);
|
||||
extern long memblock_free(phys_addr_t base, phys_addr_t size);
|
||||
extern long memblock_reserve(phys_addr_t base, phys_addr_t size);
|
||||
|
||||
/* The numa aware allocator is only available if
|
||||
* CONFIG_ARCH_POPULATES_NODE_MAP is set
|
||||
*/
|
||||
extern phys_addr_t memblock_alloc_nid(phys_addr_t size, phys_addr_t align,
|
||||
int nid);
|
||||
extern phys_addr_t memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align,
|
||||
int nid);
|
||||
|
||||
extern phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align);
|
||||
|
||||
/* Flags for memblock_alloc_base() amd __memblock_alloc_base() */
|
||||
#define MEMBLOCK_ALLOC_ANYWHERE (~(phys_addr_t)0)
|
||||
#define MEMBLOCK_ALLOC_ACCESSIBLE 0
|
||||
|
||||
extern phys_addr_t memblock_alloc_base(phys_addr_t size,
|
||||
phys_addr_t align,
|
||||
phys_addr_t max_addr);
|
||||
extern phys_addr_t __memblock_alloc_base(phys_addr_t size,
|
||||
phys_addr_t align,
|
||||
phys_addr_t max_addr);
|
||||
extern phys_addr_t memblock_phys_mem_size(void);
|
||||
extern phys_addr_t memblock_end_of_DRAM(void);
|
||||
extern void memblock_enforce_memory_limit(phys_addr_t memory_limit);
|
||||
extern int memblock_is_memory(phys_addr_t addr);
|
||||
extern int memblock_is_region_memory(phys_addr_t base, phys_addr_t size);
|
||||
extern int memblock_is_reserved(phys_addr_t addr);
|
||||
extern int memblock_is_region_reserved(phys_addr_t base, phys_addr_t size);
|
||||
|
||||
extern void memblock_dump_all(void);
|
||||
|
||||
static inline u64
|
||||
memblock_size_bytes(struct memblock_region *type, unsigned long region_nr)
|
||||
/* Provided by the architecture */
|
||||
extern phys_addr_t memblock_nid_range(phys_addr_t start, phys_addr_t end, int *nid);
|
||||
extern int memblock_memory_can_coalesce(phys_addr_t addr1, phys_addr_t size1,
|
||||
phys_addr_t addr2, phys_addr_t size2);
|
||||
|
||||
/**
|
||||
* memblock_set_current_limit - Set the current allocation limit to allow
|
||||
* limiting allocations to what is currently
|
||||
* accessible during boot
|
||||
* @limit: New limit value (physical address)
|
||||
*/
|
||||
extern void memblock_set_current_limit(phys_addr_t limit);
|
||||
|
||||
|
||||
/*
|
||||
* pfn conversion functions
|
||||
*
|
||||
* While the memory MEMBLOCKs should always be page aligned, the reserved
|
||||
* MEMBLOCKs may not be. This accessor attempt to provide a very clear
|
||||
* idea of what they return for such non aligned MEMBLOCKs.
|
||||
*/
|
||||
|
||||
/**
|
||||
* memblock_region_memory_base_pfn - Return the lowest pfn intersecting with the memory region
|
||||
* @reg: memblock_region structure
|
||||
*/
|
||||
static inline unsigned long memblock_region_memory_base_pfn(const struct memblock_region *reg)
|
||||
{
|
||||
return type->region[region_nr].size;
|
||||
}
|
||||
static inline u64
|
||||
memblock_size_pages(struct memblock_region *type, unsigned long region_nr)
|
||||
{
|
||||
return memblock_size_bytes(type, region_nr) >> PAGE_SHIFT;
|
||||
}
|
||||
static inline u64
|
||||
memblock_start_pfn(struct memblock_region *type, unsigned long region_nr)
|
||||
{
|
||||
return type->region[region_nr].base >> PAGE_SHIFT;
|
||||
}
|
||||
static inline u64
|
||||
memblock_end_pfn(struct memblock_region *type, unsigned long region_nr)
|
||||
{
|
||||
return memblock_start_pfn(type, region_nr) +
|
||||
memblock_size_pages(type, region_nr);
|
||||
return PFN_UP(reg->base);
|
||||
}
|
||||
|
||||
#include <asm/memblock.h>
|
||||
/**
|
||||
* memblock_region_memory_end_pfn - Return the end_pfn this region
|
||||
* @reg: memblock_region structure
|
||||
*/
|
||||
static inline unsigned long memblock_region_memory_end_pfn(const struct memblock_region *reg)
|
||||
{
|
||||
return PFN_DOWN(reg->base + reg->size);
|
||||
}
|
||||
|
||||
/**
|
||||
* memblock_region_reserved_base_pfn - Return the lowest pfn intersecting with the reserved region
|
||||
* @reg: memblock_region structure
|
||||
*/
|
||||
static inline unsigned long memblock_region_reserved_base_pfn(const struct memblock_region *reg)
|
||||
{
|
||||
return PFN_DOWN(reg->base);
|
||||
}
|
||||
|
||||
/**
|
||||
* memblock_region_reserved_end_pfn - Return the end_pfn this region
|
||||
* @reg: memblock_region structure
|
||||
*/
|
||||
static inline unsigned long memblock_region_reserved_end_pfn(const struct memblock_region *reg)
|
||||
{
|
||||
return PFN_UP(reg->base + reg->size);
|
||||
}
|
||||
|
||||
#define for_each_memblock(memblock_type, region) \
|
||||
for (region = memblock.memblock_type.regions; \
|
||||
region < (memblock.memblock_type.regions + memblock.memblock_type.cnt); \
|
||||
region++)
|
||||
|
||||
|
||||
#ifdef ARCH_DISCARD_MEMBLOCK
|
||||
#define __init_memblock __init
|
||||
#define __initdata_memblock __initdata
|
||||
#else
|
||||
#define __init_memblock
|
||||
#define __initdata_memblock
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_HAVE_MEMBLOCK */
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
struct memory_block {
|
||||
unsigned long phys_index;
|
||||
unsigned long state;
|
||||
int section_count;
|
||||
|
||||
/*
|
||||
* This serializes all state change requests. It isn't
|
||||
* held during creation because the control files are
|
||||
@@ -113,6 +115,8 @@ extern int memory_dev_init(void);
|
||||
extern int remove_memory_block(unsigned long, struct mem_section *, int);
|
||||
extern int memory_notify(unsigned long val, void *v);
|
||||
extern int memory_isolate_notify(unsigned long val, void *v);
|
||||
extern struct memory_block *find_memory_block_hinted(struct mem_section *,
|
||||
struct memory_block *);
|
||||
extern struct memory_block *find_memory_block(struct mem_section *);
|
||||
#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT)
|
||||
enum mem_add_context { BOOT, HOTPLUG };
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user