[PATCH] ufs: easy debug
Currently to turn on debug mode "user" has to edit ~10 files, to turn off he has to do it again. This patch introduce such changes: 1)turn on(off) debug messages via ".config" 2)remove unnecessary duplication of code 3)make "UFSD" macros more similar to function 4)fix some compiler warnings Signed-off-by: Evgeniy Dushistov <dushistov@mail.ru> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
5afb3145c9
commit
abf5d15fd2
@ -1375,6 +1375,14 @@ config UFS_FS_WRITE
|
|||||||
Say Y here if you want to try writing to UFS partitions. This is
|
Say Y here if you want to try writing to UFS partitions. This is
|
||||||
experimental, so you should back up your UFS partitions beforehand.
|
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
|
endmenu
|
||||||
|
|
||||||
menu "Network File Systems"
|
menu "Network File Systems"
|
||||||
|
@ -21,14 +21,6 @@
|
|||||||
#include "swab.h"
|
#include "swab.h"
|
||||||
#include "util.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_add_fragments (struct inode *, unsigned, unsigned, unsigned, int *);
|
||||||
static unsigned ufs_alloc_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 *);
|
static unsigned ufs_alloccg_block (struct inode *, struct ufs_cg_private_info *, unsigned, int *);
|
||||||
@ -52,7 +44,7 @@ void ufs_free_fragments(struct inode *inode, unsigned fragment, unsigned count)
|
|||||||
uspi = UFS_SB(sb)->s_uspi;
|
uspi = UFS_SB(sb)->s_uspi;
|
||||||
usb1 = ubh_get_usb_first(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)
|
if (ufs_fragnum(fragment) + count > uspi->s_fpg)
|
||||||
ufs_error (sb, "ufs_free_fragments", "internal error");
|
ufs_error (sb, "ufs_free_fragments", "internal error");
|
||||||
@ -123,12 +115,12 @@ void ufs_free_fragments(struct inode *inode, unsigned fragment, unsigned count)
|
|||||||
sb->s_dirt = 1;
|
sb->s_dirt = 1;
|
||||||
|
|
||||||
unlock_super (sb);
|
unlock_super (sb);
|
||||||
UFSD(("EXIT\n"))
|
UFSD("EXIT\n");
|
||||||
return;
|
return;
|
||||||
|
|
||||||
failed:
|
failed:
|
||||||
unlock_super (sb);
|
unlock_super (sb);
|
||||||
UFSD(("EXIT (FAILED)\n"))
|
UFSD("EXIT (FAILED)\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,7 +140,7 @@ void ufs_free_blocks(struct inode *inode, unsigned fragment, unsigned count)
|
|||||||
uspi = UFS_SB(sb)->s_uspi;
|
uspi = UFS_SB(sb)->s_uspi;
|
||||||
usb1 = ubh_get_usb_first(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)) {
|
if ((fragment & uspi->s_fpbmask) || (count & uspi->s_fpbmask)) {
|
||||||
ufs_error (sb, "ufs_free_blocks", "internal error, "
|
ufs_error (sb, "ufs_free_blocks", "internal error, "
|
||||||
@ -215,12 +207,12 @@ do_more:
|
|||||||
|
|
||||||
sb->s_dirt = 1;
|
sb->s_dirt = 1;
|
||||||
unlock_super (sb);
|
unlock_super (sb);
|
||||||
UFSD(("EXIT\n"))
|
UFSD("EXIT\n");
|
||||||
return;
|
return;
|
||||||
|
|
||||||
failed:
|
failed:
|
||||||
unlock_super (sb);
|
unlock_super (sb);
|
||||||
UFSD(("EXIT (FAILED)\n"))
|
UFSD("EXIT (FAILED)\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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;
|
baseblk = ((i_size_read(inode) - 1) >> inode->i_blkbits) + 1 - count;
|
||||||
|
|
||||||
UFSD(("ENTER, ino %lu, count %u, oldb %u, newb %u\n",
|
UFSD("ENTER, ino %lu, count %u, oldb %u, newb %u\n",
|
||||||
inode->i_ino, count, oldb, newb));
|
inode->i_ino, count, oldb, newb);
|
||||||
|
|
||||||
BUG_ON(!PageLocked(locked_page));
|
BUG_ON(!PageLocked(locked_page));
|
||||||
|
|
||||||
@ -326,7 +318,7 @@ static void ufs_change_blocknr(struct inode *inode, unsigned int count,
|
|||||||
page_cache_release(page);
|
page_cache_release(page);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UFSD(("EXIT\n"));
|
UFSD("EXIT\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned ufs_new_fragments(struct inode * inode, __fs32 * p, unsigned fragment,
|
unsigned ufs_new_fragments(struct inode * inode, __fs32 * p, unsigned fragment,
|
||||||
@ -337,7 +329,7 @@ unsigned ufs_new_fragments(struct inode * inode, __fs32 * p, unsigned fragment,
|
|||||||
struct ufs_super_block_first * usb1;
|
struct ufs_super_block_first * usb1;
|
||||||
unsigned cgno, oldcount, newcount, tmp, request, result;
|
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;
|
sb = inode->i_sb;
|
||||||
uspi = UFS_SB(sb)->s_uspi;
|
uspi = UFS_SB(sb)->s_uspi;
|
||||||
@ -366,14 +358,14 @@ unsigned ufs_new_fragments(struct inode * inode, __fs32 * p, unsigned fragment,
|
|||||||
return (unsigned)-1;
|
return (unsigned)-1;
|
||||||
}
|
}
|
||||||
if (fragment < UFS_I(inode)->i_lastfrag) {
|
if (fragment < UFS_I(inode)->i_lastfrag) {
|
||||||
UFSD(("EXIT (ALREADY ALLOCATED)\n"))
|
UFSD("EXIT (ALREADY ALLOCATED)\n");
|
||||||
unlock_super (sb);
|
unlock_super (sb);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
UFSD(("EXIT (ALREADY ALLOCATED)\n"))
|
UFSD("EXIT (ALREADY ALLOCATED)\n");
|
||||||
unlock_super(sb);
|
unlock_super(sb);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -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) {
|
if (!capable(CAP_SYS_RESOURCE) && ufs_freespace(usb1, UFS_MINFREE) <= 0) {
|
||||||
unlock_super (sb);
|
unlock_super (sb);
|
||||||
UFSD(("EXIT (FAILED)\n"))
|
UFSD("EXIT (FAILED)\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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);
|
UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count);
|
||||||
}
|
}
|
||||||
unlock_super(sb);
|
unlock_super(sb);
|
||||||
UFSD(("EXIT, result %u\n", result))
|
UFSD("EXIT, result %u\n", result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -420,7 +412,7 @@ unsigned ufs_new_fragments(struct inode * inode, __fs32 * p, unsigned fragment,
|
|||||||
inode->i_blocks += count << uspi->s_nspfshift;
|
inode->i_blocks += count << uspi->s_nspfshift;
|
||||||
UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count);
|
UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count);
|
||||||
unlock_super(sb);
|
unlock_super(sb);
|
||||||
UFSD(("EXIT, result %u\n", result))
|
UFSD("EXIT, result %u\n", result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -458,12 +450,12 @@ unsigned ufs_new_fragments(struct inode * inode, __fs32 * p, unsigned fragment,
|
|||||||
if (newcount < request)
|
if (newcount < request)
|
||||||
ufs_free_fragments (inode, result + newcount, request - newcount);
|
ufs_free_fragments (inode, result + newcount, request - newcount);
|
||||||
ufs_free_fragments (inode, tmp, oldcount);
|
ufs_free_fragments (inode, tmp, oldcount);
|
||||||
UFSD(("EXIT, result %u\n", result))
|
UFSD("EXIT, result %u\n", result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
unlock_super(sb);
|
unlock_super(sb);
|
||||||
UFSD(("EXIT (FAILED)\n"))
|
UFSD("EXIT (FAILED)\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,7 +470,7 @@ ufs_add_fragments (struct inode * inode, unsigned fragment,
|
|||||||
struct ufs_cylinder_group * ucg;
|
struct ufs_cylinder_group * ucg;
|
||||||
unsigned cgno, fragno, fragoff, count, fragsize, i;
|
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;
|
sb = inode->i_sb;
|
||||||
uspi = UFS_SB(sb)->s_uspi;
|
uspi = UFS_SB(sb)->s_uspi;
|
||||||
@ -538,7 +530,7 @@ ufs_add_fragments (struct inode * inode, unsigned fragment,
|
|||||||
}
|
}
|
||||||
sb->s_dirt = 1;
|
sb->s_dirt = 1;
|
||||||
|
|
||||||
UFSD(("EXIT, fragment %u\n", fragment))
|
UFSD("EXIT, fragment %u\n", fragment);
|
||||||
|
|
||||||
return fragment;
|
return fragment;
|
||||||
}
|
}
|
||||||
@ -561,7 +553,7 @@ static unsigned ufs_alloc_fragments (struct inode * inode, unsigned cgno,
|
|||||||
struct ufs_cylinder_group * ucg;
|
struct ufs_cylinder_group * ucg;
|
||||||
unsigned oldcg, i, j, k, result, allocsize;
|
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;
|
sb = inode->i_sb;
|
||||||
uspi = UFS_SB(sb)->s_uspi;
|
uspi = UFS_SB(sb)->s_uspi;
|
||||||
@ -595,7 +587,7 @@ static unsigned ufs_alloc_fragments (struct inode * inode, unsigned cgno,
|
|||||||
UFS_TEST_FREE_SPACE_CG
|
UFS_TEST_FREE_SPACE_CG
|
||||||
}
|
}
|
||||||
|
|
||||||
UFSD(("EXIT (FAILED)\n"))
|
UFSD("EXIT (FAILED)\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
cg_found:
|
cg_found:
|
||||||
@ -664,7 +656,7 @@ succed:
|
|||||||
sb->s_dirt = 1;
|
sb->s_dirt = 1;
|
||||||
|
|
||||||
result += cgno * uspi->s_fpg;
|
result += cgno * uspi->s_fpg;
|
||||||
UFSD(("EXIT3, result %u\n", result))
|
UFSD("EXIT3, result %u\n", result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -677,7 +669,7 @@ static unsigned ufs_alloccg_block (struct inode * inode,
|
|||||||
struct ufs_cylinder_group * ucg;
|
struct ufs_cylinder_group * ucg;
|
||||||
unsigned result, cylno, blkno;
|
unsigned result, cylno, blkno;
|
||||||
|
|
||||||
UFSD(("ENTER, goal %u\n", goal))
|
UFSD("ENTER, goal %u\n", goal);
|
||||||
|
|
||||||
sb = inode->i_sb;
|
sb = inode->i_sb;
|
||||||
uspi = UFS_SB(sb)->s_uspi;
|
uspi = UFS_SB(sb)->s_uspi;
|
||||||
@ -721,7 +713,7 @@ gotit:
|
|||||||
fs16_sub(sb, &ubh_cg_blks(ucpi, cylno, ufs_cbtorpos(result)), 1);
|
fs16_sub(sb, &ubh_cg_blks(ucpi, cylno, ufs_cbtorpos(result)), 1);
|
||||||
fs32_sub(sb, &ubh_cg_blktot(ucpi, cylno), 1);
|
fs32_sub(sb, &ubh_cg_blktot(ucpi, cylno), 1);
|
||||||
|
|
||||||
UFSD(("EXIT, result %u\n", result))
|
UFSD("EXIT, result %u\n", result);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -781,7 +773,7 @@ static unsigned ufs_bitmap_search(struct super_block *sb,
|
|||||||
unsigned start, length, loc, result;
|
unsigned start, length, loc, result;
|
||||||
unsigned pos, want, blockmap, mask, end;
|
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);
|
usb1 = ubh_get_usb_first (uspi);
|
||||||
ucg = ubh_get_ucg(UCPI_UBH(ucpi));
|
ucg = ubh_get_ucg(UCPI_UBH(ucpi));
|
||||||
@ -825,7 +817,7 @@ static unsigned ufs_bitmap_search(struct super_block *sb,
|
|||||||
want = want_arr[count];
|
want = want_arr[count];
|
||||||
for (pos = 0; pos <= uspi->s_fpb - count; pos++) {
|
for (pos = 0; pos <= uspi->s_fpb - count; pos++) {
|
||||||
if ((blockmap & mask) == want) {
|
if ((blockmap & mask) == want) {
|
||||||
UFSD(("EXIT, result %u\n", result));
|
UFSD("EXIT, result %u\n", result);
|
||||||
return result + pos;
|
return result + pos;
|
||||||
}
|
}
|
||||||
mask <<= 1;
|
mask <<= 1;
|
||||||
@ -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",
|
ufs_error(sb, "ufs_bitmap_search", "block not in map on cg %u\n",
|
||||||
ucpi->c_cgx);
|
ucpi->c_cgx);
|
||||||
UFSD(("EXIT (FAILED)\n"));
|
UFSD("EXIT (FAILED)\n");
|
||||||
return (unsigned)-1;
|
return (unsigned)-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,15 +20,6 @@
|
|||||||
#include "swab.h"
|
#include "swab.h"
|
||||||
#include "util.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
|
* Read cylinder group into cache. The memory space for ufs_cg_private_info
|
||||||
* structure is already allocated during ufs_read_super.
|
* structure is already allocated during ufs_read_super.
|
||||||
@ -42,7 +33,7 @@ static void ufs_read_cylinder (struct super_block * sb,
|
|||||||
struct ufs_cylinder_group * ucg;
|
struct ufs_cylinder_group * ucg;
|
||||||
unsigned i, j;
|
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;
|
uspi = sbi->s_uspi;
|
||||||
ucpi = sbi->s_ucpi[bitmap_nr];
|
ucpi = sbi->s_ucpi[bitmap_nr];
|
||||||
ucg = (struct ufs_cylinder_group *)sbi->s_ucg[cgno]->b_data;
|
ucg = (struct ufs_cylinder_group *)sbi->s_ucg[cgno]->b_data;
|
||||||
@ -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_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_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);
|
ucpi->c_nclusterblks = fs32_to_cpu(sb, ucg->cg_u.cg_44.cg_nclusterblks);
|
||||||
UFSD(("EXIT\n"))
|
UFSD("EXIT\n");
|
||||||
return;
|
return;
|
||||||
|
|
||||||
failed:
|
failed:
|
||||||
@ -95,11 +86,11 @@ void ufs_put_cylinder (struct super_block * sb, unsigned bitmap_nr)
|
|||||||
struct ufs_cylinder_group * ucg;
|
struct ufs_cylinder_group * ucg;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
UFSD(("ENTER, bitmap_nr %u\n", bitmap_nr))
|
UFSD("ENTER, bitmap_nr %u\n", bitmap_nr);
|
||||||
|
|
||||||
uspi = sbi->s_uspi;
|
uspi = sbi->s_uspi;
|
||||||
if (sbi->s_cgno[bitmap_nr] == UFS_CGNO_EMPTY) {
|
if (sbi->s_cgno[bitmap_nr] == UFS_CGNO_EMPTY) {
|
||||||
UFSD(("EXIT\n"))
|
UFSD("EXIT\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ucpi = sbi->s_ucpi[bitmap_nr];
|
ucpi = sbi->s_ucpi[bitmap_nr];
|
||||||
@ -122,7 +113,7 @@ void ufs_put_cylinder (struct super_block * sb, unsigned bitmap_nr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
sbi->s_cgno[bitmap_nr] = UFS_CGNO_EMPTY;
|
sbi->s_cgno[bitmap_nr] = UFS_CGNO_EMPTY;
|
||||||
UFSD(("EXIT\n"))
|
UFSD("EXIT\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -139,7 +130,7 @@ struct ufs_cg_private_info * ufs_load_cylinder (
|
|||||||
struct ufs_cg_private_info * ucpi;
|
struct ufs_cg_private_info * ucpi;
|
||||||
unsigned cg, i, j;
|
unsigned cg, i, j;
|
||||||
|
|
||||||
UFSD(("ENTER, cgno %u\n", cgno))
|
UFSD("ENTER, cgno %u\n", cgno);
|
||||||
|
|
||||||
uspi = sbi->s_uspi;
|
uspi = sbi->s_uspi;
|
||||||
if (cgno >= uspi->s_ncg) {
|
if (cgno >= uspi->s_ncg) {
|
||||||
@ -150,7 +141,7 @@ struct ufs_cg_private_info * ufs_load_cylinder (
|
|||||||
* Cylinder group number cg it in cache and it was last used
|
* Cylinder group number cg it in cache and it was last used
|
||||||
*/
|
*/
|
||||||
if (sbi->s_cgno[0] == cgno) {
|
if (sbi->s_cgno[0] == cgno) {
|
||||||
UFSD(("EXIT\n"))
|
UFSD("EXIT\n");
|
||||||
return sbi->s_ucpi[0];
|
return sbi->s_ucpi[0];
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -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] != UFS_CGNO_EMPTY) {
|
||||||
if (sbi->s_cgno[cgno] != cgno) {
|
if (sbi->s_cgno[cgno] != cgno) {
|
||||||
ufs_panic (sb, "ufs_load_cylinder", "internal error, wrong number of cg in cache");
|
ufs_panic (sb, "ufs_load_cylinder", "internal error, wrong number of cg in cache");
|
||||||
UFSD(("EXIT (FAILED)\n"))
|
UFSD("EXIT (FAILED)\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
UFSD(("EXIT\n"))
|
UFSD("EXIT\n");
|
||||||
return sbi->s_ucpi[cgno];
|
return sbi->s_ucpi[cgno];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ufs_read_cylinder (sb, cgno, cgno);
|
ufs_read_cylinder (sb, cgno, cgno);
|
||||||
UFSD(("EXIT\n"))
|
UFSD("EXIT\n");
|
||||||
return sbi->s_ucpi[cgno];
|
return sbi->s_ucpi[cgno];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -204,6 +195,6 @@ struct ufs_cg_private_info * ufs_load_cylinder (
|
|||||||
sbi->s_ucpi[0] = ucpi;
|
sbi->s_ucpi[0] = ucpi;
|
||||||
ufs_read_cylinder (sb, cgno, 0);
|
ufs_read_cylinder (sb, cgno, 0);
|
||||||
}
|
}
|
||||||
UFSD(("EXIT\n"))
|
UFSD("EXIT\n");
|
||||||
return sbi->s_ucpi[0];
|
return sbi->s_ucpi[0];
|
||||||
}
|
}
|
||||||
|
28
fs/ufs/dir.c
28
fs/ufs/dir.c
@ -25,14 +25,6 @@
|
|||||||
#include "swab.h"
|
#include "swab.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#undef UFS_DIR_DEBUG
|
|
||||||
|
|
||||||
#ifdef UFS_DIR_DEBUG
|
|
||||||
#define UFSD(x) printk("(%s, %d), %s: ", __FILE__, __LINE__, __FUNCTION__); printk x;
|
|
||||||
#else
|
|
||||||
#define UFSD(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NOTE! unlike strncmp, ufs_match returns 1 for success, 0 for failure.
|
* NOTE! unlike strncmp, ufs_match returns 1 for success, 0 for failure.
|
||||||
*
|
*
|
||||||
@ -262,7 +254,7 @@ struct ufs_dir_entry *ufs_find_entry(struct inode *dir, struct dentry *dentry,
|
|||||||
struct page *page = NULL;
|
struct page *page = NULL;
|
||||||
struct ufs_dir_entry *de;
|
struct ufs_dir_entry *de;
|
||||||
|
|
||||||
UFSD(("ENTER, dir_ino %lu, name %s, namlen %u\n", dir->i_ino, name, namelen));
|
UFSD("ENTER, dir_ino %lu, name %s, namlen %u\n", dir->i_ino, name, namelen);
|
||||||
|
|
||||||
if (npages == 0 || namelen > UFS_MAXNAMLEN)
|
if (npages == 0 || namelen > UFS_MAXNAMLEN)
|
||||||
goto out;
|
goto out;
|
||||||
@ -326,7 +318,7 @@ int ufs_add_link(struct dentry *dentry, struct inode *inode)
|
|||||||
unsigned from, to;
|
unsigned from, to;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
UFSD(("ENTER, name %s, namelen %u\n", name, namelen));
|
UFSD("ENTER, name %s, namelen %u\n", name, namelen);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We take care of directory expansion in the same loop.
|
* We take care of directory expansion in the same loop.
|
||||||
@ -442,7 +434,7 @@ ufs_readdir(struct file *filp, void *dirent, filldir_t filldir)
|
|||||||
int need_revalidate = filp->f_version != inode->i_version;
|
int need_revalidate = filp->f_version != inode->i_version;
|
||||||
unsigned flags = UFS_SB(sb)->s_flags;
|
unsigned flags = UFS_SB(sb)->s_flags;
|
||||||
|
|
||||||
UFSD(("BEGIN"));
|
UFSD("BEGIN\n");
|
||||||
|
|
||||||
if (pos > inode->i_size - UFS_DIR_REC_LEN(1))
|
if (pos > inode->i_size - UFS_DIR_REC_LEN(1))
|
||||||
return 0;
|
return 0;
|
||||||
@ -484,9 +476,9 @@ ufs_readdir(struct file *filp, void *dirent, filldir_t filldir)
|
|||||||
|
|
||||||
offset = (char *)de - kaddr;
|
offset = (char *)de - kaddr;
|
||||||
|
|
||||||
UFSD(("filldir(%s,%u)\n", de->d_name,
|
UFSD("filldir(%s,%u)\n", de->d_name,
|
||||||
fs32_to_cpu(sb, de->d_ino)));
|
fs32_to_cpu(sb, de->d_ino));
|
||||||
UFSD(("namlen %u\n", ufs_get_de_namlen(sb, de)));
|
UFSD("namlen %u\n", ufs_get_de_namlen(sb, de));
|
||||||
|
|
||||||
if ((flags & UFS_DE_MASK) == UFS_DE_44BSD)
|
if ((flags & UFS_DE_MASK) == UFS_DE_44BSD)
|
||||||
d_type = de->d_u.d_44.d_type;
|
d_type = de->d_u.d_44.d_type;
|
||||||
@ -524,12 +516,12 @@ int ufs_delete_entry(struct inode *inode, struct ufs_dir_entry *dir,
|
|||||||
struct ufs_dir_entry *de = (struct ufs_dir_entry *) (kaddr + from);
|
struct ufs_dir_entry *de = (struct ufs_dir_entry *) (kaddr + from);
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
UFSD(("ENTER\n"));
|
UFSD("ENTER\n");
|
||||||
|
|
||||||
UFSD(("ino %u, reclen %u, namlen %u, name %s\n",
|
UFSD("ino %u, reclen %u, namlen %u, name %s\n",
|
||||||
fs32_to_cpu(sb, de->d_ino),
|
fs32_to_cpu(sb, de->d_ino),
|
||||||
fs16_to_cpu(sb, de->d_reclen),
|
fs16_to_cpu(sb, de->d_reclen),
|
||||||
ufs_get_de_namlen(sb, de), de->d_name));
|
ufs_get_de_namlen(sb, de), de->d_name);
|
||||||
|
|
||||||
while ((char*)de < (char*)dir) {
|
while ((char*)de < (char*)dir) {
|
||||||
if (de->d_reclen == 0) {
|
if (de->d_reclen == 0) {
|
||||||
@ -554,7 +546,7 @@ int ufs_delete_entry(struct inode *inode, struct ufs_dir_entry *dir,
|
|||||||
mark_inode_dirty(inode);
|
mark_inode_dirty(inode);
|
||||||
out:
|
out:
|
||||||
ufs_put_page(page);
|
ufs_put_page(page);
|
||||||
UFSD(("EXIT\n"));
|
UFSD("EXIT\n");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,14 +34,6 @@
|
|||||||
#include "swab.h"
|
#include "swab.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#undef UFS_IALLOC_DEBUG
|
|
||||||
|
|
||||||
#ifdef UFS_IALLOC_DEBUG
|
|
||||||
#define UFSD(x) printk("(%s, %d), %s: ", __FILE__, __LINE__, __FUNCTION__); printk x;
|
|
||||||
#else
|
|
||||||
#define UFSD(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NOTE! When we get the inode, we're the only people
|
* NOTE! When we get the inode, we're the only people
|
||||||
* that have access to it, and as such there are no
|
* that have access to it, and as such there are no
|
||||||
@ -68,7 +60,7 @@ void ufs_free_inode (struct inode * inode)
|
|||||||
int is_directory;
|
int is_directory;
|
||||||
unsigned ino, cg, bit;
|
unsigned ino, cg, bit;
|
||||||
|
|
||||||
UFSD(("ENTER, ino %lu\n", inode->i_ino))
|
UFSD("ENTER, ino %lu\n", inode->i_ino);
|
||||||
|
|
||||||
sb = inode->i_sb;
|
sb = inode->i_sb;
|
||||||
uspi = UFS_SB(sb)->s_uspi;
|
uspi = UFS_SB(sb)->s_uspi;
|
||||||
@ -130,7 +122,7 @@ void ufs_free_inode (struct inode * inode)
|
|||||||
|
|
||||||
sb->s_dirt = 1;
|
sb->s_dirt = 1;
|
||||||
unlock_super (sb);
|
unlock_super (sb);
|
||||||
UFSD(("EXIT\n"))
|
UFSD("EXIT\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -155,7 +147,7 @@ struct inode * ufs_new_inode(struct inode * dir, int mode)
|
|||||||
unsigned cg, bit, i, j, start;
|
unsigned cg, bit, i, j, start;
|
||||||
struct ufs_inode_info *ufsi;
|
struct ufs_inode_info *ufsi;
|
||||||
|
|
||||||
UFSD(("ENTER\n"))
|
UFSD("ENTER\n");
|
||||||
|
|
||||||
/* Cannot create files in a deleted directory */
|
/* Cannot create files in a deleted directory */
|
||||||
if (!dir || !dir->i_nlink)
|
if (!dir || !dir->i_nlink)
|
||||||
@ -227,7 +219,7 @@ cg_found:
|
|||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UFSD(("start = %u, bit = %u, ipg = %u\n", start, bit, uspi->s_ipg))
|
UFSD("start = %u, bit = %u, ipg = %u\n", start, bit, uspi->s_ipg);
|
||||||
if (ubh_isclr (UCPI_UBH(ucpi), ucpi->c_iusedoff, bit))
|
if (ubh_isclr (UCPI_UBH(ucpi), ucpi->c_iusedoff, bit))
|
||||||
ubh_setbit (UCPI_UBH(ucpi), ucpi->c_iusedoff, bit);
|
ubh_setbit (UCPI_UBH(ucpi), ucpi->c_iusedoff, bit);
|
||||||
else {
|
else {
|
||||||
@ -287,14 +279,14 @@ cg_found:
|
|||||||
return ERR_PTR(-EDQUOT);
|
return ERR_PTR(-EDQUOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
UFSD(("allocating inode %lu\n", inode->i_ino))
|
UFSD("allocating inode %lu\n", inode->i_ino);
|
||||||
UFSD(("EXIT\n"))
|
UFSD("EXIT\n");
|
||||||
return inode;
|
return inode;
|
||||||
|
|
||||||
failed:
|
failed:
|
||||||
unlock_super (sb);
|
unlock_super (sb);
|
||||||
make_bad_inode(inode);
|
make_bad_inode(inode);
|
||||||
iput (inode);
|
iput (inode);
|
||||||
UFSD(("EXIT (FAILED)\n"))
|
UFSD("EXIT (FAILED)\n");
|
||||||
return ERR_PTR(-ENOSPC);
|
return ERR_PTR(-ENOSPC);
|
||||||
}
|
}
|
||||||
|
@ -41,15 +41,6 @@
|
|||||||
#include "swab.h"
|
#include "swab.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#undef UFS_INODE_DEBUG
|
|
||||||
#undef UFS_INODE_DEBUG_MORE
|
|
||||||
|
|
||||||
#ifdef UFS_INODE_DEBUG
|
|
||||||
#define UFSD(x) printk("(%s, %d), %s: ", __FILE__, __LINE__, __FUNCTION__); printk x;
|
|
||||||
#else
|
|
||||||
#define UFSD(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int ufs_block_to_path(struct inode *inode, sector_t i_block, sector_t offsets[4])
|
static int ufs_block_to_path(struct inode *inode, sector_t i_block, sector_t offsets[4])
|
||||||
{
|
{
|
||||||
struct ufs_sb_private_info *uspi = UFS_SB(inode->i_sb)->s_uspi;
|
struct ufs_sb_private_info *uspi = UFS_SB(inode->i_sb)->s_uspi;
|
||||||
@ -61,7 +52,7 @@ static int ufs_block_to_path(struct inode *inode, sector_t i_block, sector_t off
|
|||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
|
|
||||||
UFSD(("ptrs=uspi->s_apb = %d,double_blocks=%ld \n",ptrs,double_blocks));
|
UFSD("ptrs=uspi->s_apb = %d,double_blocks=%ld \n",ptrs,double_blocks);
|
||||||
if (i_block < 0) {
|
if (i_block < 0) {
|
||||||
ufs_warning(inode->i_sb, "ufs_block_to_path", "block < 0");
|
ufs_warning(inode->i_sb, "ufs_block_to_path", "block < 0");
|
||||||
} else if (i_block < direct_blocks) {
|
} else if (i_block < direct_blocks) {
|
||||||
@ -104,8 +95,8 @@ u64 ufs_frag_map(struct inode *inode, sector_t frag)
|
|||||||
unsigned flags = UFS_SB(sb)->s_flags;
|
unsigned flags = UFS_SB(sb)->s_flags;
|
||||||
u64 temp = 0L;
|
u64 temp = 0L;
|
||||||
|
|
||||||
UFSD((": frag = %llu depth = %d\n", (unsigned long long)frag, depth));
|
UFSD(": frag = %llu depth = %d\n", (unsigned long long)frag, depth);
|
||||||
UFSD((": uspi->s_fpbshift = %d ,uspi->s_apbmask = %x, mask=%llx\n",uspi->s_fpbshift,uspi->s_apbmask,mask));
|
UFSD(": uspi->s_fpbshift = %d ,uspi->s_apbmask = %x, mask=%llx\n",uspi->s_fpbshift,uspi->s_apbmask,mask);
|
||||||
|
|
||||||
if (depth == 0)
|
if (depth == 0)
|
||||||
return 0;
|
return 0;
|
||||||
@ -186,8 +177,8 @@ static struct buffer_head *ufs_inode_getfrag(struct inode *inode,
|
|||||||
__fs32 * p, * p2;
|
__fs32 * p, * p2;
|
||||||
unsigned flags = 0;
|
unsigned flags = 0;
|
||||||
|
|
||||||
UFSD(("ENTER, ino %lu, fragment %u, new_fragment %u, required %u\n",
|
UFSD("ENTER, ino %lu, fragment %u, new_fragment %u, required %u\n",
|
||||||
inode->i_ino, fragment, new_fragment, required))
|
inode->i_ino, fragment, new_fragment, required);
|
||||||
|
|
||||||
sb = inode->i_sb;
|
sb = inode->i_sb;
|
||||||
uspi = UFS_SB(sb)->s_uspi;
|
uspi = UFS_SB(sb)->s_uspi;
|
||||||
@ -210,7 +201,7 @@ repeat:
|
|||||||
if (metadata) {
|
if (metadata) {
|
||||||
result = sb_getblk(sb, uspi->s_sbbase + tmp + blockoff);
|
result = sb_getblk(sb, uspi->s_sbbase + tmp + blockoff);
|
||||||
if (tmp == fs32_to_cpu(sb, *p)) {
|
if (tmp == fs32_to_cpu(sb, *p)) {
|
||||||
UFSD(("EXIT, result %u\n", tmp + blockoff))
|
UFSD("EXIT, result %u\n", tmp + blockoff);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
brelse (result);
|
brelse (result);
|
||||||
@ -288,7 +279,7 @@ repeat:
|
|||||||
if (IS_SYNC(inode))
|
if (IS_SYNC(inode))
|
||||||
ufs_sync_inode (inode);
|
ufs_sync_inode (inode);
|
||||||
mark_inode_dirty(inode);
|
mark_inode_dirty(inode);
|
||||||
UFSD(("EXIT, result %u\n", tmp + blockoff))
|
UFSD("EXIT, result %u\n", tmp + blockoff);
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
/* This part : To be implemented ....
|
/* This part : To be implemented ....
|
||||||
@ -323,7 +314,7 @@ static struct buffer_head *ufs_block_getfrag(struct inode *inode, struct buffer_
|
|||||||
block = ufs_fragstoblks (fragment);
|
block = ufs_fragstoblks (fragment);
|
||||||
blockoff = ufs_fragnum (fragment);
|
blockoff = ufs_fragnum (fragment);
|
||||||
|
|
||||||
UFSD(("ENTER, ino %lu, fragment %u, new_fragment %u\n", inode->i_ino, fragment, new_fragment))
|
UFSD("ENTER, ino %lu, fragment %u, new_fragment %u\n", inode->i_ino, fragment, new_fragment);
|
||||||
|
|
||||||
result = NULL;
|
result = NULL;
|
||||||
if (!bh)
|
if (!bh)
|
||||||
@ -377,10 +368,10 @@ repeat:
|
|||||||
sync_dirty_buffer(bh);
|
sync_dirty_buffer(bh);
|
||||||
inode->i_ctime = CURRENT_TIME_SEC;
|
inode->i_ctime = CURRENT_TIME_SEC;
|
||||||
mark_inode_dirty(inode);
|
mark_inode_dirty(inode);
|
||||||
UFSD(("result %u\n", tmp + blockoff));
|
UFSD("result %u\n", tmp + blockoff);
|
||||||
out:
|
out:
|
||||||
brelse (bh);
|
brelse (bh);
|
||||||
UFSD(("EXIT\n"));
|
UFSD("EXIT\n");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -399,7 +390,7 @@ int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buffer_hea
|
|||||||
|
|
||||||
if (!create) {
|
if (!create) {
|
||||||
phys64 = ufs_frag_map(inode, fragment);
|
phys64 = ufs_frag_map(inode, fragment);
|
||||||
UFSD(("phys64 = %llu \n",phys64));
|
UFSD("phys64 = %llu \n",phys64);
|
||||||
if (phys64)
|
if (phys64)
|
||||||
map_bh(bh_result, sb, phys64);
|
map_bh(bh_result, sb, phys64);
|
||||||
return 0;
|
return 0;
|
||||||
@ -414,7 +405,7 @@ int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buffer_hea
|
|||||||
|
|
||||||
lock_kernel();
|
lock_kernel();
|
||||||
|
|
||||||
UFSD(("ENTER, ino %lu, fragment %llu\n", inode->i_ino, (unsigned long long)fragment))
|
UFSD("ENTER, ino %lu, fragment %llu\n", inode->i_ino, (unsigned long long)fragment);
|
||||||
if (fragment < 0)
|
if (fragment < 0)
|
||||||
goto abort_negative;
|
goto abort_negative;
|
||||||
if (fragment >
|
if (fragment >
|
||||||
@ -514,7 +505,7 @@ struct buffer_head * ufs_bread (struct inode * inode, unsigned fragment,
|
|||||||
{
|
{
|
||||||
struct buffer_head * bh;
|
struct buffer_head * bh;
|
||||||
|
|
||||||
UFSD(("ENTER, ino %lu, fragment %u\n", inode->i_ino, fragment))
|
UFSD("ENTER, ino %lu, fragment %u\n", inode->i_ino, fragment);
|
||||||
bh = ufs_getfrag (inode, fragment, create, err);
|
bh = ufs_getfrag (inode, fragment, create, err);
|
||||||
if (!bh || buffer_uptodate(bh))
|
if (!bh || buffer_uptodate(bh))
|
||||||
return bh;
|
return bh;
|
||||||
@ -586,7 +577,7 @@ void ufs_read_inode (struct inode * inode)
|
|||||||
unsigned i;
|
unsigned i;
|
||||||
unsigned flags;
|
unsigned flags;
|
||||||
|
|
||||||
UFSD(("ENTER, ino %lu\n", inode->i_ino))
|
UFSD("ENTER, ino %lu\n", inode->i_ino);
|
||||||
|
|
||||||
sb = inode->i_sb;
|
sb = inode->i_sb;
|
||||||
uspi = UFS_SB(sb)->s_uspi;
|
uspi = UFS_SB(sb)->s_uspi;
|
||||||
@ -652,7 +643,7 @@ void ufs_read_inode (struct inode * inode)
|
|||||||
|
|
||||||
brelse (bh);
|
brelse (bh);
|
||||||
|
|
||||||
UFSD(("EXIT\n"))
|
UFSD("EXIT\n");
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bad_inode:
|
bad_inode:
|
||||||
@ -660,7 +651,7 @@ bad_inode:
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
ufs2_inode :
|
ufs2_inode :
|
||||||
UFSD(("Reading ufs2 inode, ino %lu\n", inode->i_ino))
|
UFSD("Reading ufs2 inode, ino %lu\n", inode->i_ino);
|
||||||
|
|
||||||
ufs2_inode = (struct ufs2_inode *)(bh->b_data + sizeof(struct ufs2_inode) * ufs_inotofsbo(inode->i_ino));
|
ufs2_inode = (struct ufs2_inode *)(bh->b_data + sizeof(struct ufs2_inode) * ufs_inotofsbo(inode->i_ino));
|
||||||
|
|
||||||
@ -712,7 +703,7 @@ ufs2_inode :
|
|||||||
|
|
||||||
brelse(bh);
|
brelse(bh);
|
||||||
|
|
||||||
UFSD(("EXIT\n"))
|
UFSD("EXIT\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -726,7 +717,7 @@ static int ufs_update_inode(struct inode * inode, int do_sync)
|
|||||||
unsigned i;
|
unsigned i;
|
||||||
unsigned flags;
|
unsigned flags;
|
||||||
|
|
||||||
UFSD(("ENTER, ino %lu\n", inode->i_ino))
|
UFSD("ENTER, ino %lu\n", inode->i_ino);
|
||||||
|
|
||||||
sb = inode->i_sb;
|
sb = inode->i_sb;
|
||||||
uspi = UFS_SB(sb)->s_uspi;
|
uspi = UFS_SB(sb)->s_uspi;
|
||||||
@ -787,7 +778,7 @@ static int ufs_update_inode(struct inode * inode, int do_sync)
|
|||||||
sync_dirty_buffer(bh);
|
sync_dirty_buffer(bh);
|
||||||
brelse (bh);
|
brelse (bh);
|
||||||
|
|
||||||
UFSD(("EXIT\n"))
|
UFSD("EXIT\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,17 +34,6 @@
|
|||||||
#include "swab.h" /* will go away - see comment in mknod() */
|
#include "swab.h" /* will go away - see comment in mknod() */
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
/*
|
|
||||||
#undef UFS_NAMEI_DEBUG
|
|
||||||
*/
|
|
||||||
#define UFS_NAMEI_DEBUG
|
|
||||||
|
|
||||||
#ifdef UFS_NAMEI_DEBUG
|
|
||||||
#define UFSD(x) printk("(%s, %d), %s: ", __FILE__, __LINE__, __FUNCTION__); printk x;
|
|
||||||
#else
|
|
||||||
#define UFSD(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static inline int ufs_add_nondir(struct dentry *dentry, struct inode *inode)
|
static inline int ufs_add_nondir(struct dentry *dentry, struct inode *inode)
|
||||||
{
|
{
|
||||||
int err = ufs_add_link(dentry, inode);
|
int err = ufs_add_link(dentry, inode);
|
||||||
@ -90,8 +79,13 @@ static struct dentry *ufs_lookup(struct inode * dir, struct dentry *dentry, stru
|
|||||||
static int ufs_create (struct inode * dir, struct dentry * dentry, int mode,
|
static int ufs_create (struct inode * dir, struct dentry * dentry, int mode,
|
||||||
struct nameidata *nd)
|
struct nameidata *nd)
|
||||||
{
|
{
|
||||||
struct inode * inode = ufs_new_inode(dir, mode);
|
struct inode *inode;
|
||||||
int err = PTR_ERR(inode);
|
int err;
|
||||||
|
|
||||||
|
UFSD("BEGIN\n");
|
||||||
|
inode = ufs_new_inode(dir, mode);
|
||||||
|
err = PTR_ERR(inode);
|
||||||
|
|
||||||
if (!IS_ERR(inode)) {
|
if (!IS_ERR(inode)) {
|
||||||
inode->i_op = &ufs_file_inode_operations;
|
inode->i_op = &ufs_file_inode_operations;
|
||||||
inode->i_fop = &ufs_file_operations;
|
inode->i_fop = &ufs_file_operations;
|
||||||
@ -101,6 +95,7 @@ static int ufs_create (struct inode * dir, struct dentry * dentry, int mode,
|
|||||||
err = ufs_add_nondir(dentry, inode);
|
err = ufs_add_nondir(dentry, inode);
|
||||||
unlock_kernel();
|
unlock_kernel();
|
||||||
}
|
}
|
||||||
|
UFSD("END: err=%d\n", err);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
106
fs/ufs/super.c
106
fs/ufs/super.c
@ -90,18 +90,7 @@
|
|||||||
#include "swab.h"
|
#include "swab.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#undef UFS_SUPER_DEBUG
|
#ifdef CONFIG_UFS_DEBUG
|
||||||
#undef UFS_SUPER_DEBUG_MORE
|
|
||||||
|
|
||||||
|
|
||||||
#undef UFS_SUPER_DEBUG_MORE
|
|
||||||
#ifdef UFS_SUPER_DEBUG
|
|
||||||
#define UFSD(x) printk("(%s, %d), %s: ", __FILE__, __LINE__, __FUNCTION__); printk x;
|
|
||||||
#else
|
|
||||||
#define UFSD(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef UFS_SUPER_DEBUG_MORE
|
|
||||||
/*
|
/*
|
||||||
* Print contents of ufs_super_block, useful for debugging
|
* Print contents of ufs_super_block, useful for debugging
|
||||||
*/
|
*/
|
||||||
@ -157,17 +146,22 @@ void ufs2_print_super_stuff(
|
|||||||
printk("ufs_print_super_stuff\n");
|
printk("ufs_print_super_stuff\n");
|
||||||
printk("size of usb: %u\n", sizeof(struct ufs_super_block));
|
printk("size of usb: %u\n", sizeof(struct ufs_super_block));
|
||||||
printk(" magic: 0x%x\n", fs32_to_cpu(sb, usb->fs_magic));
|
printk(" magic: 0x%x\n", fs32_to_cpu(sb, usb->fs_magic));
|
||||||
printk(" fs_size: %u\n",fs64_to_cpu(sb, usb->fs_u11.fs_u2.fs_size));
|
printk(" fs_size: %llu\n",
|
||||||
printk(" fs_dsize: %u\n",fs64_to_cpu(sb, usb->fs_u11.fs_u2.fs_dsize));
|
(unsigned long long)fs64_to_cpu(sb, usb->fs_u11.fs_u2.fs_size));
|
||||||
printk(" bsize: %u\n", fs32_to_cpu(usb, usb->fs_bsize));
|
printk(" fs_dsize: %llu\n",
|
||||||
printk(" fsize: %u\n", fs32_to_cpu(usb, usb->fs_fsize));
|
(unsigned long long)fs64_to_cpu(sb, usb->fs_u11.fs_u2.fs_dsize));
|
||||||
|
printk(" bsize: %u\n", fs32_to_cpu(sb, usb->fs_bsize));
|
||||||
|
printk(" fsize: %u\n", fs32_to_cpu(sb, usb->fs_fsize));
|
||||||
printk(" fs_volname: %s\n", usb->fs_u11.fs_u2.fs_volname);
|
printk(" fs_volname: %s\n", usb->fs_u11.fs_u2.fs_volname);
|
||||||
printk(" fs_fsmnt: %s\n", usb->fs_u11.fs_u2.fs_fsmnt);
|
printk(" fs_fsmnt: %s\n", usb->fs_u11.fs_u2.fs_fsmnt);
|
||||||
printk(" fs_sblockloc: %u\n",fs64_to_cpu(sb,
|
printk(" fs_sblockloc: %llu\n",
|
||||||
|
(unsigned long long)fs64_to_cpu(sb,
|
||||||
usb->fs_u11.fs_u2.fs_sblockloc));
|
usb->fs_u11.fs_u2.fs_sblockloc));
|
||||||
printk(" cs_ndir(No of dirs): %u\n",fs64_to_cpu(sb,
|
printk(" cs_ndir(No of dirs): %llu\n",
|
||||||
|
(unsigned long long)fs64_to_cpu(sb,
|
||||||
usb->fs_u11.fs_u2.fs_cstotal.cs_ndir));
|
usb->fs_u11.fs_u2.fs_cstotal.cs_ndir));
|
||||||
printk(" cs_nbfree(No of free blocks): %u\n",fs64_to_cpu(sb,
|
printk(" cs_nbfree(No of free blocks): %llu\n",
|
||||||
|
(unsigned long long)fs64_to_cpu(sb,
|
||||||
usb->fs_u11.fs_u2.fs_cstotal.cs_nbfree));
|
usb->fs_u11.fs_u2.fs_cstotal.cs_nbfree));
|
||||||
printk("\n");
|
printk("\n");
|
||||||
}
|
}
|
||||||
@ -207,7 +201,7 @@ void ufs_print_cylinder_stuff(struct super_block *sb, struct ufs_cylinder_group
|
|||||||
printk(" nclusterblks %u\n", fs32_to_cpu(sb, cg->cg_u.cg_44.cg_nclusterblks));
|
printk(" nclusterblks %u\n", fs32_to_cpu(sb, cg->cg_u.cg_44.cg_nclusterblks));
|
||||||
printk("\n");
|
printk("\n");
|
||||||
}
|
}
|
||||||
#endif /* UFS_SUPER_DEBUG_MORE */
|
#endif /* CONFIG_UFS_DEBUG */
|
||||||
|
|
||||||
static struct super_operations ufs_super_ops;
|
static struct super_operations ufs_super_ops;
|
||||||
|
|
||||||
@ -309,7 +303,7 @@ static int ufs_parse_options (char * options, unsigned * mount_options)
|
|||||||
{
|
{
|
||||||
char * p;
|
char * p;
|
||||||
|
|
||||||
UFSD(("ENTER\n"))
|
UFSD("ENTER\n");
|
||||||
|
|
||||||
if (!options)
|
if (!options)
|
||||||
return 1;
|
return 1;
|
||||||
@ -398,7 +392,7 @@ static int ufs_read_cylinder_structures (struct super_block *sb)
|
|||||||
unsigned size, blks, i;
|
unsigned size, blks, i;
|
||||||
unsigned flags = 0;
|
unsigned flags = 0;
|
||||||
|
|
||||||
UFSD(("ENTER\n"))
|
UFSD("ENTER\n");
|
||||||
|
|
||||||
uspi = sbi->s_uspi;
|
uspi = sbi->s_uspi;
|
||||||
|
|
||||||
@ -451,12 +445,12 @@ static int ufs_read_cylinder_structures (struct super_block *sb)
|
|||||||
sbi->s_cgno[i] = UFS_CGNO_EMPTY;
|
sbi->s_cgno[i] = UFS_CGNO_EMPTY;
|
||||||
}
|
}
|
||||||
for (i = 0; i < uspi->s_ncg; i++) {
|
for (i = 0; i < uspi->s_ncg; i++) {
|
||||||
UFSD(("read cg %u\n", i))
|
UFSD("read cg %u\n", i);
|
||||||
if (!(sbi->s_ucg[i] = sb_bread(sb, ufs_cgcmin(i))))
|
if (!(sbi->s_ucg[i] = sb_bread(sb, ufs_cgcmin(i))))
|
||||||
goto failed;
|
goto failed;
|
||||||
if (!ufs_cg_chkmagic (sb, (struct ufs_cylinder_group *) sbi->s_ucg[i]->b_data))
|
if (!ufs_cg_chkmagic (sb, (struct ufs_cylinder_group *) sbi->s_ucg[i]->b_data))
|
||||||
goto failed;
|
goto failed;
|
||||||
#ifdef UFS_SUPER_DEBUG_MORE
|
#ifdef CONFIG_UFS_DEBUG
|
||||||
ufs_print_cylinder_stuff(sb, (struct ufs_cylinder_group *) sbi->s_ucg[i]->b_data);
|
ufs_print_cylinder_stuff(sb, (struct ufs_cylinder_group *) sbi->s_ucg[i]->b_data);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -466,7 +460,7 @@ static int ufs_read_cylinder_structures (struct super_block *sb)
|
|||||||
sbi->s_cgno[i] = UFS_CGNO_EMPTY;
|
sbi->s_cgno[i] = UFS_CGNO_EMPTY;
|
||||||
}
|
}
|
||||||
sbi->s_cg_loaded = 0;
|
sbi->s_cg_loaded = 0;
|
||||||
UFSD(("EXIT\n"))
|
UFSD("EXIT\n");
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
failed:
|
failed:
|
||||||
@ -479,7 +473,7 @@ failed:
|
|||||||
for (i = 0; i < UFS_MAX_GROUP_LOADED; i++)
|
for (i = 0; i < UFS_MAX_GROUP_LOADED; i++)
|
||||||
kfree (sbi->s_ucpi[i]);
|
kfree (sbi->s_ucpi[i]);
|
||||||
}
|
}
|
||||||
UFSD(("EXIT (FAILED)\n"))
|
UFSD("EXIT (FAILED)\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -495,7 +489,7 @@ static void ufs_put_cylinder_structures (struct super_block *sb)
|
|||||||
unsigned char * base, * space;
|
unsigned char * base, * space;
|
||||||
unsigned blks, size, i;
|
unsigned blks, size, i;
|
||||||
|
|
||||||
UFSD(("ENTER\n"))
|
UFSD("ENTER\n");
|
||||||
|
|
||||||
uspi = sbi->s_uspi;
|
uspi = sbi->s_uspi;
|
||||||
|
|
||||||
@ -523,7 +517,7 @@ static void ufs_put_cylinder_structures (struct super_block *sb)
|
|||||||
brelse (sbi->s_ucg[i]);
|
brelse (sbi->s_ucg[i]);
|
||||||
kfree (sbi->s_ucg);
|
kfree (sbi->s_ucg);
|
||||||
kfree (base);
|
kfree (base);
|
||||||
UFSD(("EXIT\n"))
|
UFSD("EXIT\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ufs_fill_super(struct super_block *sb, void *data, int silent)
|
static int ufs_fill_super(struct super_block *sb, void *data, int silent)
|
||||||
@ -544,7 +538,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
|
|||||||
ubh = NULL;
|
ubh = NULL;
|
||||||
flags = 0;
|
flags = 0;
|
||||||
|
|
||||||
UFSD(("ENTER\n"))
|
UFSD("ENTER\n");
|
||||||
|
|
||||||
sbi = kmalloc(sizeof(struct ufs_sb_info), GFP_KERNEL);
|
sbi = kmalloc(sizeof(struct ufs_sb_info), GFP_KERNEL);
|
||||||
if (!sbi)
|
if (!sbi)
|
||||||
@ -552,7 +546,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
|
|||||||
sb->s_fs_info = sbi;
|
sb->s_fs_info = sbi;
|
||||||
memset(sbi, 0, sizeof(struct ufs_sb_info));
|
memset(sbi, 0, sizeof(struct ufs_sb_info));
|
||||||
|
|
||||||
UFSD(("flag %u\n", (int)(sb->s_flags & MS_RDONLY)))
|
UFSD("flag %u\n", (int)(sb->s_flags & MS_RDONLY));
|
||||||
|
|
||||||
#ifndef CONFIG_UFS_FS_WRITE
|
#ifndef CONFIG_UFS_FS_WRITE
|
||||||
if (!(sb->s_flags & MS_RDONLY)) {
|
if (!(sb->s_flags & MS_RDONLY)) {
|
||||||
@ -593,7 +587,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
|
|||||||
the rules */
|
the rules */
|
||||||
switch (sbi->s_mount_opt & UFS_MOUNT_UFSTYPE) {
|
switch (sbi->s_mount_opt & UFS_MOUNT_UFSTYPE) {
|
||||||
case UFS_MOUNT_UFSTYPE_44BSD:
|
case UFS_MOUNT_UFSTYPE_44BSD:
|
||||||
UFSD(("ufstype=44bsd\n"))
|
UFSD("ufstype=44bsd\n");
|
||||||
uspi->s_fsize = block_size = 512;
|
uspi->s_fsize = block_size = 512;
|
||||||
uspi->s_fmask = ~(512 - 1);
|
uspi->s_fmask = ~(512 - 1);
|
||||||
uspi->s_fshift = 9;
|
uspi->s_fshift = 9;
|
||||||
@ -602,7 +596,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
|
|||||||
flags |= UFS_DE_44BSD | UFS_UID_44BSD | UFS_ST_44BSD | UFS_CG_44BSD;
|
flags |= UFS_DE_44BSD | UFS_UID_44BSD | UFS_ST_44BSD | UFS_CG_44BSD;
|
||||||
break;
|
break;
|
||||||
case UFS_MOUNT_UFSTYPE_UFS2:
|
case UFS_MOUNT_UFSTYPE_UFS2:
|
||||||
UFSD(("ufstype=ufs2\n"));
|
UFSD("ufstype=ufs2\n");
|
||||||
super_block_offset=SBLOCK_UFS2;
|
super_block_offset=SBLOCK_UFS2;
|
||||||
uspi->s_fsize = block_size = 512;
|
uspi->s_fsize = block_size = 512;
|
||||||
uspi->s_fmask = ~(512 - 1);
|
uspi->s_fmask = ~(512 - 1);
|
||||||
@ -617,7 +611,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case UFS_MOUNT_UFSTYPE_SUN:
|
case UFS_MOUNT_UFSTYPE_SUN:
|
||||||
UFSD(("ufstype=sun\n"))
|
UFSD("ufstype=sun\n");
|
||||||
uspi->s_fsize = block_size = 1024;
|
uspi->s_fsize = block_size = 1024;
|
||||||
uspi->s_fmask = ~(1024 - 1);
|
uspi->s_fmask = ~(1024 - 1);
|
||||||
uspi->s_fshift = 10;
|
uspi->s_fshift = 10;
|
||||||
@ -628,7 +622,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case UFS_MOUNT_UFSTYPE_SUNx86:
|
case UFS_MOUNT_UFSTYPE_SUNx86:
|
||||||
UFSD(("ufstype=sunx86\n"))
|
UFSD("ufstype=sunx86\n");
|
||||||
uspi->s_fsize = block_size = 1024;
|
uspi->s_fsize = block_size = 1024;
|
||||||
uspi->s_fmask = ~(1024 - 1);
|
uspi->s_fmask = ~(1024 - 1);
|
||||||
uspi->s_fshift = 10;
|
uspi->s_fshift = 10;
|
||||||
@ -639,7 +633,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case UFS_MOUNT_UFSTYPE_OLD:
|
case UFS_MOUNT_UFSTYPE_OLD:
|
||||||
UFSD(("ufstype=old\n"))
|
UFSD("ufstype=old\n");
|
||||||
uspi->s_fsize = block_size = 1024;
|
uspi->s_fsize = block_size = 1024;
|
||||||
uspi->s_fmask = ~(1024 - 1);
|
uspi->s_fmask = ~(1024 - 1);
|
||||||
uspi->s_fshift = 10;
|
uspi->s_fshift = 10;
|
||||||
@ -654,7 +648,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case UFS_MOUNT_UFSTYPE_NEXTSTEP:
|
case UFS_MOUNT_UFSTYPE_NEXTSTEP:
|
||||||
UFSD(("ufstype=nextstep\n"))
|
UFSD("ufstype=nextstep\n");
|
||||||
uspi->s_fsize = block_size = 1024;
|
uspi->s_fsize = block_size = 1024;
|
||||||
uspi->s_fmask = ~(1024 - 1);
|
uspi->s_fmask = ~(1024 - 1);
|
||||||
uspi->s_fshift = 10;
|
uspi->s_fshift = 10;
|
||||||
@ -669,7 +663,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case UFS_MOUNT_UFSTYPE_NEXTSTEP_CD:
|
case UFS_MOUNT_UFSTYPE_NEXTSTEP_CD:
|
||||||
UFSD(("ufstype=nextstep-cd\n"))
|
UFSD("ufstype=nextstep-cd\n");
|
||||||
uspi->s_fsize = block_size = 2048;
|
uspi->s_fsize = block_size = 2048;
|
||||||
uspi->s_fmask = ~(2048 - 1);
|
uspi->s_fmask = ~(2048 - 1);
|
||||||
uspi->s_fshift = 11;
|
uspi->s_fshift = 11;
|
||||||
@ -684,7 +678,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case UFS_MOUNT_UFSTYPE_OPENSTEP:
|
case UFS_MOUNT_UFSTYPE_OPENSTEP:
|
||||||
UFSD(("ufstype=openstep\n"))
|
UFSD("ufstype=openstep\n");
|
||||||
uspi->s_fsize = block_size = 1024;
|
uspi->s_fsize = block_size = 1024;
|
||||||
uspi->s_fmask = ~(1024 - 1);
|
uspi->s_fmask = ~(1024 - 1);
|
||||||
uspi->s_fshift = 10;
|
uspi->s_fshift = 10;
|
||||||
@ -699,7 +693,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case UFS_MOUNT_UFSTYPE_HP:
|
case UFS_MOUNT_UFSTYPE_HP:
|
||||||
UFSD(("ufstype=hp\n"))
|
UFSD("ufstype=hp\n");
|
||||||
uspi->s_fsize = block_size = 1024;
|
uspi->s_fsize = block_size = 1024;
|
||||||
uspi->s_fmask = ~(1024 - 1);
|
uspi->s_fmask = ~(1024 - 1);
|
||||||
uspi->s_fshift = 10;
|
uspi->s_fshift = 10;
|
||||||
@ -820,11 +814,11 @@ magic_found:
|
|||||||
ubh = NULL;
|
ubh = NULL;
|
||||||
block_size = uspi->s_fsize;
|
block_size = uspi->s_fsize;
|
||||||
super_block_size = uspi->s_sbsize;
|
super_block_size = uspi->s_sbsize;
|
||||||
UFSD(("another value of block_size or super_block_size %u, %u\n", block_size, super_block_size))
|
UFSD("another value of block_size or super_block_size %u, %u\n", block_size, super_block_size);
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef UFS_SUPER_DEBUG_MORE
|
#ifdef CONFIG_UFS_DEBUG
|
||||||
if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2)
|
if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2)
|
||||||
ufs2_print_super_stuff(sb,usb);
|
ufs2_print_super_stuff(sb,usb);
|
||||||
else
|
else
|
||||||
@ -842,13 +836,13 @@ magic_found:
|
|||||||
(ufs_get_fs_state(sb, usb1, usb3) == (UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time))))) {
|
(ufs_get_fs_state(sb, usb1, usb3) == (UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time))))) {
|
||||||
switch(usb1->fs_clean) {
|
switch(usb1->fs_clean) {
|
||||||
case UFS_FSCLEAN:
|
case UFS_FSCLEAN:
|
||||||
UFSD(("fs is clean\n"))
|
UFSD("fs is clean\n");
|
||||||
break;
|
break;
|
||||||
case UFS_FSSTABLE:
|
case UFS_FSSTABLE:
|
||||||
UFSD(("fs is stable\n"))
|
UFSD("fs is stable\n");
|
||||||
break;
|
break;
|
||||||
case UFS_FSOSF1:
|
case UFS_FSOSF1:
|
||||||
UFSD(("fs is DEC OSF/1\n"))
|
UFSD("fs is DEC OSF/1\n");
|
||||||
break;
|
break;
|
||||||
case UFS_FSACTIVE:
|
case UFS_FSACTIVE:
|
||||||
printk("ufs_read_super: fs is active\n");
|
printk("ufs_read_super: fs is active\n");
|
||||||
@ -901,8 +895,8 @@ magic_found:
|
|||||||
uspi->s_fmask = fs32_to_cpu(sb, usb1->fs_fmask);
|
uspi->s_fmask = fs32_to_cpu(sb, usb1->fs_fmask);
|
||||||
uspi->s_bshift = fs32_to_cpu(sb, usb1->fs_bshift);
|
uspi->s_bshift = fs32_to_cpu(sb, usb1->fs_bshift);
|
||||||
uspi->s_fshift = fs32_to_cpu(sb, usb1->fs_fshift);
|
uspi->s_fshift = fs32_to_cpu(sb, usb1->fs_fshift);
|
||||||
UFSD(("uspi->s_bshift = %d,uspi->s_fshift = %d", uspi->s_bshift,
|
UFSD("uspi->s_bshift = %d,uspi->s_fshift = %d", uspi->s_bshift,
|
||||||
uspi->s_fshift));
|
uspi->s_fshift);
|
||||||
uspi->s_fpbshift = fs32_to_cpu(sb, usb1->fs_fragshift);
|
uspi->s_fpbshift = fs32_to_cpu(sb, usb1->fs_fragshift);
|
||||||
uspi->s_fsbtodb = fs32_to_cpu(sb, usb1->fs_fsbtodb);
|
uspi->s_fsbtodb = fs32_to_cpu(sb, usb1->fs_fsbtodb);
|
||||||
/* s_sbsize already set */
|
/* s_sbsize already set */
|
||||||
@ -935,12 +929,11 @@ magic_found:
|
|||||||
* Compute another frequently used values
|
* Compute another frequently used values
|
||||||
*/
|
*/
|
||||||
uspi->s_fpbmask = uspi->s_fpb - 1;
|
uspi->s_fpbmask = uspi->s_fpb - 1;
|
||||||
if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2) {
|
if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2)
|
||||||
uspi->s_apbshift = uspi->s_bshift - 3;
|
uspi->s_apbshift = uspi->s_bshift - 3;
|
||||||
}
|
else
|
||||||
else {
|
|
||||||
uspi->s_apbshift = uspi->s_bshift - 2;
|
uspi->s_apbshift = uspi->s_bshift - 2;
|
||||||
}
|
|
||||||
uspi->s_2apbshift = uspi->s_apbshift * 2;
|
uspi->s_2apbshift = uspi->s_apbshift * 2;
|
||||||
uspi->s_3apbshift = uspi->s_apbshift * 3;
|
uspi->s_3apbshift = uspi->s_apbshift * 3;
|
||||||
uspi->s_apb = 1 << uspi->s_apbshift;
|
uspi->s_apb = 1 << uspi->s_apbshift;
|
||||||
@ -975,7 +968,7 @@ magic_found:
|
|||||||
if (!ufs_read_cylinder_structures(sb))
|
if (!ufs_read_cylinder_structures(sb))
|
||||||
goto failed;
|
goto failed;
|
||||||
|
|
||||||
UFSD(("EXIT\n"))
|
UFSD("EXIT\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
dalloc_failed:
|
dalloc_failed:
|
||||||
@ -986,11 +979,11 @@ failed:
|
|||||||
kfree (uspi);
|
kfree (uspi);
|
||||||
kfree(sbi);
|
kfree(sbi);
|
||||||
sb->s_fs_info = NULL;
|
sb->s_fs_info = NULL;
|
||||||
UFSD(("EXIT (FAILED)\n"))
|
UFSD("EXIT (FAILED)\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
failed_nomem:
|
failed_nomem:
|
||||||
UFSD(("EXIT (NOMEM)\n"))
|
UFSD("EXIT (NOMEM)\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1002,7 +995,7 @@ static void ufs_write_super (struct super_block *sb) {
|
|||||||
|
|
||||||
lock_kernel();
|
lock_kernel();
|
||||||
|
|
||||||
UFSD(("ENTER\n"))
|
UFSD("ENTER\n");
|
||||||
flags = UFS_SB(sb)->s_flags;
|
flags = UFS_SB(sb)->s_flags;
|
||||||
uspi = UFS_SB(sb)->s_uspi;
|
uspi = UFS_SB(sb)->s_uspi;
|
||||||
usb1 = ubh_get_usb_first(uspi);
|
usb1 = ubh_get_usb_first(uspi);
|
||||||
@ -1017,7 +1010,7 @@ static void ufs_write_super (struct super_block *sb) {
|
|||||||
ubh_mark_buffer_dirty (USPI_UBH(uspi));
|
ubh_mark_buffer_dirty (USPI_UBH(uspi));
|
||||||
}
|
}
|
||||||
sb->s_dirt = 0;
|
sb->s_dirt = 0;
|
||||||
UFSD(("EXIT\n"))
|
UFSD("EXIT\n");
|
||||||
unlock_kernel();
|
unlock_kernel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1025,7 +1018,7 @@ static void ufs_put_super (struct super_block *sb)
|
|||||||
{
|
{
|
||||||
struct ufs_sb_info * sbi = UFS_SB(sb);
|
struct ufs_sb_info * sbi = UFS_SB(sb);
|
||||||
|
|
||||||
UFSD(("ENTER\n"))
|
UFSD("ENTER\n");
|
||||||
|
|
||||||
if (!(sb->s_flags & MS_RDONLY))
|
if (!(sb->s_flags & MS_RDONLY))
|
||||||
ufs_put_cylinder_structures (sb);
|
ufs_put_cylinder_structures (sb);
|
||||||
@ -1034,6 +1027,7 @@ static void ufs_put_super (struct super_block *sb)
|
|||||||
kfree (sbi->s_uspi);
|
kfree (sbi->s_uspi);
|
||||||
kfree (sbi);
|
kfree (sbi);
|
||||||
sb->s_fs_info = NULL;
|
sb->s_fs_info = NULL;
|
||||||
|
UFSD("EXIT\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,14 +49,6 @@
|
|||||||
#include "swab.h"
|
#include "swab.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#undef UFS_TRUNCATE_DEBUG
|
|
||||||
|
|
||||||
#ifdef UFS_TRUNCATE_DEBUG
|
|
||||||
#define UFSD(x) printk("(%s, %d), %s: ", __FILE__, __LINE__, __FUNCTION__); printk x;
|
|
||||||
#else
|
|
||||||
#define UFSD(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Secure deletion currently doesn't work. It interacts very badly
|
* Secure deletion currently doesn't work. It interacts very badly
|
||||||
* with buffers shared with memory mappings, and for that reason
|
* with buffers shared with memory mappings, and for that reason
|
||||||
@ -82,7 +74,7 @@ static int ufs_trunc_direct (struct inode * inode)
|
|||||||
unsigned i, tmp;
|
unsigned i, tmp;
|
||||||
int retry;
|
int retry;
|
||||||
|
|
||||||
UFSD(("ENTER\n"))
|
UFSD("ENTER\n");
|
||||||
|
|
||||||
sb = inode->i_sb;
|
sb = inode->i_sb;
|
||||||
uspi = UFS_SB(sb)->s_uspi;
|
uspi = UFS_SB(sb)->s_uspi;
|
||||||
@ -105,7 +97,7 @@ static int ufs_trunc_direct (struct inode * inode)
|
|||||||
block2 = ufs_fragstoblks (frag3);
|
block2 = ufs_fragstoblks (frag3);
|
||||||
}
|
}
|
||||||
|
|
||||||
UFSD(("frag1 %u, frag2 %u, block1 %u, block2 %u, frag3 %u, frag4 %u\n", frag1, frag2, block1, block2, frag3, frag4))
|
UFSD("frag1 %u, frag2 %u, block1 %u, block2 %u, frag3 %u, frag4 %u\n", frag1, frag2, block1, block2, frag3, frag4);
|
||||||
|
|
||||||
if (frag1 >= frag2)
|
if (frag1 >= frag2)
|
||||||
goto next1;
|
goto next1;
|
||||||
@ -171,7 +163,7 @@ next1:
|
|||||||
ufs_free_fragments (inode, tmp, frag4);
|
ufs_free_fragments (inode, tmp, frag4);
|
||||||
next3:
|
next3:
|
||||||
|
|
||||||
UFSD(("EXIT\n"))
|
UFSD("EXIT\n");
|
||||||
return retry;
|
return retry;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,7 +178,7 @@ static int ufs_trunc_indirect (struct inode * inode, unsigned offset, __fs32 *p)
|
|||||||
unsigned frag_to_free, free_count;
|
unsigned frag_to_free, free_count;
|
||||||
int retry;
|
int retry;
|
||||||
|
|
||||||
UFSD(("ENTER\n"))
|
UFSD("ENTER\n");
|
||||||
|
|
||||||
sb = inode->i_sb;
|
sb = inode->i_sb;
|
||||||
uspi = UFS_SB(sb)->s_uspi;
|
uspi = UFS_SB(sb)->s_uspi;
|
||||||
@ -252,7 +244,7 @@ static int ufs_trunc_indirect (struct inode * inode, unsigned offset, __fs32 *p)
|
|||||||
}
|
}
|
||||||
ubh_brelse (ind_ubh);
|
ubh_brelse (ind_ubh);
|
||||||
|
|
||||||
UFSD(("EXIT\n"))
|
UFSD("EXIT\n");
|
||||||
|
|
||||||
return retry;
|
return retry;
|
||||||
}
|
}
|
||||||
@ -266,7 +258,7 @@ static int ufs_trunc_dindirect (struct inode *inode, unsigned offset, __fs32 *p)
|
|||||||
__fs32 * dind;
|
__fs32 * dind;
|
||||||
int retry = 0;
|
int retry = 0;
|
||||||
|
|
||||||
UFSD(("ENTER\n"))
|
UFSD("ENTER\n");
|
||||||
|
|
||||||
sb = inode->i_sb;
|
sb = inode->i_sb;
|
||||||
uspi = UFS_SB(sb)->s_uspi;
|
uspi = UFS_SB(sb)->s_uspi;
|
||||||
@ -315,7 +307,7 @@ static int ufs_trunc_dindirect (struct inode *inode, unsigned offset, __fs32 *p)
|
|||||||
}
|
}
|
||||||
ubh_brelse (dind_bh);
|
ubh_brelse (dind_bh);
|
||||||
|
|
||||||
UFSD(("EXIT\n"))
|
UFSD("EXIT\n");
|
||||||
|
|
||||||
return retry;
|
return retry;
|
||||||
}
|
}
|
||||||
@ -330,7 +322,7 @@ static int ufs_trunc_tindirect (struct inode * inode)
|
|||||||
__fs32 * tind, * p;
|
__fs32 * tind, * p;
|
||||||
int retry;
|
int retry;
|
||||||
|
|
||||||
UFSD(("ENTER\n"))
|
UFSD("ENTER\n");
|
||||||
|
|
||||||
sb = inode->i_sb;
|
sb = inode->i_sb;
|
||||||
uspi = UFS_SB(sb)->s_uspi;
|
uspi = UFS_SB(sb)->s_uspi;
|
||||||
@ -375,7 +367,7 @@ static int ufs_trunc_tindirect (struct inode * inode)
|
|||||||
}
|
}
|
||||||
ubh_brelse (tind_bh);
|
ubh_brelse (tind_bh);
|
||||||
|
|
||||||
UFSD(("EXIT\n"))
|
UFSD("EXIT\n");
|
||||||
return retry;
|
return retry;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -386,7 +378,7 @@ void ufs_truncate (struct inode * inode)
|
|||||||
struct ufs_sb_private_info * uspi;
|
struct ufs_sb_private_info * uspi;
|
||||||
int retry;
|
int retry;
|
||||||
|
|
||||||
UFSD(("ENTER\n"))
|
UFSD("ENTER\n");
|
||||||
sb = inode->i_sb;
|
sb = inode->i_sb;
|
||||||
uspi = UFS_SB(sb)->s_uspi;
|
uspi = UFS_SB(sb)->s_uspi;
|
||||||
|
|
||||||
@ -417,5 +409,5 @@ void ufs_truncate (struct inode * inode)
|
|||||||
ufsi->i_lastfrag = DIRECT_FRAGMENT;
|
ufsi->i_lastfrag = DIRECT_FRAGMENT;
|
||||||
unlock_kernel();
|
unlock_kernel();
|
||||||
mark_inode_dirty(inode);
|
mark_inode_dirty(inode);
|
||||||
UFSD(("EXIT\n"))
|
UFSD("EXIT\n");
|
||||||
}
|
}
|
||||||
|
@ -14,15 +14,6 @@
|
|||||||
#include "swab.h"
|
#include "swab.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#undef UFS_UTILS_DEBUG
|
|
||||||
|
|
||||||
#ifdef UFS_UTILS_DEBUG
|
|
||||||
#define UFSD(x) printk("(%s, %d), %s: ", __FILE__, __LINE__, __FUNCTION__); printk x;
|
|
||||||
#else
|
|
||||||
#define UFSD(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
struct ufs_buffer_head * _ubh_bread_ (struct ufs_sb_private_info * uspi,
|
struct ufs_buffer_head * _ubh_bread_ (struct ufs_sb_private_info * uspi,
|
||||||
struct super_block *sb, u64 fragment, u64 size)
|
struct super_block *sb, u64 fragment, u64 size)
|
||||||
{
|
{
|
||||||
|
@ -221,6 +221,19 @@ typedef __u16 __bitwise __fs16;
|
|||||||
#define UFS_MINFREE 5
|
#define UFS_MINFREE 5
|
||||||
#define UFS_DEFAULTOPT UFS_OPTTIME
|
#define UFS_DEFAULTOPT UFS_OPTTIME
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Debug code
|
||||||
|
*/
|
||||||
|
#ifdef CONFIG_UFS_DEBUG
|
||||||
|
# define UFSD(f, a...) { \
|
||||||
|
printk ("UFSD (%s, %d): %s:", \
|
||||||
|
__FILE__, __LINE__, __FUNCTION__); \
|
||||||
|
printk (f, ## a); \
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
# define UFSD(f, a...) /**/
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Turn file system block numbers into disk block addresses.
|
* Turn file system block numbers into disk block addresses.
|
||||||
* This maps file system blocks to device size blocks.
|
* This maps file system blocks to device size blocks.
|
||||||
|
Loading…
Reference in New Issue
Block a user