aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bitmap.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-06-01 11:02:31 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-01 11:02:31 -0400
commit65039a31f4e44630f96f1b602c43cc8ad180d4fe (patch)
tree33d671501970281f3587d97e7aba31c8f2e21cd6 /lib/bitmap.c
parent6e429101849416551150dad451f7e8625317ae09 (diff)
parent6373fffc5d555caf3acf7c5796cec9820aaf7479 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6: sparc64: Fix section attribute warnings. sparc64: Fix SET_PERSONALITY to not clip bits outside of PER_MASK.
Diffstat (limited to 'lib/bitmap.c')
0 files changed, 0 insertions, 0 deletions
292' href='#n292'>292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702
/*
 * Copyright (C) Sistina Software, Inc.  1997-2003 All rights reserved.
 * Copyright (C) 2004-2005 Red Hat, Inc.  All rights reserved.
 *
 * This copyrighted material is made available to anyone wishing to use,
 * modify, copy, or redistribute it subject to the terms and conditions
 * of the GNU General Public License v.2.
 */

#ifndef __INCORE_DOT_H__
#define __INCORE_DOT_H__

#define DIO_FORCE	0x00000001
#define DIO_CLEAN	0x00000002
#define DIO_DIRTY	0x00000004
#define DIO_START	0x00000008
#define DIO_WAIT	0x00000010
#define DIO_METADATA	0x00000020
#define DIO_DATA	0x00000040
#define DIO_RELEASE	0x00000080
#define DIO_ALL		0x00000100

struct gfs2_log_operations;
struct gfs2_log_element;
struct gfs2_bitmap;
struct gfs2_rgrpd;
struct gfs2_bufdata;
struct gfs2_glock_operations;
struct gfs2_holder;
struct gfs2_glock;
struct gfs2_alloc;
struct gfs2_inode;
struct gfs2_file;
struct gfs2_revoke;
struct gfs2_revoke_replay;
struct gfs2_unlinked;
struct gfs2_quota_data;
struct gfs2_log_buf;
struct gfs2_trans;
struct gfs2_ail;
struct gfs2_jdesc;
struct gfs2_args;
struct gfs2_tune;
struct gfs2_gl_hash_bucket;
struct gfs2_sbd;

typedef void (*gfs2_glop_bh_t) (struct gfs2_glock *gl, unsigned int ret);

/*
 * Structure of operations that are associated with each
 * type of element in the log.
 */

struct gfs2_log_operations {
	void (*lo_add) (struct gfs2_sbd *sdp, struct gfs2_log_element *le);
	void (*lo_incore_commit) (struct gfs2_sbd *sdp, struct gfs2_trans *tr);
	void (*lo_before_commit) (struct gfs2_sbd *sdp);
	void (*lo_after_commit) (struct gfs2_sbd *sdp, struct gfs2_ail *ai);
	void (*lo_before_scan) (struct gfs2_jdesc *jd,
				struct gfs2_log_header *head, int pass);
	int (*lo_scan_elements) (struct gfs2_jdesc *jd, unsigned int start,
				 struct gfs2_log_descriptor *ld, __be64 *ptr,
				 int pass);
	void (*lo_after_scan) (struct gfs2_jdesc *jd, int error, int pass);
	char *lo_name;
};

struct gfs2_log_element {
	struct list_head le_list;
	struct gfs2_log_operations *le_ops;
};

struct gfs2_bitmap {
	struct buffer_head *bi_bh;
	char *bi_clone;
	uint32_t bi_offset;
	uint32_t bi_start;
	uint32_t bi_len;
};

struct gfs2_rgrpd {
	struct list_head rd_list;	/* Link with superblock */
	struct list_head rd_list_mru;
	struct list_head rd_recent;	/* Recently used rgrps */
	struct gfs2_glock *rd_gl;	/* Glock for this rgrp */
	struct gfs2_rindex rd_ri;
	struct gfs2_rgrp rd_rg;
	uint64_t rd_rg_vn;
	struct gfs2_bitmap *rd_bits;
	unsigned int rd_bh_count;
	struct semaphore rd_mutex;
	uint32_t rd_free_clone;
	struct gfs2_log_element rd_le;
	uint32_t rd_last_alloc_data;
	uint32_t rd_last_alloc_meta;
	struct gfs2_sbd *rd_sbd;
};

enum gfs2_state_bits {
	BH_Pinned = BH_PrivateStart,
	BH_Escaped = BH_PrivateStart + 1,
};

BUFFER_FNS(Pinned, pinned)
TAS_BUFFER_FNS(Pinned, pinned)
BUFFER_FNS(Escaped, escaped)
TAS_BUFFER_FNS(Escaped, escaped)

struct gfs2_bufdata {
	struct buffer_head *bd_bh;
	struct gfs2_glock *bd_gl;

	struct list_head bd_list_tr;
	struct gfs2_log_element bd_le;

	struct gfs2_ail *bd_ail;
	struct list_head bd_ail_st_list;
	struct list_head bd_ail_gl_list;
};

struct gfs2_glock_operations {
	void (*go_xmote_th) (struct gfs2_glock * gl, unsigned int state,
			     int flags);
	void (*go_xmote_bh) (struct gfs2_glock * gl);
	void (*go_drop_th) (struct gfs2_glock * gl);
	void (*go_drop_bh) (struct gfs2_glock * gl);
	void (*go_sync) (struct gfs2_glock * gl, int flags);
	void (*go_inval) (struct gfs2_glock * gl, int flags);
	int (*go_demote_ok) (struct gfs2_glock * gl);
	int (*go_lock) (struct gfs2_holder * gh);
	void (*go_unlock) (struct gfs2_holder * gh);
	void (*go_callback) (struct gfs2_glock * gl, unsigned int state);
	void (*go_greedy) (struct gfs2_glock * gl);
	int go_type;
};

enum {
	/* Actions */
	HIF_MUTEX		= 0,
	HIF_PROMOTE		= 1,
	HIF_DEMOTE		= 2,
	HIF_GREEDY		= 3,

	/* States */
	HIF_ALLOCED		= 4,
	HIF_DEALLOC		= 5,
	HIF_HOLDER		= 6,
	HIF_FIRST		= 7,
	HIF_RECURSE		= 8,
	HIF_ABORTED		= 9,
};

struct gfs2_holder {
	struct list_head gh_list;

	struct gfs2_glock *gh_gl;
	struct task_struct *gh_owner;
	unsigned int gh_state;
	int gh_flags;

	int gh_error;
	unsigned long gh_iflags;
	struct completion gh_wait;
};

enum {
	GLF_PLUG		= 0,
	GLF_LOCK		= 1,
	GLF_STICKY		= 2,
	GLF_PREFETCH		= 3,
	GLF_SYNC		= 4,
	GLF_DIRTY		= 5,
	GLF_SKIP_WAITERS2	= 6,
	GLF_GREEDY		= 7,
};

struct gfs2_glock {
	struct list_head gl_list;
	unsigned long gl_flags;		/* GLF_... */
	struct lm_lockname gl_name;
	struct kref gl_ref;

	spinlock_t gl_spin;

	unsigned int gl_state;
	struct list_head gl_holders;
	struct list_head gl_waiters1;	/* HIF_MUTEX */
	struct list_head gl_waiters2;	/* HIF_DEMOTE, HIF_GREEDY */
	struct list_head gl_waiters3;	/* HIF_PROMOTE */

	struct gfs2_glock_operations *gl_ops;

	struct gfs2_holder *gl_req_gh;
	gfs2_glop_bh_t gl_req_bh;

	lm_lock_t *gl_lock;
	char *gl_lvb;
	atomic_t gl_lvb_count;

	uint64_t gl_vn;
	unsigned long gl_stamp;
	void *gl_object;

	struct gfs2_gl_hash_bucket *gl_bucket;
	struct list_head gl_reclaim;

	struct gfs2_sbd *gl_sbd;

	struct inode *gl_aspace;
	struct gfs2_log_element gl_le;
	struct list_head gl_ail_list;
	atomic_t gl_ail_count;
};

struct gfs2_alloc {
	/* Quota stuff */

	unsigned int al_qd_num;
	struct gfs2_quota_data *al_qd[4];
	struct gfs2_holder al_qd_ghs[4];

	/* Filled in by the caller to gfs2_inplace_reserve() */

	uint32_t al_requested;

	/* Filled in by gfs2_inplace_reserve() */

	char *al_file;
	unsigned int al_line;
	struct gfs2_holder al_ri_gh;
	struct gfs2_holder al_rgd_gh;
	struct gfs2_rgrpd *al_rgd;

	/* Filled in by gfs2_alloc_*() */

	uint32_t al_alloced;
};

enum {