modules/vfs_readahead.c

ソースコードを見る。

データ構造

struct  readahead_data

関数

static ssize_t readahead_sendfile (struct vfs_handle_struct *handle, int tofd, files_struct *fsp, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count)
static ssize_t readahead_pread (vfs_handle_struct *handle, files_struct *fsp, int fd, void *data, size_t count, SMB_OFF_T offset)
static void free_readahead_data (void **pptr)
static int readahead_connect (struct vfs_handle_struct *handle, const char *service, const char *user)
NTSTATUS vfs_readahead_init (void)

変数

static BOOL didmsg
static vfs_op_tuple readahead_ops []


関数

static ssize_t readahead_sendfile ( struct vfs_handle_struct handle,
int  tofd,
files_struct fsp,
int  fromfd,
const DATA_BLOB header,
SMB_OFF_T  offset,
size_t  count 
) [static]

vfs_readahead.c41 行で定義されています。

参照先 readahead_data::didmsgerrhandlereadahead_data::lenreadahead_data::off_bound.

00048 {
00049         struct readahead_data *rhd = (struct readahead_data *)handle->data;
00050 
00051         if ( offset % rhd->off_bound == 0) {
00052 #if defined(HAVE_LINUX_READAHEAD)
00053                 int err = readahead(fromfd, offset, (size_t)rhd->len);
00054                 DEBUG(10,("readahead_sendfile: readahead on fd %u, offset %llu, len %u returned %d\n",
00055                         (unsigned int)fromfd,
00056                         (unsigned long long)offset,
00057                         (unsigned int)rhd->len,
00058                         err ));
00059 #elif defined(HAVE_POSIX_FADVISE)
00060                 int err = posix_fadvise(fromfd, offset, (off_t)rhd->len, POSIX_FADV_WILLNEED);
00061                 DEBUG(10,("readahead_sendfile: posix_fadvise on fd %u, offset %llu, len %u returned %d\n",
00062                         (unsigned int)fromfd,
00063                         (unsigned long long)offset,
00064                         (unsigned int)rhd->len,
00065                         err ));
00066 #else
00067                 if (!rhd->didmsg) {
00068                         DEBUG(0,("readahead_sendfile: no readahead on this platform\n"));
00069                         rhd->didmsg = True;
00070                 }
00071 #endif
00072         }
00073         return SMB_VFS_NEXT_SENDFILE(handle,
00074                                         tofd,
00075                                         fsp,
00076                                         fromfd,
00077                                         header,
00078                                         offset,
00079                                         count);
00080 }

static ssize_t readahead_pread ( vfs_handle_struct handle,
files_struct fsp,
int  fd,
void *  data,
size_t  count,
SMB_OFF_T  offset 
) [static]

vfs_readahead.c86 行で定義されています。

参照先 readahead_data::didmsgerrhandlereadahead_data::lenreadahead_data::off_bound.

00092 {
00093         struct readahead_data *rhd = (struct readahead_data *)handle->data;
00094 
00095         if ( offset % rhd->off_bound == 0) {
00096 #if defined(HAVE_LINUX_READAHEAD)
00097                 int err = readahead(fd, offset, (size_t)rhd->len);
00098                 DEBUG(10,("readahead_pread: readahead on fd %u, offset %llu, len %u returned %d\n",
00099                         (unsigned int)fd,
00100                         (unsigned long long)offset,
00101                         (unsigned int)rhd->len,
00102                         err ));
00103 #elif defined(HAVE_POSIX_FADVISE)
00104                 int err = posix_fadvise(fd, offset, (off_t)rhd->len, POSIX_FADV_WILLNEED);
00105                 DEBUG(10,("readahead_pread: posix_fadvise on fd %u, offset %llu, len %u returned %d\n",
00106                         (unsigned int)fd,
00107                         (unsigned long long)offset,
00108                         (unsigned int)rhd->len,
00109                         err ));
00110 #else
00111                 if (!rhd->didmsg) {
00112                         DEBUG(0,("readahead_pread: no readahead on this platform\n"));
00113                         rhd->didmsg = True;
00114                 }
00115 #endif
00116         }
00117         return SMB_VFS_NEXT_PREAD(handle, fsp, fd, data, count, offset);
00118 }

static void free_readahead_data ( void **  pptr  )  [static]

vfs_readahead.c124 行で定義されています。

参照元 readahead_connect().

00125 {
00126         SAFE_FREE(*pptr);
00127 }

static int readahead_connect ( struct vfs_handle_struct handle,
const char *  service,
const char *  user 
) [static]

vfs_readahead.c134 行で定義されています。

参照先 conv_str_size()readahead_data::didmsgfree_readahead_data()handlereadahead_data::lenlp_parm_const_string()readahead_data::off_bound.

00137 {
00138         struct readahead_data *rhd = SMB_MALLOC_P(struct readahead_data);
00139         if (!rhd) {
00140                 DEBUG(0,("readahead_connect: out of memory\n"));
00141                 return -1;
00142         }
00143         ZERO_STRUCTP(rhd);
00144 
00145         rhd->didmsg = False;
00146         rhd->off_bound = conv_str_size(lp_parm_const_string(SNUM(handle->conn),
00147                                                 "readahead",
00148                                                 "offset",
00149                                                 NULL));
00150         if (rhd->off_bound == 0) {
00151                 rhd->off_bound = 0x80000;
00152         }
00153         rhd->len = conv_str_size(lp_parm_const_string(SNUM(handle->conn),
00154                                                 "readahead",
00155                                                 "length",
00156                                                 NULL));
00157         if (rhd->len == 0) {
00158                 rhd->len = rhd->off_bound;
00159         }
00160 
00161         handle->data = (void *)rhd;
00162         handle->free_data = free_readahead_data;
00163         return SMB_VFS_NEXT_CONNECT(handle, service, user);
00164 }

NTSTATUS vfs_readahead_init ( void   ) 

vfs_readahead.c185 行で定義されています。

参照先 readahead_opssmb_register_vfs().

00186 {
00187         return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "readahead", readahead_ops);
00188 }


変数

BOOL didmsg [static]

vfs_readahead.c22 行で定義されています。

vfs_op_tuple readahead_ops[] [static]

初期値:

{
        {SMB_VFS_OP(readahead_sendfile), SMB_VFS_OP_SENDFILE, SMB_VFS_LAYER_TRANSPARENT},
        {SMB_VFS_OP(readahead_pread), SMB_VFS_OP_PREAD, SMB_VFS_LAYER_TRANSPARENT},
        {SMB_VFS_OP(readahead_connect), SMB_VFS_OP_CONNECT,  SMB_VFS_LAYER_TRANSPARENT},
        {SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP}
}

vfs_readahead.c172 行で定義されています。

参照元 vfs_readahead_init().


Sambaに対してSat Aug 29 21:23:52 2009に生成されました。  doxygen 1.4.7