Don't repeat out-of-space messages
This patch makes PFS, EXT2 and MFS print only once that they're out of space. After freeing up space and running out of space again, the message will be printed again also.
This commit is contained in:
parent
54c0eb9aa6
commit
c89bc85009
3 changed files with 19 additions and 10 deletions
|
@ -245,14 +245,18 @@ PUBLIC struct inode *alloc_inode(dev_t dev, mode_t bits)
|
|||
register struct inode *rip;
|
||||
bit_t b;
|
||||
ino_t i_num;
|
||||
int print_oos_msg = 1;
|
||||
|
||||
b = alloc_bit();
|
||||
if (b == NO_BIT) {
|
||||
err_code = ENOSPC;
|
||||
printf("PipeFS is out of inodes\n");
|
||||
if (print_oos_msg)
|
||||
printf("PipeFS is out of inodes\n");
|
||||
print_oos_msg = 0; /* Don't repeat message */
|
||||
return(NULL);
|
||||
}
|
||||
i_num = (ino_t) b;
|
||||
print_oos_msg = 1;
|
||||
|
||||
|
||||
/* Try to acquire a slot in the inode table. */
|
||||
|
|
|
@ -37,8 +37,9 @@ PUBLIC struct inode *alloc_inode(struct inode *parent, mode_t bits)
|
|||
|
||||
register struct inode *rip;
|
||||
register struct super_block *sp;
|
||||
int major, minor, inumb;
|
||||
int inumb;
|
||||
bit_t b;
|
||||
static int print_oos_msg = 1;
|
||||
|
||||
sp = get_super(parent->i_dev); /* get pointer to super_block */
|
||||
if (sp->s_rd_only) { /* can't allocate an inode on a read only device. */
|
||||
|
@ -50,11 +51,13 @@ PUBLIC struct inode *alloc_inode(struct inode *parent, mode_t bits)
|
|||
b = alloc_inode_bit(sp, parent, (bits & I_TYPE) == I_DIRECTORY);
|
||||
if (b == NO_BIT) {
|
||||
err_code = ENOSPC;
|
||||
major = (int) (sp->s_dev >> MAJOR) & BYTE;
|
||||
minor = (int) (sp->s_dev >> MINOR) & BYTE;
|
||||
ext2_debug("Out of i-nodes on device %d/%d\n", major, minor);
|
||||
if (print_oos_msg)
|
||||
ext2_debug("Out of i-nodes on device %d/%d\n",
|
||||
major(sp->s_dev), minor(sp->s_dev));
|
||||
print_oos_msg = 0; /* Don't repeat message */
|
||||
return(NULL);
|
||||
}
|
||||
print_oos_msg = 1;
|
||||
|
||||
inumb = (int) b; /* be careful not to pass unshort as param */
|
||||
|
||||
|
@ -79,7 +82,7 @@ PUBLIC struct inode *alloc_inode(struct inode *parent, mode_t bits)
|
|||
wipe_inode(rip);
|
||||
}
|
||||
|
||||
return(rip);
|
||||
return(rip);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -263,9 +263,9 @@ PUBLIC zone_t alloc_zone(
|
|||
{
|
||||
/* Allocate a new zone on the indicated device and return its number. */
|
||||
|
||||
int major, minor;
|
||||
bit_t b, bit;
|
||||
struct super_block *sp;
|
||||
static int print_oos_msg = 1;
|
||||
|
||||
/* Note that the routine alloc_bit() returns 1 for the lowest possible
|
||||
* zone, which corresponds to sp->s_firstdatazone. To convert a value
|
||||
|
@ -285,11 +285,13 @@ PUBLIC zone_t alloc_zone(
|
|||
b = alloc_bit(sp, ZMAP, bit);
|
||||
if (b == NO_BIT) {
|
||||
err_code = ENOSPC;
|
||||
major = (int) (sp->s_dev >> MAJOR) & BYTE;
|
||||
minor = (int) (sp->s_dev >> MINOR) & BYTE;
|
||||
printf("No space on device %d/%d\n", major, minor);
|
||||
if (print_oos_msg)
|
||||
printf("No space on device %d/%d\n", major(sp->s_dev),
|
||||
minor(sp->s_dev));
|
||||
print_oos_msg = 0; /* Don't repeat message */
|
||||
return(NO_ZONE);
|
||||
}
|
||||
print_oos_msg = 1;
|
||||
if (z == sp->s_firstdatazone) sp->s_zsearch = b; /* for next time */
|
||||
return( (zone_t) (sp->s_firstdatazone - 1) + (zone_t) b);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue