Главная страница


ru.unix.bsd

 
 - RU.UNIX.BSD ------------------------------------------------------------------
 From : Valeriy E. Ushakov                   2:5020/400     23 Feb 2003  21:54:36
 To : Eugene Grosbein
 Subject : Re: nfsiod
 -------------------------------------------------------------------------------- 
 
 Eugene Grosbein <Eugene.Grosbein@f1.n5006.z2.fidonet.org> wrote:
 
 > Hо зачем? Из /etc/sysctl.conf выставить, во время загрузки системы
 > включить кеширование и пусть ядро само. Зачем демон-то?
 
 Для того, чтобы ядро само.  Чтобы ядро само - ему нужен execution
 context.  Демон, выполнив non-returning syscall, этот execution
 context ядру и обеспечивает в лице своего process context.  Если ядро
 умеет ядерные thread'ы, то и демона не надо.
 
 См. также "NFS Illustrated", 8.12 "Read-ahead and Write-behind",
 pp241-242.
 
 Вот как это выглядит в NetBSD (sys/nfs/nfs_syscalls.c):
 
 /*
  * Nfs server pseudo system call for the nfsd's
  * Based on the flag value it either:
  * - adds a socket to the selection list
  * - remains in the kernel as an nfsd
  * - remains in the kernel as an nfsiod
  */
 int
 sys_nfssvc(l, v, retval)
         struct lwp *l;
         void *v;
         register_t *retval;
 {
 [...]
 
         if (SCARG(uap, flag) & NFSSVC_BIOD) {
 #if defined(NFS) && defined(COMPAT_14)
                 error = nfssvc_iod(l);
 #else
                 error = ENOSYS;
 #endif
   }
 [...]
 }
 
 /*
  * Asynchronous I/O threads for client nfs.
  * They do read-ahead and write-behind operations on the block I/O cache.
  * Never returns unless it fails or gets killed.
  */
 int
 nfssvc_iod(l)
         struct lwp *l;
 {
 [...]
         /*
          * Just loop around doing our stuff until SIGKILL
          */
         for (;;) {
 [...]
                 (void) nfs_doio(bp, NULL);
 [...]
   }
 [...]
 }
 
 void
 start_nfsio(arg)
         void *arg;
 {
         nfssvc_iod(curlwp);
         
         kthread_exit(0);
 }
 
 void
 nfs_getset_niothreads(set)
         int set;
 {
 [...]
                 start = nfs_niothreads - have;
 
                 while (start > 0) {
                         kthread_create1(start_nfsio, NULL, NULL, "nfsio");
                         start--;
                 }
 [...]
 }
 
 T.e. execution context (struct lwp * в NetBSD-current, или struct proc *
 в 1.5 и 1.6) до 1.5 обеспечивался демоном.  В 1.5 появились kthreads и
 необходимость в демоне отпала, но флаг в syscall'е остался доступен
 при включенной опции COMPAT_14.
 
 SY, Uwe
 -- 
 uwe@ptc.spbu.ru                         |       Zu Grunde kommen
 http://www.ptc.spbu.ru/~uwe/            |       Ist zu Grunde gehen
 --- ifmail v.2.15dev5
  * Origin: St.Petersburg University NOC (2:5020/400)
 
 

Вернуться к списку тем, сортированных по: возрастание даты  уменьшение даты  тема  автор 

 Тема:    Автор:    Дата:  
 Re: nfsiod   Valeriy E. Ushakov   23 Feb 2003 21:54:36 
Архивное /ru.unix.bsd/65787df6e732.html, оценка 1 из 5, голосов 10
Яндекс.Метрика
Valid HTML 4.01 Transitional