diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/ext3_fs.h | 35 | ||||
-rw-r--r-- | include/linux/ext3_fs_i.h | 2 | ||||
-rw-r--r-- | include/linux/fs.h | 2 | ||||
-rw-r--r-- | include/linux/jbd.h | 11 | ||||
-rw-r--r-- | include/linux/jbd2.h | 22 | ||||
-rw-r--r-- | include/linux/kprobes.h | 44 | ||||
-rw-r--r-- | include/linux/kvm.h | 10 | ||||
-rw-r--r-- | include/linux/kvm_host.h | 71 | ||||
-rw-r--r-- | include/linux/quota.h | 33 | ||||
-rw-r--r-- | include/linux/quotaops.h | 304 | ||||
-rw-r--r-- | include/linux/reiserfs_fs.h | 2 |
11 files changed, 227 insertions, 309 deletions
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h index 6b049030fbe6..cac84b006667 100644 --- a/include/linux/ext3_fs.h +++ b/include/linux/ext3_fs.h | |||
@@ -202,14 +202,6 @@ static inline __u32 ext3_mask_flags(umode_t mode, __u32 flags) | |||
202 | return flags & EXT3_OTHER_FLMASK; | 202 | return flags & EXT3_OTHER_FLMASK; |
203 | } | 203 | } |
204 | 204 | ||
205 | /* | ||
206 | * Inode dynamic state flags | ||
207 | */ | ||
208 | #define EXT3_STATE_JDATA 0x00000001 /* journaled data exists */ | ||
209 | #define EXT3_STATE_NEW 0x00000002 /* inode is newly created */ | ||
210 | #define EXT3_STATE_XATTR 0x00000004 /* has in-inode xattrs */ | ||
211 | #define EXT3_STATE_FLUSH_ON_CLOSE 0x00000008 | ||
212 | |||
213 | /* Used to pass group descriptor data when online resize is done */ | 205 | /* Used to pass group descriptor data when online resize is done */ |
214 | struct ext3_new_group_input { | 206 | struct ext3_new_group_input { |
215 | __u32 group; /* Group number for this data */ | 207 | __u32 group; /* Group number for this data */ |
@@ -560,6 +552,31 @@ static inline int ext3_valid_inum(struct super_block *sb, unsigned long ino) | |||
560 | (ino >= EXT3_FIRST_INO(sb) && | 552 | (ino >= EXT3_FIRST_INO(sb) && |
561 | ino <= le32_to_cpu(EXT3_SB(sb)->s_es->s_inodes_count)); | 553 | ino <= le32_to_cpu(EXT3_SB(sb)->s_es->s_inodes_count)); |
562 | } | 554 | } |
555 | |||
556 | /* | ||
557 | * Inode dynamic state flags | ||
558 | */ | ||
559 | enum { | ||
560 | EXT3_STATE_JDATA, /* journaled data exists */ | ||
561 | EXT3_STATE_NEW, /* inode is newly created */ | ||
562 | EXT3_STATE_XATTR, /* has in-inode xattrs */ | ||
563 | EXT3_STATE_FLUSH_ON_CLOSE, /* flush dirty pages on close */ | ||
564 | }; | ||
565 | |||
566 | static inline int ext3_test_inode_state(struct inode *inode, int bit) | ||
567 | { | ||
568 | return test_bit(bit, &EXT3_I(inode)->i_state); | ||
569 | } | ||
570 | |||
571 | static inline void ext3_set_inode_state(struct inode *inode, int bit) | ||
572 | { | ||
573 | set_bit(bit, &EXT3_I(inode)->i_state); | ||
574 | } | ||
575 | |||
576 | static inline void ext3_clear_inode_state(struct inode *inode, int bit) | ||
577 | { | ||
578 | clear_bit(bit, &EXT3_I(inode)->i_state); | ||
579 | } | ||
563 | #else | 580 | #else |
564 | /* Assume that user mode programs are passing in an ext3fs superblock, not | 581 | /* Assume that user mode programs are passing in an ext3fs superblock, not |
565 | * a kernel struct super_block. This will allow us to call the feature-test | 582 | * a kernel struct super_block. This will allow us to call the feature-test |
@@ -877,7 +894,7 @@ int ext3_get_blocks_handle(handle_t *handle, struct inode *inode, | |||
877 | int create); | 894 | int create); |
878 | 895 | ||
879 | extern struct inode *ext3_iget(struct super_block *, unsigned long); | 896 | extern struct inode *ext3_iget(struct super_block *, unsigned long); |
880 | extern int ext3_write_inode (struct inode *, int); | 897 | extern int ext3_write_inode (struct inode *, struct writeback_control *); |
881 | extern int ext3_setattr (struct dentry *, struct iattr *); | 898 | extern int ext3_setattr (struct dentry *, struct iattr *); |
882 | extern void ext3_delete_inode (struct inode *); | 899 | extern void ext3_delete_inode (struct inode *); |
883 | extern int ext3_sync_inode (handle_t *, struct inode *); | 900 | extern int ext3_sync_inode (handle_t *, struct inode *); |
diff --git a/include/linux/ext3_fs_i.h b/include/linux/ext3_fs_i.h index 93e7428156ba..7679acdb519a 100644 --- a/include/linux/ext3_fs_i.h +++ b/include/linux/ext3_fs_i.h | |||
@@ -87,7 +87,7 @@ struct ext3_inode_info { | |||
87 | * near to their parent directory's inode. | 87 | * near to their parent directory's inode. |
88 | */ | 88 | */ |
89 | __u32 i_block_group; | 89 | __u32 i_block_group; |
90 | __u32 i_state; /* Dynamic state flags for ext3 */ | 90 | unsigned long i_state; /* Dynamic state flags for ext3 */ |
91 | 91 | ||
92 | /* block reservation info */ | 92 | /* block reservation info */ |
93 | struct ext3_block_alloc_info *i_block_alloc_info; | 93 | struct ext3_block_alloc_info *i_block_alloc_info; |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 5b3182c7eb5f..45689621a851 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1557,7 +1557,7 @@ struct super_operations { | |||
1557 | void (*destroy_inode)(struct inode *); | 1557 | void (*destroy_inode)(struct inode *); |
1558 | 1558 | ||
1559 | void (*dirty_inode) (struct inode *); | 1559 | void (*dirty_inode) (struct inode *); |
1560 | int (*write_inode) (struct inode *, int); | 1560 | int (*write_inode) (struct inode *, struct writeback_control *wbc); |
1561 | void (*drop_inode) (struct inode *); | 1561 | void (*drop_inode) (struct inode *); |
1562 | void (*delete_inode) (struct inode *); | 1562 | void (*delete_inode) (struct inode *); |
1563 | void (*put_super) (struct super_block *); | 1563 | void (*put_super) (struct super_block *); |
diff --git a/include/linux/jbd.h b/include/linux/jbd.h index 331530cd3cc6..f3aa59cb675d 100644 --- a/include/linux/jbd.h +++ b/include/linux/jbd.h | |||
@@ -246,19 +246,8 @@ typedef struct journal_superblock_s | |||
246 | 246 | ||
247 | #define J_ASSERT(assert) BUG_ON(!(assert)) | 247 | #define J_ASSERT(assert) BUG_ON(!(assert)) |
248 | 248 | ||
249 | #if defined(CONFIG_BUFFER_DEBUG) | ||
250 | void buffer_assertion_failure(struct buffer_head *bh); | ||
251 | #define J_ASSERT_BH(bh, expr) \ | ||
252 | do { \ | ||
253 | if (!(expr)) \ | ||
254 | buffer_assertion_failure(bh); \ | ||
255 | J_ASSERT(expr); \ | ||
256 | } while (0) | ||
257 | #define J_ASSERT_JH(jh, expr) J_ASSERT_BH(jh2bh(jh), expr) | ||
258 | #else | ||
259 | #define J_ASSERT_BH(bh, expr) J_ASSERT(expr) | 249 | #define J_ASSERT_BH(bh, expr) J_ASSERT(expr) |
260 | #define J_ASSERT_JH(jh, expr) J_ASSERT(expr) | 250 | #define J_ASSERT_JH(jh, expr) J_ASSERT(expr) |
261 | #endif | ||
262 | 251 | ||
263 | #if defined(JBD_PARANOID_IOFAIL) | 252 | #if defined(JBD_PARANOID_IOFAIL) |
264 | #define J_EXPECT(expr, why...) J_ASSERT(expr) | 253 | #define J_EXPECT(expr, why...) J_ASSERT(expr) |
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index 638ce4554c76..1ec876358180 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h | |||
@@ -69,15 +69,8 @@ extern u8 jbd2_journal_enable_debug; | |||
69 | #define jbd_debug(f, a...) /**/ | 69 | #define jbd_debug(f, a...) /**/ |
70 | #endif | 70 | #endif |
71 | 71 | ||
72 | static inline void *jbd2_alloc(size_t size, gfp_t flags) | 72 | extern void *jbd2_alloc(size_t size, gfp_t flags); |
73 | { | 73 | extern void jbd2_free(void *ptr, size_t size); |
74 | return (void *)__get_free_pages(flags, get_order(size)); | ||
75 | } | ||
76 | |||
77 | static inline void jbd2_free(void *ptr, size_t size) | ||
78 | { | ||
79 | free_pages((unsigned long)ptr, get_order(size)); | ||
80 | }; | ||
81 | 74 | ||
82 | #define JBD2_MIN_JOURNAL_BLOCKS 1024 | 75 | #define JBD2_MIN_JOURNAL_BLOCKS 1024 |
83 | 76 | ||
@@ -284,19 +277,8 @@ typedef struct journal_superblock_s | |||
284 | 277 | ||
285 | #define J_ASSERT(assert) BUG_ON(!(assert)) | 278 | #define J_ASSERT(assert) BUG_ON(!(assert)) |
286 | 279 | ||
287 | #if defined(CONFIG_BUFFER_DEBUG) | ||
288 | void buffer_assertion_failure(struct buffer_head *bh); | ||
289 | #define J_ASSERT_BH(bh, expr) \ | ||
290 | do { \ | ||
291 | if (!(expr)) \ | ||
292 | buffer_assertion_failure(bh); \ | ||
293 | J_ASSERT(expr); \ | ||
294 | } while (0) | ||
295 | #define J_ASSERT_JH(jh, expr) J_ASSERT_BH(jh2bh(jh), expr) | ||
296 | #else | ||
297 | #define J_ASSERT_BH(bh, expr) J_ASSERT(expr) | 280 | #define J_ASSERT_BH(bh, expr) J_ASSERT(expr) |
298 | #define J_ASSERT_JH(jh, expr) J_ASSERT(expr) | 281 | #define J_ASSERT_JH(jh, expr) J_ASSERT(expr) |
299 | #endif | ||
300 | 282 | ||
301 | #if defined(JBD2_PARANOID_IOFAIL) | 283 | #if defined(JBD2_PARANOID_IOFAIL) |
302 | #define J_EXPECT(expr, why...) J_ASSERT(expr) | 284 | #define J_EXPECT(expr, why...) J_ASSERT(expr) |
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index 1b672f74a32f..e7d1b2e0070d 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h | |||
@@ -122,6 +122,11 @@ struct kprobe { | |||
122 | /* Kprobe status flags */ | 122 | /* Kprobe status flags */ |
123 | #define KPROBE_FLAG_GONE 1 /* breakpoint has already gone */ | 123 | #define KPROBE_FLAG_GONE 1 /* breakpoint has already gone */ |
124 | #define KPROBE_FLAG_DISABLED 2 /* probe is temporarily disabled */ | 124 | #define KPROBE_FLAG_DISABLED 2 /* probe is temporarily disabled */ |
125 | #define KPROBE_FLAG_OPTIMIZED 4 /* | ||
126 | * probe is really optimized. | ||
127 | * NOTE: | ||
128 | * this flag is only for optimized_kprobe. | ||
129 | */ | ||
125 | 130 | ||
126 | /* Has this kprobe gone ? */ | 131 | /* Has this kprobe gone ? */ |
127 | static inline int kprobe_gone(struct kprobe *p) | 132 | static inline int kprobe_gone(struct kprobe *p) |
@@ -134,6 +139,12 @@ static inline int kprobe_disabled(struct kprobe *p) | |||
134 | { | 139 | { |
135 | return p->flags & (KPROBE_FLAG_DISABLED | KPROBE_FLAG_GONE); | 140 | return p->flags & (KPROBE_FLAG_DISABLED | KPROBE_FLAG_GONE); |
136 | } | 141 | } |
142 | |||
143 | /* Is this kprobe really running optimized path ? */ | ||
144 | static inline int kprobe_optimized(struct kprobe *p) | ||
145 | { | ||
146 | return p->flags & KPROBE_FLAG_OPTIMIZED; | ||
147 | } | ||
137 | /* | 148 | /* |
138 | * Special probe type that uses setjmp-longjmp type tricks to resume | 149 | * Special probe type that uses setjmp-longjmp type tricks to resume |
139 | * execution at a specified entry with a matching prototype corresponding | 150 | * execution at a specified entry with a matching prototype corresponding |
@@ -249,6 +260,39 @@ extern kprobe_opcode_t *get_insn_slot(void); | |||
249 | extern void free_insn_slot(kprobe_opcode_t *slot, int dirty); | 260 | extern void free_insn_slot(kprobe_opcode_t *slot, int dirty); |
250 | extern void kprobes_inc_nmissed_count(struct kprobe *p); | 261 | extern void kprobes_inc_nmissed_count(struct kprobe *p); |
251 | 262 | ||
263 | #ifdef CONFIG_OPTPROBES | ||
264 | /* | ||
265 | * Internal structure for direct jump optimized probe | ||
266 | */ | ||
267 | struct optimized_kprobe { | ||
268 | struct kprobe kp; | ||
269 | struct list_head list; /* list for optimizing queue */ | ||
270 | struct arch_optimized_insn optinsn; | ||
271 | }; | ||
272 | |||
273 | /* Architecture dependent functions for direct jump optimization */ | ||
274 | extern int arch_prepared_optinsn(struct arch_optimized_insn *optinsn); | ||
275 | extern int arch_check_optimized_kprobe(struct optimized_kprobe *op); | ||
276 | extern int arch_prepare_optimized_kprobe(struct optimized_kprobe *op); | ||
277 | extern void arch_remove_optimized_kprobe(struct optimized_kprobe *op); | ||
278 | extern int arch_optimize_kprobe(struct optimized_kprobe *op); | ||
279 | extern void arch_unoptimize_kprobe(struct optimized_kprobe *op); | ||
280 | extern kprobe_opcode_t *get_optinsn_slot(void); | ||
281 | extern void free_optinsn_slot(kprobe_opcode_t *slot, int dirty); | ||
282 | extern int arch_within_optimized_kprobe(struct optimized_kprobe *op, | ||
283 | unsigned long addr); | ||
284 | |||
285 | extern void opt_pre_handler(struct kprobe *p, struct pt_regs *regs); | ||
286 | |||
287 | #ifdef CONFIG_SYSCTL | ||
288 | extern int sysctl_kprobes_optimization; | ||
289 | extern int proc_kprobes_optimization_handler(struct ctl_table *table, | ||
290 | int write, void __user *buffer, | ||
291 | size_t *length, loff_t *ppos); | ||
292 | #endif | ||
293 | |||
294 | #endif /* CONFIG_OPTPROBES */ | ||
295 | |||
252 | /* Get the kprobe at this addr (if any) - called with preemption disabled */ | 296 | /* Get the kprobe at this addr (if any) - called with preemption disabled */ |
253 | struct kprobe *get_kprobe(void *addr); | 297 | struct kprobe *get_kprobe(void *addr); |
254 | void kretprobe_hash_lock(struct task_struct *tsk, | 298 | void kretprobe_hash_lock(struct task_struct *tsk, |
diff --git a/include/linux/kvm.h b/include/linux/kvm.h index a24de0b1858e..60df9c84ecae 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h | |||
@@ -103,7 +103,7 @@ struct kvm_userspace_memory_region { | |||
103 | 103 | ||
104 | /* for kvm_memory_region::flags */ | 104 | /* for kvm_memory_region::flags */ |
105 | #define KVM_MEM_LOG_DIRTY_PAGES 1UL | 105 | #define KVM_MEM_LOG_DIRTY_PAGES 1UL |
106 | 106 | #define KVM_MEMSLOT_INVALID (1UL << 1) | |
107 | 107 | ||
108 | /* for KVM_IRQ_LINE */ | 108 | /* for KVM_IRQ_LINE */ |
109 | struct kvm_irq_level { | 109 | struct kvm_irq_level { |
@@ -497,6 +497,11 @@ struct kvm_ioeventfd { | |||
497 | #endif | 497 | #endif |
498 | #define KVM_CAP_S390_PSW 42 | 498 | #define KVM_CAP_S390_PSW 42 |
499 | #define KVM_CAP_PPC_SEGSTATE 43 | 499 | #define KVM_CAP_PPC_SEGSTATE 43 |
500 | #define KVM_CAP_HYPERV 44 | ||
501 | #define KVM_CAP_HYPERV_VAPIC 45 | ||
502 | #define KVM_CAP_HYPERV_SPIN 46 | ||
503 | #define KVM_CAP_PCI_SEGMENT 47 | ||
504 | #define KVM_CAP_X86_ROBUST_SINGLESTEP 51 | ||
500 | 505 | ||
501 | #ifdef KVM_CAP_IRQ_ROUTING | 506 | #ifdef KVM_CAP_IRQ_ROUTING |
502 | 507 | ||
@@ -691,8 +696,9 @@ struct kvm_assigned_pci_dev { | |||
691 | __u32 busnr; | 696 | __u32 busnr; |
692 | __u32 devfn; | 697 | __u32 devfn; |
693 | __u32 flags; | 698 | __u32 flags; |
699 | __u32 segnr; | ||
694 | union { | 700 | union { |
695 | __u32 reserved[12]; | 701 | __u32 reserved[11]; |
696 | }; | 702 | }; |
697 | }; | 703 | }; |
698 | 704 | ||
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index bd5a616d9373..a3fd0f91d943 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -38,6 +38,7 @@ | |||
38 | #define KVM_REQ_MMU_SYNC 7 | 38 | #define KVM_REQ_MMU_SYNC 7 |
39 | #define KVM_REQ_KVMCLOCK_UPDATE 8 | 39 | #define KVM_REQ_KVMCLOCK_UPDATE 8 |
40 | #define KVM_REQ_KICK 9 | 40 | #define KVM_REQ_KICK 9 |
41 | #define KVM_REQ_DEACTIVATE_FPU 10 | ||
41 | 42 | ||
42 | #define KVM_USERSPACE_IRQ_SOURCE_ID 0 | 43 | #define KVM_USERSPACE_IRQ_SOURCE_ID 0 |
43 | 44 | ||
@@ -57,20 +58,20 @@ struct kvm_io_bus { | |||
57 | struct kvm_io_device *devs[NR_IOBUS_DEVS]; | 58 | struct kvm_io_device *devs[NR_IOBUS_DEVS]; |
58 | }; | 59 | }; |
59 | 60 | ||
60 | void kvm_io_bus_init(struct kvm_io_bus *bus); | 61 | enum kvm_bus { |
61 | void kvm_io_bus_destroy(struct kvm_io_bus *bus); | 62 | KVM_MMIO_BUS, |
62 | int kvm_io_bus_write(struct kvm_io_bus *bus, gpa_t addr, int len, | 63 | KVM_PIO_BUS, |
63 | const void *val); | 64 | KVM_NR_BUSES |
64 | int kvm_io_bus_read(struct kvm_io_bus *bus, gpa_t addr, int len, | 65 | }; |
66 | |||
67 | int kvm_io_bus_write(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, | ||
68 | int len, const void *val); | ||
69 | int kvm_io_bus_read(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, int len, | ||
65 | void *val); | 70 | void *val); |
66 | int __kvm_io_bus_register_dev(struct kvm_io_bus *bus, | 71 | int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, |
67 | struct kvm_io_device *dev); | ||
68 | int kvm_io_bus_register_dev(struct kvm *kvm, struct kvm_io_bus *bus, | ||
69 | struct kvm_io_device *dev); | 72 | struct kvm_io_device *dev); |
70 | void __kvm_io_bus_unregister_dev(struct kvm_io_bus *bus, | 73 | int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx, |
71 | struct kvm_io_device *dev); | 74 | struct kvm_io_device *dev); |
72 | void kvm_io_bus_unregister_dev(struct kvm *kvm, struct kvm_io_bus *bus, | ||
73 | struct kvm_io_device *dev); | ||
74 | 75 | ||
75 | struct kvm_vcpu { | 76 | struct kvm_vcpu { |
76 | struct kvm *kvm; | 77 | struct kvm *kvm; |
@@ -83,6 +84,8 @@ struct kvm_vcpu { | |||
83 | struct kvm_run *run; | 84 | struct kvm_run *run; |
84 | unsigned long requests; | 85 | unsigned long requests; |
85 | unsigned long guest_debug; | 86 | unsigned long guest_debug; |
87 | int srcu_idx; | ||
88 | |||
86 | int fpu_active; | 89 | int fpu_active; |
87 | int guest_fpu_loaded; | 90 | int guest_fpu_loaded; |
88 | wait_queue_head_t wq; | 91 | wait_queue_head_t wq; |
@@ -150,14 +153,19 @@ struct kvm_irq_routing_table {}; | |||
150 | 153 | ||
151 | #endif | 154 | #endif |
152 | 155 | ||
153 | struct kvm { | 156 | struct kvm_memslots { |
154 | spinlock_t mmu_lock; | ||
155 | spinlock_t requests_lock; | ||
156 | struct rw_semaphore slots_lock; | ||
157 | struct mm_struct *mm; /* userspace tied to this vm */ | ||
158 | int nmemslots; | 157 | int nmemslots; |
159 | struct kvm_memory_slot memslots[KVM_MEMORY_SLOTS + | 158 | struct kvm_memory_slot memslots[KVM_MEMORY_SLOTS + |
160 | KVM_PRIVATE_MEM_SLOTS]; | 159 | KVM_PRIVATE_MEM_SLOTS]; |
160 | }; | ||
161 | |||
162 | struct kvm { | ||
163 | spinlock_t mmu_lock; | ||
164 | raw_spinlock_t requests_lock; | ||
165 | struct mutex slots_lock; | ||
166 | struct mm_struct *mm; /* userspace tied to this vm */ | ||
167 | struct kvm_memslots *memslots; | ||
168 | struct srcu_struct srcu; | ||
161 | #ifdef CONFIG_KVM_APIC_ARCHITECTURE | 169 | #ifdef CONFIG_KVM_APIC_ARCHITECTURE |
162 | u32 bsp_vcpu_id; | 170 | u32 bsp_vcpu_id; |
163 | struct kvm_vcpu *bsp_vcpu; | 171 | struct kvm_vcpu *bsp_vcpu; |
@@ -166,8 +174,7 @@ struct kvm { | |||
166 | atomic_t online_vcpus; | 174 | atomic_t online_vcpus; |
167 | struct list_head vm_list; | 175 | struct list_head vm_list; |
168 | struct mutex lock; | 176 | struct mutex lock; |
169 | struct kvm_io_bus mmio_bus; | 177 | struct kvm_io_bus *buses[KVM_NR_BUSES]; |
170 | struct kvm_io_bus pio_bus; | ||
171 | #ifdef CONFIG_HAVE_KVM_EVENTFD | 178 | #ifdef CONFIG_HAVE_KVM_EVENTFD |
172 | struct { | 179 | struct { |
173 | spinlock_t lock; | 180 | spinlock_t lock; |
@@ -249,13 +256,20 @@ int kvm_set_memory_region(struct kvm *kvm, | |||
249 | int __kvm_set_memory_region(struct kvm *kvm, | 256 | int __kvm_set_memory_region(struct kvm *kvm, |
250 | struct kvm_userspace_memory_region *mem, | 257 | struct kvm_userspace_memory_region *mem, |
251 | int user_alloc); | 258 | int user_alloc); |
252 | int kvm_arch_set_memory_region(struct kvm *kvm, | 259 | int kvm_arch_prepare_memory_region(struct kvm *kvm, |
260 | struct kvm_memory_slot *memslot, | ||
261 | struct kvm_memory_slot old, | ||
262 | struct kvm_userspace_memory_region *mem, | ||
263 | int user_alloc); | ||
264 | void kvm_arch_commit_memory_region(struct kvm *kvm, | ||
253 | struct kvm_userspace_memory_region *mem, | 265 | struct kvm_userspace_memory_region *mem, |
254 | struct kvm_memory_slot old, | 266 | struct kvm_memory_slot old, |
255 | int user_alloc); | 267 | int user_alloc); |
256 | void kvm_disable_largepages(void); | 268 | void kvm_disable_largepages(void); |
257 | void kvm_arch_flush_shadow(struct kvm *kvm); | 269 | void kvm_arch_flush_shadow(struct kvm *kvm); |
258 | gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn); | 270 | gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn); |
271 | gfn_t unalias_gfn_instantiation(struct kvm *kvm, gfn_t gfn); | ||
272 | |||
259 | struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn); | 273 | struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn); |
260 | unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn); | 274 | unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn); |
261 | void kvm_release_page_clean(struct page *page); | 275 | void kvm_release_page_clean(struct page *page); |
@@ -264,6 +278,9 @@ void kvm_set_page_dirty(struct page *page); | |||
264 | void kvm_set_page_accessed(struct page *page); | 278 | void kvm_set_page_accessed(struct page *page); |
265 | 279 | ||
266 | pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn); | 280 | pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn); |
281 | pfn_t gfn_to_pfn_memslot(struct kvm *kvm, | ||
282 | struct kvm_memory_slot *slot, gfn_t gfn); | ||
283 | int memslot_id(struct kvm *kvm, gfn_t gfn); | ||
267 | void kvm_release_pfn_dirty(pfn_t); | 284 | void kvm_release_pfn_dirty(pfn_t); |
268 | void kvm_release_pfn_clean(pfn_t pfn); | 285 | void kvm_release_pfn_clean(pfn_t pfn); |
269 | void kvm_set_pfn_dirty(pfn_t pfn); | 286 | void kvm_set_pfn_dirty(pfn_t pfn); |
@@ -283,6 +300,7 @@ int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len); | |||
283 | int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len); | 300 | int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len); |
284 | struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn); | 301 | struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn); |
285 | int kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn); | 302 | int kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn); |
303 | unsigned long kvm_host_page_size(struct kvm *kvm, gfn_t gfn); | ||
286 | void mark_page_dirty(struct kvm *kvm, gfn_t gfn); | 304 | void mark_page_dirty(struct kvm *kvm, gfn_t gfn); |
287 | 305 | ||
288 | void kvm_vcpu_block(struct kvm_vcpu *vcpu); | 306 | void kvm_vcpu_block(struct kvm_vcpu *vcpu); |
@@ -383,6 +401,7 @@ struct kvm_assigned_dev_kernel { | |||
383 | struct work_struct interrupt_work; | 401 | struct work_struct interrupt_work; |
384 | struct list_head list; | 402 | struct list_head list; |
385 | int assigned_dev_id; | 403 | int assigned_dev_id; |
404 | int host_segnr; | ||
386 | int host_busnr; | 405 | int host_busnr; |
387 | int host_devfn; | 406 | int host_devfn; |
388 | unsigned int entries_nr; | 407 | unsigned int entries_nr; |
@@ -429,8 +448,7 @@ void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id); | |||
429 | #define KVM_IOMMU_CACHE_COHERENCY 0x1 | 448 | #define KVM_IOMMU_CACHE_COHERENCY 0x1 |
430 | 449 | ||
431 | #ifdef CONFIG_IOMMU_API | 450 | #ifdef CONFIG_IOMMU_API |
432 | int kvm_iommu_map_pages(struct kvm *kvm, gfn_t base_gfn, | 451 | int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot); |
433 | unsigned long npages); | ||
434 | int kvm_iommu_map_guest(struct kvm *kvm); | 452 | int kvm_iommu_map_guest(struct kvm *kvm); |
435 | int kvm_iommu_unmap_guest(struct kvm *kvm); | 453 | int kvm_iommu_unmap_guest(struct kvm *kvm); |
436 | int kvm_assign_device(struct kvm *kvm, | 454 | int kvm_assign_device(struct kvm *kvm, |
@@ -480,11 +498,6 @@ static inline void kvm_guest_exit(void) | |||
480 | current->flags &= ~PF_VCPU; | 498 | current->flags &= ~PF_VCPU; |
481 | } | 499 | } |
482 | 500 | ||
483 | static inline int memslot_id(struct kvm *kvm, struct kvm_memory_slot *slot) | ||
484 | { | ||
485 | return slot - kvm->memslots; | ||
486 | } | ||
487 | |||
488 | static inline gpa_t gfn_to_gpa(gfn_t gfn) | 501 | static inline gpa_t gfn_to_gpa(gfn_t gfn) |
489 | { | 502 | { |
490 | return (gpa_t)gfn << PAGE_SHIFT; | 503 | return (gpa_t)gfn << PAGE_SHIFT; |
@@ -532,6 +545,10 @@ static inline int mmu_notifier_retry(struct kvm_vcpu *vcpu, unsigned long mmu_se | |||
532 | } | 545 | } |
533 | #endif | 546 | #endif |
534 | 547 | ||
548 | #ifndef KVM_ARCH_HAS_UNALIAS_INSTANTIATION | ||
549 | #define unalias_gfn_instantiation unalias_gfn | ||
550 | #endif | ||
551 | |||
535 | #ifdef CONFIG_HAVE_KVM_IRQCHIP | 552 | #ifdef CONFIG_HAVE_KVM_IRQCHIP |
536 | 553 | ||
537 | #define KVM_MAX_IRQ_ROUTES 1024 | 554 | #define KVM_MAX_IRQ_ROUTES 1024 |
diff --git a/include/linux/quota.h b/include/linux/quota.h index a6861f117480..b462916b2a0a 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h | |||
@@ -279,9 +279,6 @@ struct dquot { | |||
279 | struct mem_dqblk dq_dqb; /* Diskquota usage */ | 279 | struct mem_dqblk dq_dqb; /* Diskquota usage */ |
280 | }; | 280 | }; |
281 | 281 | ||
282 | #define QUOTA_OK 0 | ||
283 | #define NO_QUOTA 1 | ||
284 | |||
285 | /* Operations which must be implemented by each quota format */ | 282 | /* Operations which must be implemented by each quota format */ |
286 | struct quota_format_ops { | 283 | struct quota_format_ops { |
287 | int (*check_quota_file)(struct super_block *sb, int type); /* Detect whether file is in our format */ | 284 | int (*check_quota_file)(struct super_block *sb, int type); /* Detect whether file is in our format */ |
@@ -295,13 +292,6 @@ struct quota_format_ops { | |||
295 | 292 | ||
296 | /* Operations working with dquots */ | 293 | /* Operations working with dquots */ |
297 | struct dquot_operations { | 294 | struct dquot_operations { |
298 | int (*initialize) (struct inode *, int); | ||
299 | int (*drop) (struct inode *); | ||
300 | int (*alloc_space) (struct inode *, qsize_t, int); | ||
301 | int (*alloc_inode) (const struct inode *, qsize_t); | ||
302 | int (*free_space) (struct inode *, qsize_t); | ||
303 | int (*free_inode) (const struct inode *, qsize_t); | ||
304 | int (*transfer) (struct inode *, struct iattr *); | ||
305 | int (*write_dquot) (struct dquot *); /* Ordinary dquot write */ | 295 | int (*write_dquot) (struct dquot *); /* Ordinary dquot write */ |
306 | struct dquot *(*alloc_dquot)(struct super_block *, int); /* Allocate memory for new dquot */ | 296 | struct dquot *(*alloc_dquot)(struct super_block *, int); /* Allocate memory for new dquot */ |
307 | void (*destroy_dquot)(struct dquot *); /* Free memory for dquot */ | 297 | void (*destroy_dquot)(struct dquot *); /* Free memory for dquot */ |
@@ -309,12 +299,6 @@ struct dquot_operations { | |||
309 | int (*release_dquot) (struct dquot *); /* Quota is going to be deleted from disk */ | 299 | int (*release_dquot) (struct dquot *); /* Quota is going to be deleted from disk */ |
310 | int (*mark_dirty) (struct dquot *); /* Dquot is marked dirty */ | 300 | int (*mark_dirty) (struct dquot *); /* Dquot is marked dirty */ |
311 | int (*write_info) (struct super_block *, int); /* Write of quota "superblock" */ | 301 | int (*write_info) (struct super_block *, int); /* Write of quota "superblock" */ |
312 | /* reserve quota for delayed block allocation */ | ||
313 | int (*reserve_space) (struct inode *, qsize_t, int); | ||
314 | /* claim reserved quota for delayed alloc */ | ||
315 | int (*claim_space) (struct inode *, qsize_t); | ||
316 | /* release rsved quota for delayed alloc */ | ||
317 | void (*release_rsv) (struct inode *, qsize_t); | ||
318 | /* get reserved quota for delayed alloc, value returned is managed by | 302 | /* get reserved quota for delayed alloc, value returned is managed by |
319 | * quota code only */ | 303 | * quota code only */ |
320 | qsize_t *(*get_reserved_space) (struct inode *); | 304 | qsize_t *(*get_reserved_space) (struct inode *); |
@@ -324,7 +308,7 @@ struct dquot_operations { | |||
324 | struct quotactl_ops { | 308 | struct quotactl_ops { |
325 | int (*quota_on)(struct super_block *, int, int, char *, int); | 309 | int (*quota_on)(struct super_block *, int, int, char *, int); |
326 | int (*quota_off)(struct super_block *, int, int); | 310 | int (*quota_off)(struct super_block *, int, int); |
327 | int (*quota_sync)(struct super_block *, int); | 311 | int (*quota_sync)(struct super_block *, int, int); |
328 | int (*get_info)(struct super_block *, int, struct if_dqinfo *); | 312 | int (*get_info)(struct super_block *, int, struct if_dqinfo *); |
329 | int (*set_info)(struct super_block *, int, struct if_dqinfo *); | 313 | int (*set_info)(struct super_block *, int, struct if_dqinfo *); |
330 | int (*get_dqblk)(struct super_block *, int, qid_t, struct if_dqblk *); | 314 | int (*get_dqblk)(struct super_block *, int, qid_t, struct if_dqblk *); |
@@ -357,26 +341,25 @@ enum { | |||
357 | #define DQUOT_STATE_FLAGS (DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED | \ | 341 | #define DQUOT_STATE_FLAGS (DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED | \ |
358 | DQUOT_SUSPENDED) | 342 | DQUOT_SUSPENDED) |
359 | /* Other quota flags */ | 343 | /* Other quota flags */ |
360 | #define DQUOT_QUOTA_SYS_FILE (1 << 6) /* Quota file is a special | 344 | #define DQUOT_STATE_LAST (_DQUOT_STATE_FLAGS * MAXQUOTAS) |
345 | #define DQUOT_QUOTA_SYS_FILE (1 << DQUOT_STATE_LAST) | ||
346 | /* Quota file is a special | ||
361 | * system file and user cannot | 347 | * system file and user cannot |
362 | * touch it. Filesystem is | 348 | * touch it. Filesystem is |
363 | * responsible for setting | 349 | * responsible for setting |
364 | * S_NOQUOTA, S_NOATIME flags | 350 | * S_NOQUOTA, S_NOATIME flags |
365 | */ | 351 | */ |
366 | #define DQUOT_NEGATIVE_USAGE (1 << 7) /* Allow negative quota usage */ | 352 | #define DQUOT_NEGATIVE_USAGE (1 << (DQUOT_STATE_LAST + 1)) |
353 | /* Allow negative quota usage */ | ||
367 | 354 | ||
368 | static inline unsigned int dquot_state_flag(unsigned int flags, int type) | 355 | static inline unsigned int dquot_state_flag(unsigned int flags, int type) |
369 | { | 356 | { |
370 | if (type == USRQUOTA) | 357 | return flags << _DQUOT_STATE_FLAGS * type; |
371 | return flags; | ||
372 | return flags << _DQUOT_STATE_FLAGS; | ||
373 | } | 358 | } |
374 | 359 | ||
375 | static inline unsigned int dquot_generic_flag(unsigned int flags, int type) | 360 | static inline unsigned int dquot_generic_flag(unsigned int flags, int type) |
376 | { | 361 | { |
377 | if (type == USRQUOTA) | 362 | return (flags >> _DQUOT_STATE_FLAGS * type) & DQUOT_STATE_FLAGS; |
378 | return flags; | ||
379 | return flags >> _DQUOT_STATE_FLAGS; | ||
380 | } | 363 | } |
381 | 364 | ||
382 | #ifdef CONFIG_QUOTA_NETLINK_INTERFACE | 365 | #ifdef CONFIG_QUOTA_NETLINK_INTERFACE |
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index 3ebb23153640..e6fa7acce290 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h | |||
@@ -19,15 +19,12 @@ static inline struct quota_info *sb_dqopt(struct super_block *sb) | |||
19 | /* | 19 | /* |
20 | * declaration of quota_function calls in kernel. | 20 | * declaration of quota_function calls in kernel. |
21 | */ | 21 | */ |
22 | void sync_quota_sb(struct super_block *sb, int type); | 22 | void inode_add_rsv_space(struct inode *inode, qsize_t number); |
23 | static inline void writeout_quota_sb(struct super_block *sb, int type) | 23 | void inode_claim_rsv_space(struct inode *inode, qsize_t number); |
24 | { | 24 | void inode_sub_rsv_space(struct inode *inode, qsize_t number); |
25 | if (sb->s_qcop->quota_sync) | ||
26 | sb->s_qcop->quota_sync(sb, type); | ||
27 | } | ||
28 | 25 | ||
29 | int dquot_initialize(struct inode *inode, int type); | 26 | void dquot_initialize(struct inode *inode); |
30 | int dquot_drop(struct inode *inode); | 27 | void dquot_drop(struct inode *inode); |
31 | struct dquot *dqget(struct super_block *sb, unsigned int id, int type); | 28 | struct dquot *dqget(struct super_block *sb, unsigned int id, int type); |
32 | void dqput(struct dquot *dquot); | 29 | void dqput(struct dquot *dquot); |
33 | int dquot_scan_active(struct super_block *sb, | 30 | int dquot_scan_active(struct super_block *sb, |
@@ -36,24 +33,23 @@ int dquot_scan_active(struct super_block *sb, | |||
36 | struct dquot *dquot_alloc(struct super_block *sb, int type); | 33 | struct dquot *dquot_alloc(struct super_block *sb, int type); |
37 | void dquot_destroy(struct dquot *dquot); | 34 | void dquot_destroy(struct dquot *dquot); |
38 | 35 | ||
39 | int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc); | 36 | int __dquot_alloc_space(struct inode *inode, qsize_t number, |
40 | int dquot_alloc_inode(const struct inode *inode, qsize_t number); | 37 | int warn, int reserve); |
38 | void __dquot_free_space(struct inode *inode, qsize_t number, int reserve); | ||
41 | 39 | ||
42 | int dquot_reserve_space(struct inode *inode, qsize_t number, int prealloc); | 40 | int dquot_alloc_inode(const struct inode *inode); |
43 | int dquot_claim_space(struct inode *inode, qsize_t number); | ||
44 | void dquot_release_reserved_space(struct inode *inode, qsize_t number); | ||
45 | qsize_t dquot_get_reserved_space(struct inode *inode); | ||
46 | 41 | ||
47 | int dquot_free_space(struct inode *inode, qsize_t number); | 42 | int dquot_claim_space_nodirty(struct inode *inode, qsize_t number); |
48 | int dquot_free_inode(const struct inode *inode, qsize_t number); | 43 | void dquot_free_inode(const struct inode *inode); |
49 | 44 | ||
50 | int dquot_transfer(struct inode *inode, struct iattr *iattr); | ||
51 | int dquot_commit(struct dquot *dquot); | 45 | int dquot_commit(struct dquot *dquot); |
52 | int dquot_acquire(struct dquot *dquot); | 46 | int dquot_acquire(struct dquot *dquot); |
53 | int dquot_release(struct dquot *dquot); | 47 | int dquot_release(struct dquot *dquot); |
54 | int dquot_commit_info(struct super_block *sb, int type); | 48 | int dquot_commit_info(struct super_block *sb, int type); |
55 | int dquot_mark_dquot_dirty(struct dquot *dquot); | 49 | int dquot_mark_dquot_dirty(struct dquot *dquot); |
56 | 50 | ||
51 | int dquot_file_open(struct inode *inode, struct file *file); | ||
52 | |||
57 | int vfs_quota_on(struct super_block *sb, int type, int format_id, | 53 | int vfs_quota_on(struct super_block *sb, int type, int format_id, |
58 | char *path, int remount); | 54 | char *path, int remount); |
59 | int vfs_quota_enable(struct inode *inode, int type, int format_id, | 55 | int vfs_quota_enable(struct inode *inode, int type, int format_id, |
@@ -64,14 +60,13 @@ int vfs_quota_on_mount(struct super_block *sb, char *qf_name, | |||
64 | int format_id, int type); | 60 | int format_id, int type); |
65 | int vfs_quota_off(struct super_block *sb, int type, int remount); | 61 | int vfs_quota_off(struct super_block *sb, int type, int remount); |
66 | int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags); | 62 | int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags); |
67 | int vfs_quota_sync(struct super_block *sb, int type); | 63 | int vfs_quota_sync(struct super_block *sb, int type, int wait); |
68 | int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); | 64 | int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); |
69 | int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); | 65 | int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); |
70 | int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); | 66 | int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); |
71 | int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); | 67 | int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); |
72 | 68 | ||
73 | void vfs_dq_drop(struct inode *inode); | 69 | int dquot_transfer(struct inode *inode, struct iattr *iattr); |
74 | int vfs_dq_transfer(struct inode *inode, struct iattr *iattr); | ||
75 | int vfs_dq_quota_on_remount(struct super_block *sb); | 70 | int vfs_dq_quota_on_remount(struct super_block *sb); |
76 | 71 | ||
77 | static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type) | 72 | static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type) |
@@ -83,53 +78,56 @@ static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type) | |||
83 | * Functions for checking status of quota | 78 | * Functions for checking status of quota |
84 | */ | 79 | */ |
85 | 80 | ||
86 | static inline int sb_has_quota_usage_enabled(struct super_block *sb, int type) | 81 | static inline bool sb_has_quota_usage_enabled(struct super_block *sb, int type) |
87 | { | 82 | { |
88 | return sb_dqopt(sb)->flags & | 83 | return sb_dqopt(sb)->flags & |
89 | dquot_state_flag(DQUOT_USAGE_ENABLED, type); | 84 | dquot_state_flag(DQUOT_USAGE_ENABLED, type); |
90 | } | 85 | } |
91 | 86 | ||
92 | static inline int sb_has_quota_limits_enabled(struct super_block *sb, int type) | 87 | static inline bool sb_has_quota_limits_enabled(struct super_block *sb, int type) |
93 | { | 88 | { |
94 | return sb_dqopt(sb)->flags & | 89 | return sb_dqopt(sb)->flags & |
95 | dquot_state_flag(DQUOT_LIMITS_ENABLED, type); | 90 | dquot_state_flag(DQUOT_LIMITS_ENABLED, type); |
96 | } | 91 | } |
97 | 92 | ||
98 | static inline int sb_has_quota_suspended(struct super_block *sb, int type) | 93 | static inline bool sb_has_quota_suspended(struct super_block *sb, int type) |
99 | { | 94 | { |
100 | return sb_dqopt(sb)->flags & | 95 | return sb_dqopt(sb)->flags & |
101 | dquot_state_flag(DQUOT_SUSPENDED, type); | 96 | dquot_state_flag(DQUOT_SUSPENDED, type); |
102 | } | 97 | } |
103 | 98 | ||
104 | static inline int sb_any_quota_suspended(struct super_block *sb) | 99 | static inline unsigned sb_any_quota_suspended(struct super_block *sb) |
105 | { | 100 | { |
106 | return sb_has_quota_suspended(sb, USRQUOTA) || | 101 | unsigned type, tmsk = 0; |
107 | sb_has_quota_suspended(sb, GRPQUOTA); | 102 | for (type = 0; type < MAXQUOTAS; type++) |
103 | tmsk |= sb_has_quota_suspended(sb, type) << type; | ||
104 | return tmsk; | ||
108 | } | 105 | } |
109 | 106 | ||
110 | /* Does kernel know about any quota information for given sb + type? */ | 107 | /* Does kernel know about any quota information for given sb + type? */ |
111 | static inline int sb_has_quota_loaded(struct super_block *sb, int type) | 108 | static inline bool sb_has_quota_loaded(struct super_block *sb, int type) |
112 | { | 109 | { |
113 | /* Currently if anything is on, then quota usage is on as well */ | 110 | /* Currently if anything is on, then quota usage is on as well */ |
114 | return sb_has_quota_usage_enabled(sb, type); | 111 | return sb_has_quota_usage_enabled(sb, type); |
115 | } | 112 | } |
116 | 113 | ||
117 | static inline int sb_any_quota_loaded(struct super_block *sb) | 114 | static inline unsigned sb_any_quota_loaded(struct super_block *sb) |
118 | { | 115 | { |
119 | return sb_has_quota_loaded(sb, USRQUOTA) || | 116 | unsigned type, tmsk = 0; |
120 | sb_has_quota_loaded(sb, GRPQUOTA); | 117 | for (type = 0; type < MAXQUOTAS; type++) |
118 | tmsk |= sb_has_quota_loaded(sb, type) << type; | ||
119 | return tmsk; | ||
121 | } | 120 | } |
122 | 121 | ||
123 | static inline int sb_has_quota_active(struct super_block *sb, int type) | 122 | static inline bool sb_has_quota_active(struct super_block *sb, int type) |
124 | { | 123 | { |
125 | return sb_has_quota_loaded(sb, type) && | 124 | return sb_has_quota_loaded(sb, type) && |
126 | !sb_has_quota_suspended(sb, type); | 125 | !sb_has_quota_suspended(sb, type); |
127 | } | 126 | } |
128 | 127 | ||
129 | static inline int sb_any_quota_active(struct super_block *sb) | 128 | static inline unsigned sb_any_quota_active(struct super_block *sb) |
130 | { | 129 | { |
131 | return sb_has_quota_active(sb, USRQUOTA) || | 130 | return sb_any_quota_loaded(sb) & ~sb_any_quota_suspended(sb); |
132 | sb_has_quota_active(sb, GRPQUOTA); | ||
133 | } | 131 | } |
134 | 132 | ||
135 | /* | 133 | /* |
@@ -141,122 +139,6 @@ extern const struct quotactl_ops vfs_quotactl_ops; | |||
141 | #define sb_dquot_ops (&dquot_operations) | 139 | #define sb_dquot_ops (&dquot_operations) |
142 | #define sb_quotactl_ops (&vfs_quotactl_ops) | 140 | #define sb_quotactl_ops (&vfs_quotactl_ops) |
143 | 141 | ||
144 | /* It is better to call this function outside of any transaction as it might | ||
145 | * need a lot of space in journal for dquot structure allocation. */ | ||
146 | static inline void vfs_dq_init(struct inode *inode) | ||
147 | { | ||
148 | BUG_ON(!inode->i_sb); | ||
149 | if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode)) | ||
150 | inode->i_sb->dq_op->initialize(inode, -1); | ||
151 | } | ||
152 | |||
153 | /* The following allocation/freeing/transfer functions *must* be called inside | ||
154 | * a transaction (deadlocks possible otherwise) */ | ||
155 | static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr) | ||
156 | { | ||
157 | if (sb_any_quota_active(inode->i_sb)) { | ||
158 | /* Used space is updated in alloc_space() */ | ||
159 | if (inode->i_sb->dq_op->alloc_space(inode, nr, 1) == NO_QUOTA) | ||
160 | return 1; | ||
161 | } | ||
162 | else | ||
163 | inode_add_bytes(inode, nr); | ||
164 | return 0; | ||
165 | } | ||
166 | |||
167 | static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr) | ||
168 | { | ||
169 | int ret; | ||
170 | if (!(ret = vfs_dq_prealloc_space_nodirty(inode, nr))) | ||
171 | mark_inode_dirty(inode); | ||
172 | return ret; | ||
173 | } | ||
174 | |||
175 | static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr) | ||
176 | { | ||
177 | if (sb_any_quota_active(inode->i_sb)) { | ||
178 | /* Used space is updated in alloc_space() */ | ||
179 | if (inode->i_sb->dq_op->alloc_space(inode, nr, 0) == NO_QUOTA) | ||
180 | return 1; | ||
181 | } | ||
182 | else | ||
183 | inode_add_bytes(inode, nr); | ||
184 | return 0; | ||
185 | } | ||
186 | |||
187 | static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr) | ||
188 | { | ||
189 | int ret; | ||
190 | if (!(ret = vfs_dq_alloc_space_nodirty(inode, nr))) | ||
191 | mark_inode_dirty(inode); | ||
192 | return ret; | ||
193 | } | ||
194 | |||
195 | static inline int vfs_dq_reserve_space(struct inode *inode, qsize_t nr) | ||
196 | { | ||
197 | if (sb_any_quota_active(inode->i_sb)) { | ||
198 | /* Used space is updated in alloc_space() */ | ||
199 | if (inode->i_sb->dq_op->reserve_space(inode, nr, 0) == NO_QUOTA) | ||
200 | return 1; | ||
201 | } | ||
202 | return 0; | ||
203 | } | ||
204 | |||
205 | static inline int vfs_dq_alloc_inode(struct inode *inode) | ||
206 | { | ||
207 | if (sb_any_quota_active(inode->i_sb)) { | ||
208 | vfs_dq_init(inode); | ||
209 | if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA) | ||
210 | return 1; | ||
211 | } | ||
212 | return 0; | ||
213 | } | ||
214 | |||
215 | /* | ||
216 | * Convert in-memory reserved quotas to real consumed quotas | ||
217 | */ | ||
218 | static inline int vfs_dq_claim_space(struct inode *inode, qsize_t nr) | ||
219 | { | ||
220 | if (sb_any_quota_active(inode->i_sb)) { | ||
221 | if (inode->i_sb->dq_op->claim_space(inode, nr) == NO_QUOTA) | ||
222 | return 1; | ||
223 | } else | ||
224 | inode_add_bytes(inode, nr); | ||
225 | |||
226 | mark_inode_dirty(inode); | ||
227 | return 0; | ||
228 | } | ||
229 | |||
230 | /* | ||
231 | * Release reserved (in-memory) quotas | ||
232 | */ | ||
233 | static inline | ||
234 | void vfs_dq_release_reservation_space(struct inode *inode, qsize_t nr) | ||
235 | { | ||
236 | if (sb_any_quota_active(inode->i_sb)) | ||
237 | inode->i_sb->dq_op->release_rsv(inode, nr); | ||
238 | } | ||
239 | |||
240 | static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr) | ||
241 | { | ||
242 | if (sb_any_quota_active(inode->i_sb)) | ||
243 | inode->i_sb->dq_op->free_space(inode, nr); | ||
244 | else | ||
245 | inode_sub_bytes(inode, nr); | ||
246 | } | ||
247 | |||
248 | static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr) | ||
249 | { | ||
250 | vfs_dq_free_space_nodirty(inode, nr); | ||
251 | mark_inode_dirty(inode); | ||
252 | } | ||
253 | |||
254 | static inline void vfs_dq_free_inode(struct inode *inode) | ||
255 | { | ||
256 | if (sb_any_quota_active(inode->i_sb)) | ||
257 | inode->i_sb->dq_op->free_inode(inode, 1); | ||
258 | } | ||
259 | |||
260 | /* Cannot be called inside a transaction */ | 142 | /* Cannot be called inside a transaction */ |
261 | static inline int vfs_dq_off(struct super_block *sb, int remount) | 143 | static inline int vfs_dq_off(struct super_block *sb, int remount) |
262 | { | 144 | { |
@@ -316,28 +198,20 @@ static inline int sb_any_quota_active(struct super_block *sb) | |||
316 | #define sb_dquot_ops (NULL) | 198 | #define sb_dquot_ops (NULL) |
317 | #define sb_quotactl_ops (NULL) | 199 | #define sb_quotactl_ops (NULL) |
318 | 200 | ||
319 | static inline void vfs_dq_init(struct inode *inode) | 201 | static inline void dquot_initialize(struct inode *inode) |
320 | { | 202 | { |
321 | } | 203 | } |
322 | 204 | ||
323 | static inline void vfs_dq_drop(struct inode *inode) | 205 | static inline void dquot_drop(struct inode *inode) |
324 | { | 206 | { |
325 | } | 207 | } |
326 | 208 | ||
327 | static inline int vfs_dq_alloc_inode(struct inode *inode) | 209 | static inline int dquot_alloc_inode(const struct inode *inode) |
328 | { | 210 | { |
329 | return 0; | 211 | return 0; |
330 | } | 212 | } |
331 | 213 | ||
332 | static inline void vfs_dq_free_inode(struct inode *inode) | 214 | static inline void dquot_free_inode(const struct inode *inode) |
333 | { | ||
334 | } | ||
335 | |||
336 | static inline void sync_quota_sb(struct super_block *sb, int type) | ||
337 | { | ||
338 | } | ||
339 | |||
340 | static inline void writeout_quota_sb(struct super_block *sb, int type) | ||
341 | { | 215 | { |
342 | } | 216 | } |
343 | 217 | ||
@@ -351,110 +225,116 @@ static inline int vfs_dq_quota_on_remount(struct super_block *sb) | |||
351 | return 0; | 225 | return 0; |
352 | } | 226 | } |
353 | 227 | ||
354 | static inline int vfs_dq_transfer(struct inode *inode, struct iattr *iattr) | 228 | static inline int dquot_transfer(struct inode *inode, struct iattr *iattr) |
355 | { | 229 | { |
356 | return 0; | 230 | return 0; |
357 | } | 231 | } |
358 | 232 | ||
359 | static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr) | 233 | static inline int __dquot_alloc_space(struct inode *inode, qsize_t number, |
234 | int warn, int reserve) | ||
360 | { | 235 | { |
361 | inode_add_bytes(inode, nr); | 236 | if (!reserve) |
237 | inode_add_bytes(inode, number); | ||
362 | return 0; | 238 | return 0; |
363 | } | 239 | } |
364 | 240 | ||
365 | static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr) | 241 | static inline void __dquot_free_space(struct inode *inode, qsize_t number, |
242 | int reserve) | ||
366 | { | 243 | { |
367 | vfs_dq_prealloc_space_nodirty(inode, nr); | 244 | if (!reserve) |
368 | mark_inode_dirty(inode); | 245 | inode_sub_bytes(inode, number); |
369 | return 0; | ||
370 | } | 246 | } |
371 | 247 | ||
372 | static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr) | 248 | static inline int dquot_claim_space_nodirty(struct inode *inode, qsize_t number) |
373 | { | 249 | { |
374 | inode_add_bytes(inode, nr); | 250 | inode_add_bytes(inode, number); |
375 | return 0; | 251 | return 0; |
376 | } | 252 | } |
377 | 253 | ||
378 | static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr) | 254 | #define dquot_file_open generic_file_open |
255 | |||
256 | #endif /* CONFIG_QUOTA */ | ||
257 | |||
258 | static inline int dquot_alloc_space_nodirty(struct inode *inode, qsize_t nr) | ||
379 | { | 259 | { |
380 | vfs_dq_alloc_space_nodirty(inode, nr); | 260 | return __dquot_alloc_space(inode, nr, 1, 0); |
381 | mark_inode_dirty(inode); | ||
382 | return 0; | ||
383 | } | 261 | } |
384 | 262 | ||
385 | static inline int vfs_dq_reserve_space(struct inode *inode, qsize_t nr) | 263 | static inline int dquot_alloc_space(struct inode *inode, qsize_t nr) |
386 | { | 264 | { |
387 | return 0; | 265 | int ret; |
266 | |||
267 | ret = dquot_alloc_space_nodirty(inode, nr); | ||
268 | if (!ret) | ||
269 | mark_inode_dirty(inode); | ||
270 | return ret; | ||
388 | } | 271 | } |
389 | 272 | ||
390 | static inline int vfs_dq_claim_space(struct inode *inode, qsize_t nr) | 273 | static inline int dquot_alloc_block_nodirty(struct inode *inode, qsize_t nr) |
391 | { | 274 | { |
392 | return vfs_dq_alloc_space(inode, nr); | 275 | return dquot_alloc_space_nodirty(inode, nr << inode->i_blkbits); |
393 | } | 276 | } |
394 | 277 | ||
395 | static inline | 278 | static inline int dquot_alloc_block(struct inode *inode, qsize_t nr) |
396 | int vfs_dq_release_reservation_space(struct inode *inode, qsize_t nr) | ||
397 | { | 279 | { |
398 | return 0; | 280 | return dquot_alloc_space(inode, nr << inode->i_blkbits); |
399 | } | 281 | } |
400 | 282 | ||
401 | static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr) | 283 | static inline int dquot_prealloc_block_nodirty(struct inode *inode, qsize_t nr) |
402 | { | 284 | { |
403 | inode_sub_bytes(inode, nr); | 285 | return __dquot_alloc_space(inode, nr << inode->i_blkbits, 0, 0); |
404 | } | 286 | } |
405 | 287 | ||
406 | static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr) | 288 | static inline int dquot_prealloc_block(struct inode *inode, qsize_t nr) |
407 | { | 289 | { |
408 | vfs_dq_free_space_nodirty(inode, nr); | 290 | int ret; |
409 | mark_inode_dirty(inode); | ||
410 | } | ||
411 | |||
412 | #endif /* CONFIG_QUOTA */ | ||
413 | 291 | ||
414 | static inline int vfs_dq_prealloc_block_nodirty(struct inode *inode, qsize_t nr) | 292 | ret = dquot_prealloc_block_nodirty(inode, nr); |
415 | { | 293 | if (!ret) |
416 | return vfs_dq_prealloc_space_nodirty(inode, nr << inode->i_blkbits); | 294 | mark_inode_dirty(inode); |
295 | return ret; | ||
417 | } | 296 | } |
418 | 297 | ||
419 | static inline int vfs_dq_prealloc_block(struct inode *inode, qsize_t nr) | 298 | static inline int dquot_reserve_block(struct inode *inode, qsize_t nr) |
420 | { | 299 | { |
421 | return vfs_dq_prealloc_space(inode, nr << inode->i_blkbits); | 300 | return __dquot_alloc_space(inode, nr << inode->i_blkbits, 1, 1); |
422 | } | 301 | } |
423 | 302 | ||
424 | static inline int vfs_dq_alloc_block_nodirty(struct inode *inode, qsize_t nr) | 303 | static inline int dquot_claim_block(struct inode *inode, qsize_t nr) |
425 | { | 304 | { |
426 | return vfs_dq_alloc_space_nodirty(inode, nr << inode->i_blkbits); | 305 | int ret; |
427 | } | ||
428 | 306 | ||
429 | static inline int vfs_dq_alloc_block(struct inode *inode, qsize_t nr) | 307 | ret = dquot_claim_space_nodirty(inode, nr << inode->i_blkbits); |
430 | { | 308 | if (!ret) |
431 | return vfs_dq_alloc_space(inode, nr << inode->i_blkbits); | 309 | mark_inode_dirty(inode); |
310 | return ret; | ||
432 | } | 311 | } |
433 | 312 | ||
434 | static inline int vfs_dq_reserve_block(struct inode *inode, qsize_t nr) | 313 | static inline void dquot_free_space_nodirty(struct inode *inode, qsize_t nr) |
435 | { | 314 | { |
436 | return vfs_dq_reserve_space(inode, nr << inode->i_blkbits); | 315 | __dquot_free_space(inode, nr, 0); |
437 | } | 316 | } |
438 | 317 | ||
439 | static inline int vfs_dq_claim_block(struct inode *inode, qsize_t nr) | 318 | static inline void dquot_free_space(struct inode *inode, qsize_t nr) |
440 | { | 319 | { |
441 | return vfs_dq_claim_space(inode, nr << inode->i_blkbits); | 320 | dquot_free_space_nodirty(inode, nr); |
321 | mark_inode_dirty(inode); | ||
442 | } | 322 | } |
443 | 323 | ||
444 | static inline | 324 | static inline void dquot_free_block_nodirty(struct inode *inode, qsize_t nr) |
445 | void vfs_dq_release_reservation_block(struct inode *inode, qsize_t nr) | ||
446 | { | 325 | { |
447 | vfs_dq_release_reservation_space(inode, nr << inode->i_blkbits); | 326 | dquot_free_space_nodirty(inode, nr << inode->i_blkbits); |
448 | } | 327 | } |
449 | 328 | ||
450 | static inline void vfs_dq_free_block_nodirty(struct inode *inode, qsize_t nr) | 329 | static inline void dquot_free_block(struct inode *inode, qsize_t nr) |
451 | { | 330 | { |
452 | vfs_dq_free_space_nodirty(inode, nr << inode->i_blkbits); | 331 | dquot_free_space(inode, nr << inode->i_blkbits); |
453 | } | 332 | } |
454 | 333 | ||
455 | static inline void vfs_dq_free_block(struct inode *inode, qsize_t nr) | 334 | static inline void dquot_release_reservation_block(struct inode *inode, |
335 | qsize_t nr) | ||
456 | { | 336 | { |
457 | vfs_dq_free_space(inode, nr << inode->i_blkbits); | 337 | __dquot_free_space(inode, nr << inode->i_blkbits, 1); |
458 | } | 338 | } |
459 | 339 | ||
460 | #endif /* _LINUX_QUOTAOPS_ */ | 340 | #endif /* _LINUX_QUOTAOPS_ */ |
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index 1ba3cf6edfbb..3b603f474186 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h | |||
@@ -2034,7 +2034,7 @@ void reiserfs_read_locked_inode(struct inode *inode, | |||
2034 | int reiserfs_find_actor(struct inode *inode, void *p); | 2034 | int reiserfs_find_actor(struct inode *inode, void *p); |
2035 | int reiserfs_init_locked_inode(struct inode *inode, void *p); | 2035 | int reiserfs_init_locked_inode(struct inode *inode, void *p); |
2036 | void reiserfs_delete_inode(struct inode *inode); | 2036 | void reiserfs_delete_inode(struct inode *inode); |
2037 | int reiserfs_write_inode(struct inode *inode, int); | 2037 | int reiserfs_write_inode(struct inode *inode, struct writeback_control *wbc); |
2038 | int reiserfs_get_block(struct inode *inode, sector_t block, | 2038 | int reiserfs_get_block(struct inode *inode, sector_t block, |
2039 | struct buffer_head *bh_result, int create); | 2039 | struct buffer_head *bh_result, int create); |
2040 | struct dentry *reiserfs_fh_to_dentry(struct super_block *sb, struct fid *fid, | 2040 | struct dentry *reiserfs_fh_to_dentry(struct super_block *sb, struct fid *fid, |