Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 29676
b: refs/heads/master
c: abf5d15
h: refs/heads/master
v: v3
  • Loading branch information
Evgeniy Dushistov authored and Linus Torvalds committed Jun 25, 2006
1 parent 17ead4c commit 3076604
Show file tree
Hide file tree
Showing 12 changed files with 169 additions and 218 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5afb3145c9a733166174e1f5a07c46410b5c4091
refs/heads/master: abf5d15fd2e52517dd56a17a846d5a1f900b7db4
8 changes: 8 additions & 0 deletions trunk/fs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1375,6 +1375,14 @@ config UFS_FS_WRITE
Say Y here if you want to try writing to UFS partitions. This is
experimental, so you should back up your UFS partitions beforehand.

config UFS_DEBUG
bool "UFS debugging"
depends on UFS_FS
help
If you are experiencing any problems with the UFS filesystem, say
Y here. This will result in _many_ additional debugging messages to be
written to the system log.

endmenu

menu "Network File Systems"
Expand Down
62 changes: 27 additions & 35 deletions trunk/fs/ufs/balloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@
#include "swab.h"
#include "util.h"

#undef UFS_BALLOC_DEBUG

#ifdef UFS_BALLOC_DEBUG
#define UFSD(x) printk("(%s, %d), %s:", __FILE__, __LINE__, __FUNCTION__); printk x;
#else
#define UFSD(x)
#endif

static unsigned ufs_add_fragments (struct inode *, unsigned, unsigned, unsigned, int *);
static unsigned ufs_alloc_fragments (struct inode *, unsigned, unsigned, unsigned, int *);
static unsigned ufs_alloccg_block (struct inode *, struct ufs_cg_private_info *, unsigned, int *);
Expand All @@ -52,7 +44,7 @@ void ufs_free_fragments(struct inode *inode, unsigned fragment, unsigned count)
uspi = UFS_SB(sb)->s_uspi;
usb1 = ubh_get_usb_first(uspi);

UFSD(("ENTER, fragment %u, count %u\n", fragment, count))
UFSD("ENTER, fragment %u, count %u\n", fragment, count);

if (ufs_fragnum(fragment) + count > uspi->s_fpg)
ufs_error (sb, "ufs_free_fragments", "internal error");
Expand Down Expand Up @@ -123,12 +115,12 @@ void ufs_free_fragments(struct inode *inode, unsigned fragment, unsigned count)
sb->s_dirt = 1;

unlock_super (sb);
UFSD(("EXIT\n"))
UFSD("EXIT\n");
return;

failed:
unlock_super (sb);
UFSD(("EXIT (FAILED)\n"))
UFSD("EXIT (FAILED)\n");
return;
}

Expand All @@ -148,7 +140,7 @@ void ufs_free_blocks(struct inode *inode, unsigned fragment, unsigned count)
uspi = UFS_SB(sb)->s_uspi;
usb1 = ubh_get_usb_first(uspi);

UFSD(("ENTER, fragment %u, count %u\n", fragment, count))
UFSD("ENTER, fragment %u, count %u\n", fragment, count);

if ((fragment & uspi->s_fpbmask) || (count & uspi->s_fpbmask)) {
ufs_error (sb, "ufs_free_blocks", "internal error, "
Expand Down Expand Up @@ -215,12 +207,12 @@ void ufs_free_blocks(struct inode *inode, unsigned fragment, unsigned count)

sb->s_dirt = 1;
unlock_super (sb);
UFSD(("EXIT\n"))
UFSD("EXIT\n");
return;

failed:
unlock_super (sb);
UFSD(("EXIT (FAILED)\n"))
UFSD("EXIT (FAILED)\n");
return;
}

Expand Down Expand Up @@ -290,8 +282,8 @@ static void ufs_change_blocknr(struct inode *inode, unsigned int count,

baseblk = ((i_size_read(inode) - 1) >> inode->i_blkbits) + 1 - count;

UFSD(("ENTER, ino %lu, count %u, oldb %u, newb %u\n",
inode->i_ino, count, oldb, newb));
UFSD("ENTER, ino %lu, count %u, oldb %u, newb %u\n",
inode->i_ino, count, oldb, newb);

BUG_ON(!PageLocked(locked_page));

Expand Down Expand Up @@ -326,7 +318,7 @@ static void ufs_change_blocknr(struct inode *inode, unsigned int count,
page_cache_release(page);
}
}
UFSD(("EXIT\n"));
UFSD("EXIT\n");
}

unsigned ufs_new_fragments(struct inode * inode, __fs32 * p, unsigned fragment,
Expand All @@ -337,7 +329,7 @@ unsigned ufs_new_fragments(struct inode * inode, __fs32 * p, unsigned fragment,
struct ufs_super_block_first * usb1;
unsigned cgno, oldcount, newcount, tmp, request, result;

UFSD(("ENTER, ino %lu, fragment %u, goal %u, count %u\n", inode->i_ino, fragment, goal, count))
UFSD("ENTER, ino %lu, fragment %u, goal %u, count %u\n", inode->i_ino, fragment, goal, count);

sb = inode->i_sb;
uspi = UFS_SB(sb)->s_uspi;
Expand Down Expand Up @@ -366,14 +358,14 @@ unsigned ufs_new_fragments(struct inode * inode, __fs32 * p, unsigned fragment,
return (unsigned)-1;
}
if (fragment < UFS_I(inode)->i_lastfrag) {
UFSD(("EXIT (ALREADY ALLOCATED)\n"))
UFSD("EXIT (ALREADY ALLOCATED)\n");
unlock_super (sb);
return 0;
}
}
else {
if (tmp) {
UFSD(("EXIT (ALREADY ALLOCATED)\n"))
UFSD("EXIT (ALREADY ALLOCATED)\n");
unlock_super(sb);
return 0;
}
Expand All @@ -384,7 +376,7 @@ unsigned ufs_new_fragments(struct inode * inode, __fs32 * p, unsigned fragment,
*/
if (!capable(CAP_SYS_RESOURCE) && ufs_freespace(usb1, UFS_MINFREE) <= 0) {
unlock_super (sb);
UFSD(("EXIT (FAILED)\n"))
UFSD("EXIT (FAILED)\n");
return 0;
}

Expand All @@ -407,7 +399,7 @@ unsigned ufs_new_fragments(struct inode * inode, __fs32 * p, unsigned fragment,
UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count);
}
unlock_super(sb);
UFSD(("EXIT, result %u\n", result))
UFSD("EXIT, result %u\n", result);
return result;
}

Expand All @@ -420,7 +412,7 @@ unsigned ufs_new_fragments(struct inode * inode, __fs32 * p, unsigned fragment,
inode->i_blocks += count << uspi->s_nspfshift;
UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count);
unlock_super(sb);
UFSD(("EXIT, result %u\n", result))
UFSD("EXIT, result %u\n", result);
return result;
}

Expand Down Expand Up @@ -458,12 +450,12 @@ unsigned ufs_new_fragments(struct inode * inode, __fs32 * p, unsigned fragment,
if (newcount < request)
ufs_free_fragments (inode, result + newcount, request - newcount);
ufs_free_fragments (inode, tmp, oldcount);
UFSD(("EXIT, result %u\n", result))
UFSD("EXIT, result %u\n", result);
return result;
}

unlock_super(sb);
UFSD(("EXIT (FAILED)\n"))
UFSD("EXIT (FAILED)\n");
return 0;
}

Expand All @@ -478,7 +470,7 @@ ufs_add_fragments (struct inode * inode, unsigned fragment,
struct ufs_cylinder_group * ucg;
unsigned cgno, fragno, fragoff, count, fragsize, i;

UFSD(("ENTER, fragment %u, oldcount %u, newcount %u\n", fragment, oldcount, newcount))
UFSD("ENTER, fragment %u, oldcount %u, newcount %u\n", fragment, oldcount, newcount);

sb = inode->i_sb;
uspi = UFS_SB(sb)->s_uspi;
Expand Down Expand Up @@ -538,7 +530,7 @@ ufs_add_fragments (struct inode * inode, unsigned fragment,
}
sb->s_dirt = 1;

UFSD(("EXIT, fragment %u\n", fragment))
UFSD("EXIT, fragment %u\n", fragment);

return fragment;
}
Expand All @@ -561,7 +553,7 @@ static unsigned ufs_alloc_fragments (struct inode * inode, unsigned cgno,
struct ufs_cylinder_group * ucg;
unsigned oldcg, i, j, k, result, allocsize;

UFSD(("ENTER, ino %lu, cgno %u, goal %u, count %u\n", inode->i_ino, cgno, goal, count))
UFSD("ENTER, ino %lu, cgno %u, goal %u, count %u\n", inode->i_ino, cgno, goal, count);

sb = inode->i_sb;
uspi = UFS_SB(sb)->s_uspi;
Expand Down Expand Up @@ -595,7 +587,7 @@ static unsigned ufs_alloc_fragments (struct inode * inode, unsigned cgno,
UFS_TEST_FREE_SPACE_CG
}

UFSD(("EXIT (FAILED)\n"))
UFSD("EXIT (FAILED)\n");
return 0;

cg_found:
Expand Down Expand Up @@ -664,7 +656,7 @@ static unsigned ufs_alloc_fragments (struct inode * inode, unsigned cgno,
sb->s_dirt = 1;

result += cgno * uspi->s_fpg;
UFSD(("EXIT3, result %u\n", result))
UFSD("EXIT3, result %u\n", result);
return result;
}

Expand All @@ -677,7 +669,7 @@ static unsigned ufs_alloccg_block (struct inode * inode,
struct ufs_cylinder_group * ucg;
unsigned result, cylno, blkno;

UFSD(("ENTER, goal %u\n", goal))
UFSD("ENTER, goal %u\n", goal);

sb = inode->i_sb;
uspi = UFS_SB(sb)->s_uspi;
Expand Down Expand Up @@ -721,7 +713,7 @@ static unsigned ufs_alloccg_block (struct inode * inode,
fs16_sub(sb, &ubh_cg_blks(ucpi, cylno, ufs_cbtorpos(result)), 1);
fs32_sub(sb, &ubh_cg_blktot(ucpi, cylno), 1);

UFSD(("EXIT, result %u\n", result))
UFSD("EXIT, result %u\n", result);

return result;
}
Expand Down Expand Up @@ -781,7 +773,7 @@ static unsigned ufs_bitmap_search(struct super_block *sb,
unsigned start, length, loc, result;
unsigned pos, want, blockmap, mask, end;

UFSD(("ENTER, cg %u, goal %u, count %u\n", ucpi->c_cgx, goal, count));
UFSD("ENTER, cg %u, goal %u, count %u\n", ucpi->c_cgx, goal, count);

usb1 = ubh_get_usb_first (uspi);
ucg = ubh_get_ucg(UCPI_UBH(ucpi));
Expand Down Expand Up @@ -825,7 +817,7 @@ static unsigned ufs_bitmap_search(struct super_block *sb,
want = want_arr[count];
for (pos = 0; pos <= uspi->s_fpb - count; pos++) {
if ((blockmap & mask) == want) {
UFSD(("EXIT, result %u\n", result));
UFSD("EXIT, result %u\n", result);
return result + pos;
}
mask <<= 1;
Expand All @@ -835,7 +827,7 @@ static unsigned ufs_bitmap_search(struct super_block *sb,

ufs_error(sb, "ufs_bitmap_search", "block not in map on cg %u\n",
ucpi->c_cgx);
UFSD(("EXIT (FAILED)\n"));
UFSD("EXIT (FAILED)\n");
return (unsigned)-1;
}

Expand Down
31 changes: 11 additions & 20 deletions trunk/fs/ufs/cylinder.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,6 @@
#include "swab.h"
#include "util.h"

#undef UFS_CYLINDER_DEBUG

#ifdef UFS_CYLINDER_DEBUG
#define UFSD(x) printk("(%s, %d), %s:", __FILE__, __LINE__, __FUNCTION__); printk x;
#else
#define UFSD(x)
#endif


/*
* Read cylinder group into cache. The memory space for ufs_cg_private_info
* structure is already allocated during ufs_read_super.
Expand All @@ -42,7 +33,7 @@ static void ufs_read_cylinder (struct super_block * sb,
struct ufs_cylinder_group * ucg;
unsigned i, j;

UFSD(("ENTER, cgno %u, bitmap_nr %u\n", cgno, bitmap_nr))
UFSD("ENTER, cgno %u, bitmap_nr %u\n", cgno, bitmap_nr);
uspi = sbi->s_uspi;
ucpi = sbi->s_ucpi[bitmap_nr];
ucg = (struct ufs_cylinder_group *)sbi->s_ucg[cgno]->b_data;
Expand Down Expand Up @@ -73,7 +64,7 @@ static void ufs_read_cylinder (struct super_block * sb,
ucpi->c_clustersumoff = fs32_to_cpu(sb, ucg->cg_u.cg_44.cg_clustersumoff);
ucpi->c_clusteroff = fs32_to_cpu(sb, ucg->cg_u.cg_44.cg_clusteroff);
ucpi->c_nclusterblks = fs32_to_cpu(sb, ucg->cg_u.cg_44.cg_nclusterblks);
UFSD(("EXIT\n"))
UFSD("EXIT\n");
return;

failed:
Expand All @@ -95,11 +86,11 @@ void ufs_put_cylinder (struct super_block * sb, unsigned bitmap_nr)
struct ufs_cylinder_group * ucg;
unsigned i;

UFSD(("ENTER, bitmap_nr %u\n", bitmap_nr))
UFSD("ENTER, bitmap_nr %u\n", bitmap_nr);

uspi = sbi->s_uspi;
if (sbi->s_cgno[bitmap_nr] == UFS_CGNO_EMPTY) {
UFSD(("EXIT\n"))
UFSD("EXIT\n");
return;
}
ucpi = sbi->s_ucpi[bitmap_nr];
Expand All @@ -122,7 +113,7 @@ void ufs_put_cylinder (struct super_block * sb, unsigned bitmap_nr)
}

sbi->s_cgno[bitmap_nr] = UFS_CGNO_EMPTY;
UFSD(("EXIT\n"))
UFSD("EXIT\n");
}

/*
Expand All @@ -139,7 +130,7 @@ struct ufs_cg_private_info * ufs_load_cylinder (
struct ufs_cg_private_info * ucpi;
unsigned cg, i, j;

UFSD(("ENTER, cgno %u\n", cgno))
UFSD("ENTER, cgno %u\n", cgno);

uspi = sbi->s_uspi;
if (cgno >= uspi->s_ncg) {
Expand All @@ -150,7 +141,7 @@ struct ufs_cg_private_info * ufs_load_cylinder (
* Cylinder group number cg it in cache and it was last used
*/
if (sbi->s_cgno[0] == cgno) {
UFSD(("EXIT\n"))
UFSD("EXIT\n");
return sbi->s_ucpi[0];
}
/*
Expand All @@ -160,16 +151,16 @@ struct ufs_cg_private_info * ufs_load_cylinder (
if (sbi->s_cgno[cgno] != UFS_CGNO_EMPTY) {
if (sbi->s_cgno[cgno] != cgno) {
ufs_panic (sb, "ufs_load_cylinder", "internal error, wrong number of cg in cache");
UFSD(("EXIT (FAILED)\n"))
UFSD("EXIT (FAILED)\n");
return NULL;
}
else {
UFSD(("EXIT\n"))
UFSD("EXIT\n");
return sbi->s_ucpi[cgno];
}
} else {
ufs_read_cylinder (sb, cgno, cgno);
UFSD(("EXIT\n"))
UFSD("EXIT\n");
return sbi->s_ucpi[cgno];
}
}
Expand Down Expand Up @@ -204,6 +195,6 @@ struct ufs_cg_private_info * ufs_load_cylinder (
sbi->s_ucpi[0] = ucpi;
ufs_read_cylinder (sb, cgno, 0);
}
UFSD(("EXIT\n"))
UFSD("EXIT\n");
return sbi->s_ucpi[0];
}
Loading

0 comments on commit 3076604

Please sign in to comment.