/*
- * $Id: cache_cf.cc,v 1.361 2000/12/09 04:16:07 wessels Exp $
+ * $Id: cache_cf.cc,v 1.362 2001/01/02 01:41:30 wessels Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
/* XXX should we dupe the string here, in case it gets trodden on? */
sd->type = storefs_list[fs].typestr;
sd->max_objsize = maxobjsize;
+ /* defaults in case fs implementation fails to set these */
+ sd->fs.blksize = 1024;
+ sd->fs.kperblk = 1;
swap->n_configured++;
/* Update the max object size */
update_maxobjsize();
/*
- * $Id: store_dir_aufs.cc,v 1.22 2000/12/09 01:47:22 wessels Exp $
+ * $Id: store_dir_aufs.cc,v 1.23 2001/01/02 01:41:33 wessels Exp $
*
* DEBUG: section 47 Store Directory Routines
* AUTHOR: Duane Wessels
eventAdd("storeDirClean", storeAufsDirCleanEvent, NULL, 15.0, 1);
started_clean_event = 1;
}
+ if (0 == storeDirGetBlkSize(sd->path, &sd->fs.blksize))
+ sd->fs.kperblk = sd->fs.blksize >> 10;
}
static void
/*
- * $Id: store_dir_coss.cc,v 1.12 2000/12/09 00:35:04 wessels Exp $
+ * $Id: store_dir_coss.cc,v 1.13 2001/01/02 01:41:34 wessels Exp $
*
* DEBUG: section 81 Store COSS Directory Routines
* AUTHOR: Eric Stern
storeCossDirRebuild(sd);
cs->fd = file_open(sd->path, O_RDWR | O_CREAT);
n_coss_dirs++;
+ if (0 == storeDirGetBlkSize(sd->path, &sd->fs.blksize))
+ sd->fs.kperblk = sd->fs.blksize >> 10;
}
void
/*
- * $Id: store_dir_diskd.cc,v 1.29 2000/12/09 01:47:22 wessels Exp $
+ * $Id: store_dir_diskd.cc,v 1.30 2001/01/02 01:41:34 wessels Exp $
*
* DEBUG: section 47 Store Directory Routines
* AUTHOR: Duane Wessels
eventAdd("storeDirClean", storeDiskdDirCleanEvent, NULL, 15.0, 1);
started_clean_event = 1;
}
+ if (0 == storeDirGetBlkSize(sd->path, &sd->fs.blksize))
+ sd->fs.kperblk = sd->fs.blksize >> 10;
}
/*
- * $Id: store_dir_ufs.cc,v 1.20 2001/01/02 00:11:55 wessels Exp $
+ * $Id: store_dir_ufs.cc,v 1.21 2001/01/02 01:41:35 wessels Exp $
*
* DEBUG: section 47 Store Directory Routines
* AUTHOR: Duane Wessels
eventAdd("storeDirClean", storeUfsDirCleanEvent, NULL, 15.0, 1);
started_clean_event = 1;
}
+ if (0 == storeDirGetBlkSize(sd->path, &sd->fs.blksize))
+ sd->fs.kperblk = sd->fs.blksize >> 10;
}
static void
/*
- * $Id: protos.h,v 1.389 2000/12/30 23:29:07 wessels Exp $
+ * $Id: protos.h,v 1.390 2001/01/02 01:41:30 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
extern void storeDirCallback(void);
extern void storeDirLRUDelete(StoreEntry *);
extern void storeDirLRUAdd(StoreEntry *);
+int storeDirGetBlkSize(const char *path, int *blksize);
/*
* store_swapmeta.c
/*
- * $Id: store_dir.cc,v 1.117 2000/12/05 09:11:24 wessels Exp $
+ * $Id: store_dir.cc,v 1.118 2001/01/02 01:41:31 wessels Exp $
*
* DEBUG: section 47 Store Directory Routines
* AUTHOR: Duane Wessels
void
storeDirUpdateSwapSize(SwapDir * SD, size_t size, int sign)
{
- int k = ((size + 1023) >> 10) * sign;
+ int blks = (size + SD->fs.blksize - 1) / SD->fs.blksize;
+ int k = blks * SD->fs.kperblk * sign;
SD->cur_size += k;
store_swap_size += k;
if (sign > 0)
SD = &(Config.cacheSwap.swapDirs[i]);
storeAppendPrintf(sentry, "Store Directory #%d (%s): %s\n", i, SD->type,
storeSwapDir(i));
+ storeAppendPrintf(sentry, "FS Block Size %d KB\n",
+ SD->fs.kperblk);
SD->statfs(SD, sentry);
}
}
} while (j > 0);
ndir++;
}
+
+int
+storeDirGetBlkSize(const char *path, int *blksize)
+{
+#if HAVE_STATVFS
+ struct statvfs sfs;
+ if (statvfs(path, &sfs)) {
+ debug(0, 0) ("%s: %s\n", path, xstrerror());
+ return 1;
+ }
+#else
+ struct statfs sfs;
+ if (statfs(path, &sfs)) {
+ debug(0, 0) ("%s: %s\n", path, xstrerror());
+ return 1;
+ }
+#endif
+ *blksize = (int) sfs.f_bsize;
+ return 0;
+}
/*
- * $Id: structs.h,v 1.369 2001/01/01 23:09:59 wessels Exp $
+ * $Id: structs.h,v 1.370 2001/01/02 01:41:31 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
} clean;
int writes_since_clean;
} log;
+ struct {
+ int blksize;
+ int kperblk;
+ } fs;
void *fsdata;
};