------------------------------------------------------------
revno: 675
revision-id:[EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Andrew Tridgell <[EMAIL PROTECTED]>
branch nick: s3-ctdb-tridge
timestamp: Fri 2007-11-23 12:58:52 +1100
message:
- if dmapi is failing to respond, assume offline rather than online if
the st_blocks heuristic makes this likely
- if st_size is zero then we know the file is not offline
modified:
source/modules/vfs_tsmsm.c vfs_tsmsm.c-20070827024912-m3pirz28sej5g6pz-1
=== modified file 'source/modules/vfs_tsmsm.c'
--- a/source/modules/vfs_tsmsm.c 2007-11-23 01:54:44 +0000
+++ b/source/modules/vfs_tsmsm.c 2007-11-23 01:58:52 +0000
@@ -150,7 +150,7 @@
/* if the file has more than FILE_IS_ONLINE_RATIO of blocks available,
then assume it is not offline (it may not be 100%, as it could be
sparse) */
- if (512 * (off_t)stbuf->st_blocks > stbuf->st_size *
tsmd->online_ratio) {
+ if (512 * (off_t)stbuf->st_blocks >= stbuf->st_size *
tsmd->online_ratio) {
*offline = false;
DEBUG(10,("%s not offline: st_blocks=%ld st_size=%ld
online_ratio=%.2f\n", path, stbuf->st_blocks, stbuf->st_size,
tsmd->online_ratio));
return 0;
@@ -163,7 +163,9 @@
/* go the slow DMAPI route */
if (dm_path_to_handle((char*)path, &dmhandle, &dmhandle_len) != 0) {
ret = -1;
- DEBUG(2,("dm_path_to_handle failed (%s) - %s\n", path,
strerror(errno)));
+ DEBUG(2,("dm_path_to_handle failed - assuming offline (%s) -
%s\n",
+ path, strerror(errno)));
+ *offline = true;
goto done;
}
@@ -199,7 +201,7 @@
*/
if(SMB_VFS_FSTAT(fsp, fsp->fh->fd, &sbuf) == 0) {
DEBUG(10,("tsmsm_aio_force st_blocks=%ld st_size=%ld
online_ratio=%.2f\n", sbuf.st_blocks, sbuf.st_size, tsmd->online_ratio));
- return !(512 * (off_t)sbuf.st_blocks > sbuf.st_size *
tsmd->online_ratio);
+ return !(512 * (off_t)sbuf.st_blocks >= sbuf.st_size *
tsmd->online_ratio);
}
return False;
}