1. 22 11月, 2008 3 次提交
    • A
      UBIFS: pre-allocate bulk-read buffer · 3477d204
      Artem Bityutskiy 提交于
      To avoid memory allocation failure during bulk-read, pre-allocate
      a bulk-read buffer, so that if there is only one bulk-reader at
      a time, it would just use the pre-allocated buffer and would not
      do any memory allocation. However, if there are more than 1 bulk-
      reader, then only one reader would use the pre-allocated buffer,
      while the other reader would allocate the buffer for itself.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      3477d204
    • A
      UBIFS: do not allocate too much · 6c0c42cd
      Artem Bityutskiy 提交于
      Bulk-read allocates 128KiB or more using kmalloc. The allocation
      starts failing often when the memory gets fragmented. UBIFS still
      works fine in this case, because it falls-back to standard
      (non-optimized) read method, though. This patch teaches bulk-read
      to allocate exactly the amount of memory it needs, instead of
      allocating 128KiB every time.
      
      This patch is also a preparation to the further fix where we'll
      have a pre-allocated bulk-read buffer as well. For example, now
      the @bu object is prepared in 'ubifs_bulk_read()', so we could
      path either pre-allocated or allocated information to
      'ubifs_do_bulk_read()' later. Or teaching 'ubifs_do_bulk_read()'
      not to allocate 'bu->buf' if it is already there.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      6c0c42cd
    • A
      UBIFS: do not print scary memory allocation warnings · 39ce81ce
      Artem Bityutskiy 提交于
      Bulk-read allocates a lot of memory with 'kmalloc()', and when it
      is/gets fragmented 'kmalloc()' fails with a scarry warning. But
      because bulk-read is just an optimization, UBIFS keeps working fine.
      Supress the warning by passing __GFP_NOWARN option to 'kmalloc()'.
      
      This patch also introduces a macro for the magic 128KiB constant.
      This is just neater.
      
      Note, this is not really fixes the problem we had, but just hides
      the warnings. The further patches fix the problem.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      39ce81ce
  2. 06 11月, 2008 1 次提交
    • H
      UBIFS: endian handling fixes and annotations · 0ecb9529
      Harvey Harrison 提交于
      Noticed by sparse:
      fs/ubifs/file.c:75:2: warning: restricted __le64 degrades to integer
      fs/ubifs/file.c:629:4: warning: restricted __le64 degrades to integer
      fs/ubifs/dir.c:431:3: warning: restricted __le64 degrades to integer
      
      This should be checked to ensure the ubifs_assert is working as
      intended, I've done the suggested annotation in this patch.
      
      fs/ubifs/sb.c:298:6: warning: incorrect type in assignment (different base types)
      fs/ubifs/sb.c:298:6:    expected int [signed] [assigned] tmp
      fs/ubifs/sb.c:298:6:    got restricted __le64 [usertype] <noident>
      fs/ubifs/sb.c:299:19: warning: incorrect type in assignment (different base types)
      fs/ubifs/sb.c:299:19:    expected restricted __le64 [usertype] atime_sec
      fs/ubifs/sb.c:299:19:    got int [signed] [assigned] tmp
      fs/ubifs/sb.c:300:19: warning: incorrect type in assignment (different base types)
      fs/ubifs/sb.c:300:19:    expected restricted __le64 [usertype] ctime_sec
      fs/ubifs/sb.c:300:19:    got int [signed] [assigned] tmp
      fs/ubifs/sb.c:301:19: warning: incorrect type in assignment (different base types)
      fs/ubifs/sb.c:301:19:    expected restricted __le64 [usertype] mtime_sec
      fs/ubifs/sb.c:301:19:    got int [signed] [assigned] tmp
      
      This looks like a bugfix as your tmp was a u32 so there was truncation in
      the atime, mtime, ctime value, probably not intentional, add a tmp_le64
      and use it here.
      
      fs/ubifs/key.h:348:9: warning: cast to restricted __le32
      fs/ubifs/key.h:348:9: warning: cast to restricted __le32
      fs/ubifs/key.h:419:9: warning: cast to restricted __le32
      
      Read from the annotated union member instead.
      
      fs/ubifs/recovery.c:175:13: warning: incorrect type in assignment (different base types)
      fs/ubifs/recovery.c:175:13:    expected unsigned int [unsigned] [usertype] save_flags
      fs/ubifs/recovery.c:175:13:    got restricted __le32 [usertype] flags
      fs/ubifs/recovery.c:186:13: warning: incorrect type in assignment (different base types)
      fs/ubifs/recovery.c:186:13:    expected restricted __le32 [usertype] flags
      fs/ubifs/recovery.c:186:13:    got unsigned int [unsigned] [usertype] save_flags
      
      Do byteshifting at compile time of the flag value.  Annotate the saved_flags
      as le32.
      
      fs/ubifs/debug.c:368:10: warning: cast to restricted __le32
      fs/ubifs/debug.c:368:10: warning: cast from restricted __le64
      
      Should be checked if the truncation was intentional, I've changed the
      printk to print the full width.
      Signed-off-by: NHarvey Harrison <harvey.harrison@gmail.com>
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      0ecb9529
  3. 30 9月, 2008 3 次提交
  4. 21 8月, 2008 1 次提交
  5. 13 8月, 2008 3 次提交
  6. 27 7月, 2008 1 次提交
  7. 15 7月, 2008 1 次提交