Hi!

----

I'm getting a warning from "clang" when building ast-ksh.2013-04-09
related to sfio's |mmap()| I/O support:
-- snip --
src/lib/libast/sfio/sfmode.c:408:45: warning: comparison of constant
4096 with expression of type 'unsigned char'
is always false [-Wtautological-constant-out-of-range-compare]
                if((f->bits&SF_MMAP) && (f->tiny[0] += 1) >= (4*SF_NMAP) )
                                        ~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~
1 warning generated.
-- snip --

The related code looks like this:
-- snip --
   407  #if _mmap_worthy
   408                  if((f->bits&SF_MMAP) && (f->tiny[0] += 1) >=
(4*SF_NMAP) )
   409                  {       /* turn off mmap to avoid page faulting */
   410                          sfsetbuf(f,(Void_t*)f->tiny,(size_t)SF_UNBOUND);
   411                          f->tiny[0] = 0;
   412                  }
   413                  else
   414  #endif
-- snip --
... AFAIK we had that kind of warning for that line before.

AFAIK the code should turn-off |mmap()'ing of files if more than
(4*SF_NMAP) random accesses are made... right ?

However... I think the code has become useless:
1. The code was written _long_ ago and newer disks (not even counting
RAID configurations or SSD) have 4k block size (matching |(4*SF_NMAP)|
on AMD64/64bit) ... rendering the check more or less defunct since
even random file accesses via |read()| will fetch 4k blocks anyway
2. We always disabled that check in the OpenSolaris ksh93-integration
project because benchmarking showed that this check usually hurt ksh93
I/O performance by a few percent if it kicked-in (which only happned
for 32bit builds (for the same reason as above...))

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) [email protected]
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)
_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to