diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/device.h | 12 | ||||
| -rw-r--r-- | include/linux/dst.h | 587 | ||||
| -rw-r--r-- | include/linux/ext3_fs_sb.h | 2 | ||||
| -rw-r--r-- | include/linux/ext3_jbd.h | 7 | ||||
| -rw-r--r-- | include/linux/fs.h | 1 | ||||
| -rw-r--r-- | include/linux/kfifo.h | 31 | ||||
| -rw-r--r-- | include/linux/quota.h | 5 | ||||
| -rw-r--r-- | include/linux/sysfs.h | 9 |
8 files changed, 37 insertions, 617 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index 2a73d9bcbc9c..a62799f2ab00 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -166,9 +166,9 @@ struct driver_attribute driver_attr_##_name = \ | |||
| 166 | __ATTR(_name, _mode, _show, _store) | 166 | __ATTR(_name, _mode, _show, _store) |
| 167 | 167 | ||
| 168 | extern int __must_check driver_create_file(struct device_driver *driver, | 168 | extern int __must_check driver_create_file(struct device_driver *driver, |
| 169 | struct driver_attribute *attr); | 169 | const struct driver_attribute *attr); |
| 170 | extern void driver_remove_file(struct device_driver *driver, | 170 | extern void driver_remove_file(struct device_driver *driver, |
| 171 | struct driver_attribute *attr); | 171 | const struct driver_attribute *attr); |
| 172 | 172 | ||
| 173 | extern int __must_check driver_add_kobj(struct device_driver *drv, | 173 | extern int __must_check driver_add_kobj(struct device_driver *drv, |
| 174 | struct kobject *kobj, | 174 | struct kobject *kobj, |
| @@ -319,13 +319,13 @@ struct device_attribute { | |||
| 319 | struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) | 319 | struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) |
| 320 | 320 | ||
| 321 | extern int __must_check device_create_file(struct device *device, | 321 | extern int __must_check device_create_file(struct device *device, |
| 322 | struct device_attribute *entry); | 322 | const struct device_attribute *entry); |
| 323 | extern void device_remove_file(struct device *dev, | 323 | extern void device_remove_file(struct device *dev, |
| 324 | struct device_attribute *attr); | 324 | const struct device_attribute *attr); |
| 325 | extern int __must_check device_create_bin_file(struct device *dev, | 325 | extern int __must_check device_create_bin_file(struct device *dev, |
| 326 | struct bin_attribute *attr); | 326 | const struct bin_attribute *attr); |
| 327 | extern void device_remove_bin_file(struct device *dev, | 327 | extern void device_remove_bin_file(struct device *dev, |
| 328 | struct bin_attribute *attr); | 328 | const struct bin_attribute *attr); |
| 329 | extern int device_schedule_callback_owner(struct device *dev, | 329 | extern int device_schedule_callback_owner(struct device *dev, |
| 330 | void (*func)(struct device *dev), struct module *owner); | 330 | void (*func)(struct device *dev), struct module *owner); |
| 331 | 331 | ||
diff --git a/include/linux/dst.h b/include/linux/dst.h deleted file mode 100644 index e26fed84b1aa..000000000000 --- a/include/linux/dst.h +++ /dev/null | |||
| @@ -1,587 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * 2007+ Copyright (c) Evgeniy Polyakov <johnpol@2ka.mipt.ru> | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation; either version 2 of the License, or | ||
| 8 | * (at your option) any later version. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | */ | ||
| 15 | |||
| 16 | #ifndef __DST_H | ||
| 17 | #define __DST_H | ||
| 18 | |||
| 19 | #include <linux/types.h> | ||
| 20 | #include <linux/connector.h> | ||
| 21 | |||
| 22 | #define DST_NAMELEN 32 | ||
| 23 | #define DST_NAME "dst" | ||
| 24 | |||
| 25 | enum { | ||
| 26 | /* Remove node with given id from storage */ | ||
| 27 | DST_DEL_NODE = 0, | ||
| 28 | /* Add remote node with given id to the storage */ | ||
| 29 | DST_ADD_REMOTE, | ||
| 30 | /* Add local node with given id to the storage to be exported and used by remote peers */ | ||
| 31 | DST_ADD_EXPORT, | ||
| 32 | /* Crypto initialization command (hash/cipher used to protect the connection) */ | ||
| 33 | DST_CRYPTO, | ||
| 34 | /* Security attributes for given connection (permissions for example) */ | ||
| 35 | DST_SECURITY, | ||
| 36 | /* Register given node in the block layer subsystem */ | ||
| 37 | DST_START, | ||
| 38 | DST_CMD_MAX | ||
| 39 | }; | ||
| 40 | |||
| 41 | struct dst_ctl | ||
| 42 | { | ||
| 43 | /* Storage name */ | ||
| 44 | char name[DST_NAMELEN]; | ||
| 45 | /* Command flags */ | ||
| 46 | __u32 flags; | ||
| 47 | /* Command itself (see above) */ | ||
| 48 | __u32 cmd; | ||
| 49 | /* Maximum number of pages per single request in this device */ | ||
| 50 | __u32 max_pages; | ||
| 51 | /* Stale/error transaction scanning timeout in milliseconds */ | ||
| 52 | __u32 trans_scan_timeout; | ||
| 53 | /* Maximum number of retry sends before completing transaction as broken */ | ||
| 54 | __u32 trans_max_retries; | ||
| 55 | /* Storage size */ | ||
| 56 | __u64 size; | ||
| 57 | }; | ||
| 58 | |||
| 59 | /* Reply command carries completion status */ | ||
| 60 | struct dst_ctl_ack | ||
| 61 | { | ||
| 62 | struct cn_msg msg; | ||
| 63 | int error; | ||
| 64 | int unused[3]; | ||
| 65 | }; | ||
| 66 | |||
| 67 | /* | ||
| 68 | * Unfortunaltely socket address structure is not exported to userspace | ||
| 69 | * and is redefined there. | ||
| 70 | */ | ||
| 71 | #define SADDR_MAX_DATA 128 | ||
| 72 | |||
| 73 | struct saddr { | ||
| 74 | /* address family, AF_xxx */ | ||
| 75 | unsigned short sa_family; | ||
| 76 | /* 14 bytes of protocol address */ | ||
| 77 | char sa_data[SADDR_MAX_DATA]; | ||
| 78 | /* Number of bytes used in sa_data */ | ||
| 79 | unsigned short sa_data_len; | ||
| 80 | }; | ||
| 81 | |||
| 82 | /* Address structure */ | ||
| 83 | struct dst_network_ctl | ||
| 84 | { | ||
| 85 | /* Socket type: datagram, stream...*/ | ||
| 86 | unsigned int type; | ||
| 87 | /* Let me guess, is it a Jupiter diameter? */ | ||
| 88 | unsigned int proto; | ||
| 89 | /* Peer's address */ | ||
| 90 | struct saddr addr; | ||
| 91 | }; | ||
| 92 | |||
| 93 | struct dst_crypto_ctl | ||
| 94 | { | ||
| 95 | /* Cipher and hash names */ | ||
| 96 | char cipher_algo[DST_NAMELEN]; | ||
| 97 | char hash_algo[DST_NAMELEN]; | ||
| 98 | |||
| 99 | /* Key sizes. Can be zero for digest for example */ | ||
| 100 | unsigned int cipher_keysize, hash_keysize; | ||
| 101 | /* Alignment. Calculated by the DST itself. */ | ||
| 102 | unsigned int crypto_attached_size; | ||
| 103 | /* Number of threads to perform crypto operations */ | ||
| 104 | int thread_num; | ||
| 105 | }; | ||
| 106 | |||
| 107 | /* Export security attributes have this bits checked in when client connects */ | ||
| 108 | #define DST_PERM_READ (1<<0) | ||
| 109 | #define DST_PERM_WRITE (1<<1) | ||
| 110 | |||
| 111 | /* | ||
| 112 | * Right now it is simple model, where each remote address | ||
| 113 | * is assigned to set of permissions it is allowed to perform. | ||
| 114 | * In real world block device does not know anything but | ||
| 115 | * reading and writing, so it should be more than enough. | ||
| 116 | */ | ||
| 117 | struct dst_secure_user | ||
| 118 | { | ||
| 119 | unsigned int permissions; | ||
| 120 | struct saddr addr; | ||
| 121 | }; | ||
| 122 | |||
| 123 | /* | ||
| 124 | * Export control command: device to export and network address to accept | ||
| 125 | * clients to work with given device | ||
| 126 | */ | ||
| 127 | struct dst_export_ctl | ||
| 128 | { | ||
| 129 | char device[DST_NAMELEN]; | ||
| 130 | struct dst_network_ctl ctl; | ||
| 131 | }; | ||
| 132 | |||
| 133 | enum { | ||
| 134 | DST_CFG = 1, /* Request remote configuration */ | ||
| 135 | DST_IO, /* IO command */ | ||
| 136 | DST_IO_RESPONSE, /* IO response */ | ||
| 137 | DST_PING, /* Keepalive message */ | ||
| 138 | DST_NCMD_MAX, | ||
| 139 | }; | ||
| 140 | |||
| 141 | struct dst_cmd | ||
| 142 | { | ||
| 143 | /* Network command itself, see above */ | ||
| 144 | __u32 cmd; | ||
| 145 | /* | ||
| 146 | * Size of the attached data | ||
| 147 | * (in most cases, for READ command it means how many bytes were requested) | ||
| 148 | */ | ||
| 149 | __u32 size; | ||
| 150 | /* Crypto size: number of attached bytes with digest/hmac */ | ||
| 151 | __u32 csize; | ||
| 152 | /* Here we can carry secret data */ | ||
| 153 | __u32 reserved; | ||
| 154 | /* Read/write bits, see how they are encoded in bio structure */ | ||
| 155 | __u64 rw; | ||
| 156 | /* BIO flags */ | ||
| 157 | __u64 flags; | ||
| 158 | /* Unique command id (like transaction ID) */ | ||
| 159 | __u64 id; | ||
| 160 | /* Sector to start IO from */ | ||
| 161 | __u64 sector; | ||
| 162 | /* Hash data is placed after this header */ | ||
| 163 | __u8 hash[0]; | ||
| 164 | }; | ||
| 165 | |||
| 166 | /* | ||
| 167 | * Convert command to/from network byte order. | ||
| 168 | * We do not use hton*() functions, since there is | ||
| 169 | * no 64-bit implementation. | ||
| 170 | */ | ||
| 171 | static inline void dst_convert_cmd(struct dst_cmd *c) | ||
| 172 | { | ||
| 173 | c->cmd = __cpu_to_be32(c->cmd); | ||
| 174 | c->csize = __cpu_to_be32(c->csize); | ||
| 175 | c->size = __cpu_to_be32(c->size); | ||
| 176 | c->sector = __cpu_to_be64(c->sector); | ||
| 177 | c->id = __cpu_to_be64(c->id); | ||
| 178 | c->flags = __cpu_to_be64(c->flags); | ||
| 179 | c->rw = __cpu_to_be64(c->rw); | ||
| 180 | } | ||
| 181 | |||
| 182 | /* Transaction id */ | ||
| 183 | typedef __u64 dst_gen_t; | ||
| 184 | |||
| 185 | #ifdef __KERNEL__ | ||
| 186 | |||
| 187 | #include <linux/blkdev.h> | ||
| 188 | #include <linux/bio.h> | ||
| 189 | #include <linux/device.h> | ||
| 190 | #include <linux/mempool.h> | ||
| 191 | #include <linux/net.h> | ||
| 192 | #include <linux/poll.h> | ||
| 193 | #include <linux/rbtree.h> | ||
| 194 | |||
| 195 | #ifdef CONFIG_DST_DEBUG | ||
| 196 | #define dprintk(f, a...) printk(KERN_NOTICE f, ##a) | ||
| 197 | #else | ||
| 198 | static inline void __attribute__ ((format (printf, 1, 2))) | ||
| 199 | dprintk(const char *fmt, ...) {} | ||
| 200 | #endif | ||
| 201 | |||
| 202 | struct dst_node; | ||
| 203 | |||
| 204 | struct dst_trans | ||
| 205 | { | ||
| 206 | /* DST node we are working with */ | ||
| 207 | struct dst_node *n; | ||
| 208 | |||
| 209 | /* Entry inside transaction tree */ | ||
| 210 | struct rb_node trans_entry; | ||
| 211 | |||
| 212 | /* Merlin kills this transaction when this memory cell equals zero */ | ||
| 213 | atomic_t refcnt; | ||
| 214 | |||
| 215 | /* How this transaction should be processed by crypto engine */ | ||
| 216 | short enc; | ||
| 217 | /* How many times this transaction was resent */ | ||
| 218 | short retries; | ||
| 219 | /* Completion status */ | ||
| 220 | int error; | ||
| 221 | |||
| 222 | /* When did we send it to the remote peer */ | ||
| 223 | long send_time; | ||
| 224 | |||
| 225 | /* My name is... | ||
| 226 | * Well, computers does not speak, they have unique id instead */ | ||
| 227 | dst_gen_t gen; | ||
| 228 | |||
| 229 | /* Block IO we are working with */ | ||
| 230 | struct bio *bio; | ||
| 231 | |||
| 232 | /* Network command for above block IO request */ | ||
| 233 | struct dst_cmd cmd; | ||
| 234 | }; | ||
| 235 | |||
| 236 | struct dst_crypto_engine | ||
| 237 | { | ||
| 238 | /* What should we do with all block requests */ | ||
| 239 | struct crypto_hash *hash; | ||
| 240 | struct crypto_ablkcipher *cipher; | ||
| 241 | |||
| 242 | /* Pool of pages used to encrypt data into before sending */ | ||
| 243 | int page_num; | ||
| 244 | struct page **pages; | ||
| 245 | |||
| 246 | /* What to do with current request */ | ||
| 247 | int enc; | ||
| 248 | /* Who we are and where do we go */ | ||
| 249 | struct scatterlist *src, *dst; | ||
| 250 | |||
| 251 | /* Maximum timeout waiting for encryption to be completed */ | ||
| 252 | long timeout; | ||
| 253 | /* IV is a 64-bit sequential counter */ | ||
| 254 | u64 iv; | ||
| 255 | |||
| 256 | /* Secret data */ | ||
| 257 | void *private; | ||
| 258 | |||
| 259 | /* Cached temporary data lives here */ | ||
| 260 | int size; | ||
| 261 | void *data; | ||
| 262 | }; | ||
| 263 | |||
| 264 | struct dst_state | ||
| 265 | { | ||
| 266 | /* The main state protection */ | ||
| 267 | struct mutex state_lock; | ||
| 268 | |||
| 269 | /* Polling machinery for sockets */ | ||
| 270 | wait_queue_t wait; | ||
| 271 | wait_queue_head_t *whead; | ||
| 272 | /* Most of events are being waited here */ | ||
| 273 | wait_queue_head_t thread_wait; | ||
| 274 | |||
| 275 | /* Who owns this? */ | ||
| 276 | struct dst_node *node; | ||
| 277 | |||
| 278 | /* Network address for this state */ | ||
| 279 | struct dst_network_ctl ctl; | ||
| 280 | |||
| 281 | /* Permissions to work with: read-only or rw connection */ | ||
| 282 | u32 permissions; | ||
| 283 | |||
| 284 | /* Called when we need to clean private data */ | ||
| 285 | void (* cleanup)(struct dst_state *st); | ||
| 286 | |||
| 287 | /* Used by the server: BIO completion queues BIOs here */ | ||
| 288 | struct list_head request_list; | ||
| 289 | spinlock_t request_lock; | ||
| 290 | |||
| 291 | /* Guess what? No, it is not number of planets */ | ||
| 292 | atomic_t refcnt; | ||
| 293 | |||
| 294 | /* This flags is set when connection should be dropped */ | ||
| 295 | int need_exit; | ||
| 296 | |||
| 297 | /* | ||
| 298 | * Socket to work with. Second pointer is used for | ||
| 299 | * lockless check if socket was changed before performing | ||
| 300 | * next action (like working with cached polling result) | ||
| 301 | */ | ||
| 302 | struct socket *socket, *read_socket; | ||
| 303 | |||
| 304 | /* Cached preallocated data */ | ||
| 305 | void *data; | ||
| 306 | unsigned int size; | ||
| 307 | |||
| 308 | /* Currently processed command */ | ||
| 309 | struct dst_cmd cmd; | ||
| 310 | }; | ||
| 311 | |||
| 312 | struct dst_info | ||
| 313 | { | ||
| 314 | /* Device size */ | ||
| 315 | u64 size; | ||
| 316 | |||
| 317 | /* Local device name for export devices */ | ||
| 318 | char local[DST_NAMELEN]; | ||
| 319 | |||
| 320 | /* Network setup */ | ||
| 321 | struct dst_network_ctl net; | ||
| 322 | |||
| 323 | /* Sysfs bits use this */ | ||
| 324 | struct device device; | ||
| 325 | }; | ||
| 326 | |||
| 327 | struct dst_node | ||
| 328 | { | ||
| 329 | struct list_head node_entry; | ||
| 330 | |||
| 331 | /* Hi, my name is stored here */ | ||
| 332 | char name[DST_NAMELEN]; | ||
| 333 | /* My cache name is stored here */ | ||
| 334 | char cache_name[DST_NAMELEN]; | ||
| 335 | |||
| 336 | /* Block device attached to given node. | ||
| 337 | * Only valid for exporting nodes */ | ||
| 338 | struct block_device *bdev; | ||
| 339 | /* Network state machine for given peer */ | ||
| 340 | struct dst_state *state; | ||
| 341 | |||
| 342 | /* Block IO machinery */ | ||
| 343 | struct request_queue *queue; | ||
| 344 | struct gendisk *disk; | ||
| 345 | |||
| 346 | /* Number of threads in processing pool */ | ||
| 347 | int thread_num; | ||
| 348 | /* Maximum number of pages in single IO */ | ||
| 349 | int max_pages; | ||
| 350 | |||
| 351 | /* I'm that big in bytes */ | ||
| 352 | loff_t size; | ||
| 353 | |||
| 354 | /* Exported to userspace node information */ | ||
| 355 | struct dst_info *info; | ||
| 356 | |||
| 357 | /* | ||
| 358 | * Security attribute list. | ||
| 359 | * Used only by exporting node currently. | ||
| 360 | */ | ||
| 361 | struct list_head security_list; | ||
| 362 | struct mutex security_lock; | ||
| 363 | |||
| 364 | /* | ||
| 365 | * When this unerflows below zero, university collapses. | ||
| 366 | * But this will not happen, since node will be freed, | ||
| 367 | * when reference counter reaches zero. | ||
| 368 | */ | ||
| 369 | atomic_t refcnt; | ||
| 370 | |||
| 371 | /* How precisely should I be started? */ | ||
| 372 | int (*start)(struct dst_node *); | ||
| 373 | |||
| 374 | /* Crypto capabilities */ | ||
| 375 | struct dst_crypto_ctl crypto; | ||
| 376 | u8 *hash_key; | ||
| 377 | u8 *cipher_key; | ||
| 378 | |||
| 379 | /* Pool of processing thread */ | ||
| 380 | struct thread_pool *pool; | ||
| 381 | |||
| 382 | /* Transaction IDs live here */ | ||
| 383 | atomic_long_t gen; | ||
| 384 | |||
| 385 | /* | ||
| 386 | * How frequently and how many times transaction | ||
| 387 | * tree should be scanned to drop stale objects. | ||
| 388 | */ | ||
| 389 | long trans_scan_timeout; | ||
| 390 | int trans_max_retries; | ||
| 391 | |||
| 392 | /* Small gnomes live here */ | ||
| 393 | struct rb_root trans_root; | ||
| 394 | struct mutex trans_lock; | ||
| 395 | |||
| 396 | /* | ||
| 397 | * Transaction cache/memory pool. | ||
| 398 | * It is big enough to contain not only transaction | ||
| 399 | * itself, but additional crypto data (digest/hmac). | ||
| 400 | */ | ||
| 401 | struct kmem_cache *trans_cache; | ||
| 402 | mempool_t *trans_pool; | ||
| 403 | |||
| 404 | /* This entity scans transaction tree */ | ||
| 405 | struct delayed_work trans_work; | ||
| 406 | |||
| 407 | wait_queue_head_t wait; | ||
| 408 | }; | ||
| 409 | |||
| 410 | /* Kernel representation of the security attribute */ | ||
| 411 | struct dst_secure | ||
| 412 | { | ||
| 413 | struct list_head sec_entry; | ||
| 414 | struct dst_secure_user sec; | ||
| 415 | }; | ||
| 416 | |||
| 417 | int dst_process_bio(struct dst_node *n, struct bio *bio); | ||
| 418 | |||
| 419 | int dst_node_init_connected(struct dst_node *n, struct dst_network_ctl *r); | ||
| 420 | int dst_node_init_listened(struct dst_node *n, struct dst_export_ctl *le); | ||
| 421 | |||
| 422 | static inline struct dst_state *dst_state_get(struct dst_state *st) | ||
| 423 | { | ||
| 424 | BUG_ON(atomic_read(&st->refcnt) == 0); | ||
| 425 | atomic_inc(&st->refcnt); | ||
| 426 | return st; | ||
| 427 | } | ||
| 428 | |||
| 429 | void dst_state_put(struct dst_state *st); | ||
| 430 | |||
| 431 | struct dst_state *dst_state_alloc(struct dst_node *n); | ||
| 432 | int dst_state_socket_create(struct dst_state *st); | ||
| 433 | void dst_state_socket_release(struct dst_state *st); | ||
| 434 | |||
| 435 | void dst_state_exit_connected(struct dst_state *st); | ||
| 436 | |||
| 437 | int dst_state_schedule_receiver(struct dst_state *st); | ||
| 438 | |||
| 439 | void dst_dump_addr(struct socket *sk, struct sockaddr *sa, char *str); | ||
| 440 | |||
| 441 | static inline void dst_state_lock(struct dst_state *st) | ||
| 442 | { | ||
| 443 | mutex_lock(&st->state_lock); | ||
| 444 | } | ||
| 445 | |||
| 446 | static inline void dst_state_unlock(struct dst_state *st) | ||
| 447 | { | ||
| 448 | mutex_unlock(&st->state_lock); | ||
| 449 | } | ||
| 450 | |||
| 451 | void dst_poll_exit(struct dst_state *st); | ||
| 452 | int dst_poll_init(struct dst_state *st); | ||
| 453 | |||
| 454 | static inline unsigned int dst_state_poll(struct dst_state *st) | ||
| 455 | { | ||
| 456 | unsigned int revents = POLLHUP | POLLERR; | ||
| 457 | |||
| 458 | dst_state_lock(st); | ||
| 459 | if (st->socket) | ||
| 460 | revents = st->socket->ops->poll(NULL, st->socket, NULL); | ||
| 461 | dst_state_unlock(st); | ||
| 462 | |||
| 463 | return revents; | ||
| 464 | } | ||
| 465 | |||
| 466 | static inline int dst_thread_setup(void *private, void *data) | ||
| 467 | { | ||
| 468 | return 0; | ||
| 469 | } | ||
| 470 | |||
| 471 | void dst_node_put(struct dst_node *n); | ||
| 472 | |||
| 473 | static inline struct dst_node *dst_node_get(struct dst_node *n) | ||
| 474 | { | ||
| 475 | atomic_inc(&n->refcnt); | ||
| 476 | return n; | ||
| 477 | } | ||
| 478 | |||
| 479 | int dst_data_recv(struct dst_state *st, void *data, unsigned int size); | ||
| 480 | int dst_recv_cdata(struct dst_state *st, void *cdata); | ||
| 481 | int dst_data_send_header(struct socket *sock, | ||
| 482 | void *data, unsigned int size, int more); | ||
| 483 | |||
| 484 | int dst_send_bio(struct dst_state *st, struct dst_cmd *cmd, struct bio *bio); | ||
| 485 | |||
| 486 | int dst_process_io(struct dst_state *st); | ||
| 487 | int dst_export_crypto(struct dst_node *n, struct bio *bio); | ||
| 488 | int dst_export_send_bio(struct bio *bio); | ||
| 489 | int dst_start_export(struct dst_node *n); | ||
| 490 | |||
| 491 | int __init dst_export_init(void); | ||
| 492 | void dst_export_exit(void); | ||
| 493 | |||
| 494 | /* Private structure for export block IO requests */ | ||
| 495 | struct dst_export_priv | ||
| 496 | { | ||
| 497 | struct list_head request_entry; | ||
| 498 | struct dst_state *state; | ||
| 499 | struct bio *bio; | ||
| 500 | struct dst_cmd cmd; | ||
| 501 | }; | ||
| 502 | |||
| 503 | static inline void dst_trans_get(struct dst_trans *t) | ||
| 504 | { | ||
| 505 | atomic_inc(&t->refcnt); | ||
| 506 | } | ||
| 507 | |||
| 508 | struct dst_trans *dst_trans_search(struct dst_node *node, dst_gen_t gen); | ||
| 509 | int dst_trans_remove(struct dst_trans *t); | ||
| 510 | int dst_trans_remove_nolock(struct dst_trans *t); | ||
| 511 | void dst_trans_put(struct dst_trans *t); | ||
| 512 | |||
| 513 | /* | ||
| 514 | * Convert bio into network command. | ||
| 515 | */ | ||
| 516 | static inline void dst_bio_to_cmd(struct bio *bio, struct dst_cmd *cmd, | ||
| 517 | u32 command, u64 id) | ||
| 518 | { | ||
| 519 | cmd->cmd = command; | ||
| 520 | cmd->flags = (bio->bi_flags << BIO_POOL_BITS) >> BIO_POOL_BITS; | ||
| 521 | cmd->rw = bio->bi_rw; | ||
| 522 | cmd->size = bio->bi_size; | ||
| 523 | cmd->csize = 0; | ||
| 524 | cmd->id = id; | ||
| 525 | cmd->sector = bio->bi_sector; | ||
| 526 | }; | ||
| 527 | |||
| 528 | int dst_trans_send(struct dst_trans *t); | ||
| 529 | int dst_trans_crypto(struct dst_trans *t); | ||
| 530 | |||
| 531 | int dst_node_crypto_init(struct dst_node *n, struct dst_crypto_ctl *ctl); | ||
| 532 | void dst_node_crypto_exit(struct dst_node *n); | ||
| 533 | |||
| 534 | static inline int dst_need_crypto(struct dst_node *n) | ||
| 535 | { | ||
| 536 | struct dst_crypto_ctl *c = &n->crypto; | ||
| 537 | /* | ||
| 538 | * Logical OR is appropriate here, but boolean one produces | ||
| 539 | * more optimal code, so it is used instead. | ||
| 540 | */ | ||
| 541 | return (c->hash_algo[0] | c->cipher_algo[0]); | ||
| 542 | } | ||
| 543 | |||
| 544 | int dst_node_trans_init(struct dst_node *n, unsigned int size); | ||
| 545 | void dst_node_trans_exit(struct dst_node *n); | ||
| 546 | |||
| 547 | /* | ||
| 548 | * Pool of threads. | ||
| 549 | * Ready list contains threads currently free to be used, | ||
| 550 | * active one contains threads with some work scheduled for them. | ||
| 551 | * Caller can wait in given queue when thread is ready. | ||
| 552 | */ | ||
| 553 | struct thread_pool | ||
| 554 | { | ||
| 555 | int thread_num; | ||
| 556 | struct mutex thread_lock; | ||
| 557 | struct list_head ready_list, active_list; | ||
| 558 | |||
| 559 | wait_queue_head_t wait; | ||
| 560 | }; | ||
| 561 | |||
| 562 | void thread_pool_del_worker(struct thread_pool *p); | ||
| 563 | void thread_pool_del_worker_id(struct thread_pool *p, unsigned int id); | ||
| 564 | int thread_pool_add_worker(struct thread_pool *p, | ||
| 565 | char *name, | ||
| 566 | unsigned int id, | ||
| 567 | void *(* init)(void *data), | ||
| 568 | void (* cleanup)(void *data), | ||
| 569 | void *data); | ||
| 570 | |||
| 571 | void thread_pool_destroy(struct thread_pool *p); | ||
| 572 | struct thread_pool *thread_pool_create(int num, char *name, | ||
| 573 | void *(* init)(void *data), | ||
| 574 | void (* cleanup)(void *data), | ||
| 575 | void *data); | ||
| 576 | |||
| 577 | int thread_pool_schedule(struct thread_pool *p, | ||
| 578 | int (* setup)(void *stored_private, void *setup_data), | ||
| 579 | int (* action)(void *stored_private, void *setup_data), | ||
| 580 | void *setup_data, long timeout); | ||
| 581 | int thread_pool_schedule_private(struct thread_pool *p, | ||
| 582 | int (* setup)(void *private, void *data), | ||
| 583 | int (* action)(void *private, void *data), | ||
| 584 | void *data, long timeout, void *id); | ||
| 585 | |||
| 586 | #endif /* __KERNEL__ */ | ||
| 587 | #endif /* __DST_H */ | ||
diff --git a/include/linux/ext3_fs_sb.h b/include/linux/ext3_fs_sb.h index f07f34de2f0e..258088ab3c6b 100644 --- a/include/linux/ext3_fs_sb.h +++ b/include/linux/ext3_fs_sb.h | |||
| @@ -72,6 +72,8 @@ struct ext3_sb_info { | |||
| 72 | struct inode * s_journal_inode; | 72 | struct inode * s_journal_inode; |
| 73 | struct journal_s * s_journal; | 73 | struct journal_s * s_journal; |
| 74 | struct list_head s_orphan; | 74 | struct list_head s_orphan; |
| 75 | struct mutex s_orphan_lock; | ||
| 76 | struct mutex s_resize_lock; | ||
| 75 | unsigned long s_commit_interval; | 77 | unsigned long s_commit_interval; |
| 76 | struct block_device *journal_bdev; | 78 | struct block_device *journal_bdev; |
| 77 | #ifdef CONFIG_JBD_DEBUG | 79 | #ifdef CONFIG_JBD_DEBUG |
diff --git a/include/linux/ext3_jbd.h b/include/linux/ext3_jbd.h index cf82d519be40..d7b5ddca99c2 100644 --- a/include/linux/ext3_jbd.h +++ b/include/linux/ext3_jbd.h | |||
| @@ -44,13 +44,13 @@ | |||
| 44 | 44 | ||
| 45 | #define EXT3_DATA_TRANS_BLOCKS(sb) (EXT3_SINGLEDATA_TRANS_BLOCKS + \ | 45 | #define EXT3_DATA_TRANS_BLOCKS(sb) (EXT3_SINGLEDATA_TRANS_BLOCKS + \ |
| 46 | EXT3_XATTR_TRANS_BLOCKS - 2 + \ | 46 | EXT3_XATTR_TRANS_BLOCKS - 2 + \ |
| 47 | 2*EXT3_QUOTA_TRANS_BLOCKS(sb)) | 47 | EXT3_MAXQUOTAS_TRANS_BLOCKS(sb)) |
| 48 | 48 | ||
| 49 | /* Delete operations potentially hit one directory's namespace plus an | 49 | /* Delete operations potentially hit one directory's namespace plus an |
| 50 | * entire inode, plus arbitrary amounts of bitmap/indirection data. Be | 50 | * entire inode, plus arbitrary amounts of bitmap/indirection data. Be |
| 51 | * generous. We can grow the delete transaction later if necessary. */ | 51 | * generous. We can grow the delete transaction later if necessary. */ |
| 52 | 52 | ||
| 53 | #define EXT3_DELETE_TRANS_BLOCKS(sb) (2 * EXT3_DATA_TRANS_BLOCKS(sb) + 64) | 53 | #define EXT3_DELETE_TRANS_BLOCKS(sb) (EXT3_MAXQUOTAS_TRANS_BLOCKS(sb) + 64) |
| 54 | 54 | ||
| 55 | /* Define an arbitrary limit for the amount of data we will anticipate | 55 | /* Define an arbitrary limit for the amount of data we will anticipate |
| 56 | * writing to any given transaction. For unbounded transactions such as | 56 | * writing to any given transaction. For unbounded transactions such as |
| @@ -86,6 +86,9 @@ | |||
| 86 | #define EXT3_QUOTA_INIT_BLOCKS(sb) 0 | 86 | #define EXT3_QUOTA_INIT_BLOCKS(sb) 0 |
| 87 | #define EXT3_QUOTA_DEL_BLOCKS(sb) 0 | 87 | #define EXT3_QUOTA_DEL_BLOCKS(sb) 0 |
| 88 | #endif | 88 | #endif |
| 89 | #define EXT3_MAXQUOTAS_TRANS_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_TRANS_BLOCKS(sb)) | ||
| 90 | #define EXT3_MAXQUOTAS_INIT_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_INIT_BLOCKS(sb)) | ||
| 91 | #define EXT3_MAXQUOTAS_DEL_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_DEL_BLOCKS(sb)) | ||
| 89 | 92 | ||
| 90 | int | 93 | int |
| 91 | ext3_mark_iloc_dirty(handle_t *handle, | 94 | ext3_mark_iloc_dirty(handle_t *handle, |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 7e3012e0ac06..9147ca88f253 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -2297,6 +2297,7 @@ extern const struct inode_operations page_symlink_inode_operations; | |||
| 2297 | extern int generic_readlink(struct dentry *, char __user *, int); | 2297 | extern int generic_readlink(struct dentry *, char __user *, int); |
| 2298 | extern void generic_fillattr(struct inode *, struct kstat *); | 2298 | extern void generic_fillattr(struct inode *, struct kstat *); |
| 2299 | extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); | 2299 | extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); |
| 2300 | void __inode_add_bytes(struct inode *inode, loff_t bytes); | ||
| 2300 | void inode_add_bytes(struct inode *inode, loff_t bytes); | 2301 | void inode_add_bytes(struct inode *inode, loff_t bytes); |
| 2301 | void inode_sub_bytes(struct inode *inode, loff_t bytes); | 2302 | void inode_sub_bytes(struct inode *inode, loff_t bytes); |
| 2302 | loff_t inode_get_bytes(struct inode *inode); | 2303 | loff_t inode_get_bytes(struct inode *inode); |
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h index 486e8ad3bb50..3d44e9c65a8e 100644 --- a/include/linux/kfifo.h +++ b/include/linux/kfifo.h | |||
| @@ -69,8 +69,8 @@ struct kfifo { | |||
| 69 | * @name: name of the declared kfifo datatype | 69 | * @name: name of the declared kfifo datatype |
| 70 | * @size: size of the fifo buffer | 70 | * @size: size of the fifo buffer |
| 71 | * | 71 | * |
| 72 | * Note: the macro can be used inside struct or union declaration | 72 | * Note1: the macro can be used inside struct or union declaration |
| 73 | * Note: the macro creates two objects: | 73 | * Note2: the macro creates two objects: |
| 74 | * A kfifo object with the given name and a buffer for the kfifo | 74 | * A kfifo object with the given name and a buffer for the kfifo |
| 75 | * object named name##kfifo_buffer | 75 | * object named name##kfifo_buffer |
| 76 | */ | 76 | */ |
| @@ -83,7 +83,6 @@ union { \ | |||
| 83 | /** | 83 | /** |
| 84 | * INIT_KFIFO - Initialize a kfifo declared by DECLARED_KFIFO | 84 | * INIT_KFIFO - Initialize a kfifo declared by DECLARED_KFIFO |
| 85 | * @name: name of the declared kfifo datatype | 85 | * @name: name of the declared kfifo datatype |
| 86 | * @size: size of the fifo buffer | ||
| 87 | */ | 86 | */ |
| 88 | #define INIT_KFIFO(name) \ | 87 | #define INIT_KFIFO(name) \ |
| 89 | name = __kfifo_initializer(sizeof(name##kfifo_buffer) - \ | 88 | name = __kfifo_initializer(sizeof(name##kfifo_buffer) - \ |
| @@ -94,8 +93,8 @@ union { \ | |||
| 94 | * @name: name of the declared kfifo datatype | 93 | * @name: name of the declared kfifo datatype |
| 95 | * @size: size of the fifo buffer | 94 | * @size: size of the fifo buffer |
| 96 | * | 95 | * |
| 97 | * Note: the macro can be used for global and local kfifo data type variables | 96 | * Note1: the macro can be used for global and local kfifo data type variables |
| 98 | * Note: the macro creates two objects: | 97 | * Note2: the macro creates two objects: |
| 99 | * A kfifo object with the given name and a buffer for the kfifo | 98 | * A kfifo object with the given name and a buffer for the kfifo |
| 100 | * object named name##kfifo_buffer | 99 | * object named name##kfifo_buffer |
| 101 | */ | 100 | */ |
| @@ -249,7 +248,7 @@ extern __must_check unsigned int kfifo_from_user(struct kfifo *fifo, | |||
| 249 | extern __must_check unsigned int kfifo_to_user(struct kfifo *fifo, | 248 | extern __must_check unsigned int kfifo_to_user(struct kfifo *fifo, |
| 250 | void __user *to, unsigned int n); | 249 | void __user *to, unsigned int n); |
| 251 | 250 | ||
| 252 | /** | 251 | /* |
| 253 | * __kfifo_add_out internal helper function for updating the out offset | 252 | * __kfifo_add_out internal helper function for updating the out offset |
| 254 | */ | 253 | */ |
| 255 | static inline void __kfifo_add_out(struct kfifo *fifo, | 254 | static inline void __kfifo_add_out(struct kfifo *fifo, |
| @@ -259,7 +258,7 @@ static inline void __kfifo_add_out(struct kfifo *fifo, | |||
| 259 | fifo->out += off; | 258 | fifo->out += off; |
| 260 | } | 259 | } |
| 261 | 260 | ||
| 262 | /** | 261 | /* |
| 263 | * __kfifo_add_in internal helper function for updating the in offset | 262 | * __kfifo_add_in internal helper function for updating the in offset |
| 264 | */ | 263 | */ |
| 265 | static inline void __kfifo_add_in(struct kfifo *fifo, | 264 | static inline void __kfifo_add_in(struct kfifo *fifo, |
| @@ -269,7 +268,7 @@ static inline void __kfifo_add_in(struct kfifo *fifo, | |||
| 269 | fifo->in += off; | 268 | fifo->in += off; |
| 270 | } | 269 | } |
| 271 | 270 | ||
| 272 | /** | 271 | /* |
| 273 | * __kfifo_off internal helper function for calculating the index of a | 272 | * __kfifo_off internal helper function for calculating the index of a |
| 274 | * given offeset | 273 | * given offeset |
| 275 | */ | 274 | */ |
| @@ -278,7 +277,7 @@ static inline unsigned int __kfifo_off(struct kfifo *fifo, unsigned int off) | |||
| 278 | return off & (fifo->size - 1); | 277 | return off & (fifo->size - 1); |
| 279 | } | 278 | } |
| 280 | 279 | ||
| 281 | /** | 280 | /* |
| 282 | * __kfifo_peek_n internal helper function for determinate the length of | 281 | * __kfifo_peek_n internal helper function for determinate the length of |
| 283 | * the next record in the fifo | 282 | * the next record in the fifo |
| 284 | */ | 283 | */ |
| @@ -299,7 +298,7 @@ static inline unsigned int __kfifo_peek_n(struct kfifo *fifo, | |||
| 299 | #undef __KFIFO_GET | 298 | #undef __KFIFO_GET |
| 300 | } | 299 | } |
| 301 | 300 | ||
| 302 | /** | 301 | /* |
| 303 | * __kfifo_poke_n internal helper function for storing the length of | 302 | * __kfifo_poke_n internal helper function for storing the length of |
| 304 | * the next record into the fifo | 303 | * the next record into the fifo |
| 305 | */ | 304 | */ |
| @@ -319,7 +318,7 @@ static inline void __kfifo_poke_n(struct kfifo *fifo, | |||
| 319 | #undef __KFIFO_PUT | 318 | #undef __KFIFO_PUT |
| 320 | } | 319 | } |
| 321 | 320 | ||
| 322 | /** | 321 | /* |
| 323 | * __kfifo_in_... internal functions for put date into the fifo | 322 | * __kfifo_in_... internal functions for put date into the fifo |
| 324 | * do not call it directly, use kfifo_in_rec() instead | 323 | * do not call it directly, use kfifo_in_rec() instead |
| 325 | */ | 324 | */ |
| @@ -367,7 +366,7 @@ static inline __must_check unsigned int kfifo_in_rec(struct kfifo *fifo, | |||
| 367 | return __kfifo_in_rec(fifo, from, n, recsize); | 366 | return __kfifo_in_rec(fifo, from, n, recsize); |
| 368 | } | 367 | } |
| 369 | 368 | ||
| 370 | /** | 369 | /* |
| 371 | * __kfifo_out_... internal functions for get date from the fifo | 370 | * __kfifo_out_... internal functions for get date from the fifo |
| 372 | * do not call it directly, use kfifo_out_rec() instead | 371 | * do not call it directly, use kfifo_out_rec() instead |
| 373 | */ | 372 | */ |
| @@ -425,7 +424,7 @@ static inline __must_check unsigned int kfifo_out_rec(struct kfifo *fifo, | |||
| 425 | return __kfifo_out_rec(fifo, to, n, recsize, total); | 424 | return __kfifo_out_rec(fifo, to, n, recsize, total); |
| 426 | } | 425 | } |
| 427 | 426 | ||
| 428 | /** | 427 | /* |
| 429 | * __kfifo_from_user_... internal functions for transfer from user space into | 428 | * __kfifo_from_user_... internal functions for transfer from user space into |
| 430 | * the fifo. do not call it directly, use kfifo_from_user_rec() instead | 429 | * the fifo. do not call it directly, use kfifo_from_user_rec() instead |
| 431 | */ | 430 | */ |
| @@ -474,7 +473,7 @@ static inline __must_check unsigned int kfifo_from_user_rec(struct kfifo *fifo, | |||
| 474 | return __kfifo_from_user_rec(fifo, from, n, recsize); | 473 | return __kfifo_from_user_rec(fifo, from, n, recsize); |
| 475 | } | 474 | } |
| 476 | 475 | ||
| 477 | /** | 476 | /* |
| 478 | * __kfifo_to_user_... internal functions for transfer fifo data into user space | 477 | * __kfifo_to_user_... internal functions for transfer fifo data into user space |
| 479 | * do not call it directly, use kfifo_to_user_rec() instead | 478 | * do not call it directly, use kfifo_to_user_rec() instead |
| 480 | */ | 479 | */ |
| @@ -533,7 +532,7 @@ static inline __must_check unsigned int kfifo_to_user_rec(struct kfifo *fifo, | |||
| 533 | return __kfifo_to_user_rec(fifo, to, n, recsize, total); | 532 | return __kfifo_to_user_rec(fifo, to, n, recsize, total); |
| 534 | } | 533 | } |
| 535 | 534 | ||
| 536 | /** | 535 | /* |
| 537 | * __kfifo_peek_... internal functions for peek into the next fifo record | 536 | * __kfifo_peek_... internal functions for peek into the next fifo record |
| 538 | * do not call it directly, use kfifo_peek_rec() instead | 537 | * do not call it directly, use kfifo_peek_rec() instead |
| 539 | */ | 538 | */ |
| @@ -557,7 +556,7 @@ static inline __must_check unsigned int kfifo_peek_rec(struct kfifo *fifo, | |||
| 557 | return __kfifo_peek_n(fifo, recsize); | 556 | return __kfifo_peek_n(fifo, recsize); |
| 558 | } | 557 | } |
| 559 | 558 | ||
| 560 | /** | 559 | /* |
| 561 | * __kfifo_skip_... internal functions for skip the next fifo record | 560 | * __kfifo_skip_... internal functions for skip the next fifo record |
| 562 | * do not call it directly, use kfifo_skip_rec() instead | 561 | * do not call it directly, use kfifo_skip_rec() instead |
| 563 | */ | 562 | */ |
diff --git a/include/linux/quota.h b/include/linux/quota.h index e70e62194243..a6861f117480 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h | |||
| @@ -315,8 +315,9 @@ struct dquot_operations { | |||
| 315 | int (*claim_space) (struct inode *, qsize_t); | 315 | int (*claim_space) (struct inode *, qsize_t); |
| 316 | /* release rsved quota for delayed alloc */ | 316 | /* release rsved quota for delayed alloc */ |
| 317 | void (*release_rsv) (struct inode *, qsize_t); | 317 | void (*release_rsv) (struct inode *, qsize_t); |
| 318 | /* get reserved quota for delayed alloc */ | 318 | /* get reserved quota for delayed alloc, value returned is managed by |
| 319 | qsize_t (*get_reserved_space) (struct inode *); | 319 | * quota code only */ |
| 320 | qsize_t *(*get_reserved_space) (struct inode *); | ||
| 320 | }; | 321 | }; |
| 321 | 322 | ||
| 322 | /* Operations handling requests from userspace */ | 323 | /* Operations handling requests from userspace */ |
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 9d68fed50f11..cfa83083a2d4 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
| @@ -99,8 +99,9 @@ int __must_check sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, | |||
| 99 | void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); | 99 | void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); |
| 100 | 100 | ||
| 101 | int __must_check sysfs_create_bin_file(struct kobject *kobj, | 101 | int __must_check sysfs_create_bin_file(struct kobject *kobj, |
| 102 | struct bin_attribute *attr); | 102 | const struct bin_attribute *attr); |
| 103 | void sysfs_remove_bin_file(struct kobject *kobj, struct bin_attribute *attr); | 103 | void sysfs_remove_bin_file(struct kobject *kobj, |
| 104 | const struct bin_attribute *attr); | ||
| 104 | 105 | ||
| 105 | int __must_check sysfs_create_link(struct kobject *kobj, struct kobject *target, | 106 | int __must_check sysfs_create_link(struct kobject *kobj, struct kobject *target, |
| 106 | const char *name); | 107 | const char *name); |
| @@ -175,13 +176,13 @@ static inline void sysfs_remove_file(struct kobject *kobj, | |||
| 175 | } | 176 | } |
| 176 | 177 | ||
| 177 | static inline int sysfs_create_bin_file(struct kobject *kobj, | 178 | static inline int sysfs_create_bin_file(struct kobject *kobj, |
| 178 | struct bin_attribute *attr) | 179 | const struct bin_attribute *attr) |
| 179 | { | 180 | { |
| 180 | return 0; | 181 | return 0; |
| 181 | } | 182 | } |
| 182 | 183 | ||
| 183 | static inline void sysfs_remove_bin_file(struct kobject *kobj, | 184 | static inline void sysfs_remove_bin_file(struct kobject *kobj, |
| 184 | struct bin_attribute *attr) | 185 | const struct bin_attribute *attr) |
| 185 | { | 186 | { |
| 186 | } | 187 | } |
| 187 | 188 | ||
