807 Commits

Author SHA1 Message Date
Ryusuke Konishi
8d8290f6b0 configure.ac: remove obsolete AC_HEADER_STDC marco
The AC_HEADER_STDC macro is diagnosed as obsolete in Autoconf 2.70 and
later:

 configure.ac:88: warning: The macro `AC_HEADER_STDC' is obsolete.
 configure.ac:88: You should run autoupdate.
 ./lib/autoconf/headers.m4:704: AC_HEADER_STDC is expanded from...
 configure.ac:88: the top level

Fix the warning just by removing the macro.  This looks to be fine so
far, but if we have problems with some legacy systems, we may need to
add individual remedies.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
2022-06-19 01:41:01 +09:00
Ryusuke Konishi
85ce12e08c configure.ac: use LT_INIT instead of AC_PROG_LIBTOOL
The latter is diagnosed as obsolete in Autoconf 2.70.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
2022-06-18 08:08:09 +09:00
Ryusuke Konishi
ba15536547 configure.ac: use AC_USE_SYSTEM_EXTENSIONS instead of AC_GNU_SOURCE
The latter is diagnosed as obsolete in Autoconf 2.70.  Use the former
to enables _GNU_SOURCE instead.  The AC_USE_SYSTEM_EXTENSIONS macro
was introduced in Autoconf 2.60 and allows to enable features of Posix
as well as platform extensions not defined by Posix.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
2022-06-18 08:08:09 +09:00
Ryusuke Konishi
44cc05f993 configure.ac: remove AC_PROG_CC_C99 macro
This macro is diagnosed as obsolete in Autconf 2.70.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
2022-06-18 08:08:09 +09:00
Ryusuke Konishi
efa9f3f60b configure.ac: use AC_CONFIG_HEADERS instead of AC_CONFIG_HEADER
The latter is diagnosed as obsolete in Autoconf 2.70.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
2022-06-18 08:08:09 +09:00
Ryusuke Konishi
d9611f5799 README: alter URLs referenced in the developer notes
Documentation for coding styles and patch submission rules no longer
exists at the URLs in the README file.

As alternatives, refer to the HTML documents on docs.kernel.org.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
2022-04-26 20:28:01 +09:00
Ryusuke Konishi
d83426d586 README: update git repository url
The git protocol on port 9418 is no longer supported on GitHub for
security purposes.

This patch updates the git clone command execution example in the
README file according to the change.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
2022-04-26 17:59:17 +09:00
Ryusuke Konishi
67c8bc1fe6 mkfs.nilfs2: fix wrong suggestion of minimum device size
Even if we give "required size" that mkfs.nilfs2 suggests for too
small devices, mkfs.nilfs2 fails due to the lack of consideration of
the trailing super block:

 Error: too small device.
        device size=134217728 bytes, required size=134217728 bytes.
        Please enlarge the device, or shorten segments with -B option.

This fixes the issue.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
2019-07-22 00:12:28 +09:00
Ryusuke Konishi
e0df62c997 mkfs.nilfs2: fix underflow in calculation of minimum number of segments
When device size is too small, mkfs.nilfs2 aborts with a message
suggesting a required device size.  However, this calculation
underflows and causes to report a huge value if the device size is
insufficient to keep a segment.

This fixes the issue and closes #14.

Reported-by: Евгений Кустов <megajohn@inbox.ru>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
2019-07-21 23:51:18 +09:00
Masahiro Yamada
5566e77338 nilfs2: do not use unexported cpu_to_le32()/le32_to_cpu() in uapi header
cpu_to_le32/le32_to_cpu is defined in include/linux/byteorder/generic.h,
which is not exported to user-space.

UAPI headers must use the ones prefixed with double-underscore.

Detected by compile-testing exported headers:

  include/linux/nilfs2_ondisk.h: In function `nilfs_checkpoint_set_snapshot':
  include/linux/nilfs2_ondisk.h:536:17: error: implicit declaration of function `cpu_to_le32' [-Werror=implicit-function-declaration]
    cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) |  \
                   ^
  include/linux/nilfs2_ondisk.h:552:1: note: in expansion of macro `NILFS_CHECKPOINT_FNS'
   NILFS_CHECKPOINT_FNS(SNAPSHOT, snapshot)
   ^~~~~~~~~~~~~~~~~~~~
  include/linux/nilfs2_ondisk.h:536:29: error: implicit declaration of function `le32_to_cpu' [-Werror=implicit-function-declaration]
    cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) |  \
                               ^
  include/linux/nilfs2_ondisk.h:552:1: note: in expansion of macro `NILFS_CHECKPOINT_FNS'
   NILFS_CHECKPOINT_FNS(SNAPSHOT, snapshot)
   ^~~~~~~~~~~~~~~~~~~~
  include/linux/nilfs2_ondisk.h: In function `nilfs_segment_usage_set_clean':
  include/linux/nilfs2_ondisk.h:622:19: error: implicit declaration of function `cpu_to_le64' [-Werror=implicit-function-declaration]
    su->su_lastmod = cpu_to_le64(0);
                     ^~~~~~~~~~~

Link: http://lkml.kernel.org/r/20190605053006.14332-1-yamada.masahiro@socionext.com
Fixes: e63e88bc53ba ("nilfs2: move ioctl interface and disk layout to uapi separately")
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: Joe Perches <joe@perches.com>
Cc: <stable@vger.kernel.org>	[4.9+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
2019-07-20 20:49:18 +09:00
Ryusuke Konishi
fc73d59dbf AUTHORS: update contributors
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
2019-07-20 20:17:01 +09:00
Ryusuke Konishi
45d40b47af nilfs-utils: update maintainer's email address
Update email addresses of NTT developers since lab.ntt.co.jp email
domain has been deprecated due to company policy.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
2019-07-20 13:23:53 +09:00
Andy Weidenbaum
cbc316f941 include <fcntl.h> for musl
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2019-01-18 15:10:28 +09:00
Ryusuke Konishi
a45ade6588 mkfs.nilfs2: fix library order of libuuid
Link option of uuid library ('-luuid') still appears in front of blkid
library ('-lblkid') even though the latter depends on the former.  Fix
the library order by swapping them.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2018-01-17 16:16:23 +09:00
Kurt Van Dijck
d5ce780856 libmount, libblkid: fix order of autoconf probing
make sure that libuuid is linked during probes.
Since libmount depends on libblkid, probe libblkid first.
This fixes autoprobing on systems that use static libraries exclusively

Signed-off-by: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2018-01-14 21:48:10 +09:00
Kurt Van Dijck
51b32c614b mount.nilfs: drop include rpc/types.h
rpc/types.h does not exist on low-footprint musl toolchains,
and is only required for the boolean types, which musl provides
elsewhere.
This commit drops the include completely.

Signed-off-by: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2018-01-14 18:50:05 +09:00
Kurt Van Dijck
115fe4b976 nilfs-utils: use _POSIX_MAX_INPUT
musl does provide _POSIX_MAX_INPUT, but no MAX_INPUT out of the box.
This commit assigns _POSIX_MAX_INPUT to MAX_INPUT.

Signed-off-by: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2018-01-14 18:49:57 +09:00
Ryusuke Konishi
b6df3ff712 manpages: update URLs of NILFS project home
The domain of NILFS project home was changed to nilfs.sourceforge.io
to enable https access.  This replaces ths URL strings
"http://nilfs.sourceforge.net" in man pages with
"https://nilfs.sourceforge.io".

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2017-11-11 01:30:09 +09:00
Andreas Rohner
2146d60454 nilfs-utils: Fix conflicting data buffer error
Under certain high concurrency loads, NILFS2 can produce a segment that
crashes the cleanerd process with a conflicting data buffer error. The
segment is perfectly valid and the file system is not corrupted.
However, the cleanerd process can no longer be started and the file
system will eventually fill up and cannot be used any more.

The reason for this crash is, that a single logical segment can contain
multiple partial segments. If a block is written in one partial segment
and then immediately overwritten in another partial segment, then these
blocks have the same inode number, checkpoint number and offset.
However, these three numbers are used by the kernel to uniquely
identify a block. If the cleaner tries to clean two blocks that point
to the exact same buffer_head in the kernel, it creates a conflicting
data buffer error.

The solution is to detect these blocks and treat them as dead blocks.
If vd_period.p_end is equal to the checkpoint number, it means that the
block was overwritten within the same logical segment. So it must be
dead, and there is another block with the same ino, cno, and offset,
which is alive.

Signed-off-by: Andreas Rohner <andreas.rohner@gmx.net>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2017-10-30 00:04:48 +09:00
Ryusuke Konishi
16c2847f14 sbin/.gitignore: do not ignore obsolete subdirectories
Obsolete sub directories "sbin/nilfs-clean/", "sbin/nilfs-resize/",
and "sbin/nilfs-tune/" are not deletable by "git clean -df".  This
fixes the issue.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2016-11-12 13:03:37 +09:00
Ryusuke Konishi
2c66e061ce mkfs.nilfs2: do not create .nilfs file
The ".nilfs" file is no longer used from utils nor the kernel module.
Remove .nilfs file from the initial directory entries.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2016-11-08 21:03:09 +09:00
Ryusuke Konishi
1387adf8aa nilfs-utils: move system programs to sbin source directory
Move source files of mkfs.nilfs2, nilfs_cleanerd, nilfs-clean,
nilfs-resize, and nilfs-tune to directly below the sbin source
directory.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2016-10-18 00:42:16 +09:00
Ryusuke Konishi
aec9065bdc nilfs_cleanerd.conf: migrate to etc source directory
Add etc source directory and move sbin/cleanerd/nilfs_cleanerd.conf
into the directory.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2016-10-17 00:28:21 +09:00
Ryusuke Konishi
78044f6c97 nilfs-utils: do not generate/install libnilfscleaner.so.*
Remove "libnilfscleaner.so" dynamic link library and instead build
private library "libcleaner.la" for clients of cleanerd such as
nilfs-clean command.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2016-10-16 00:56:29 +09:00
Ryusuke Konishi
0fd62181be vector.h: add names to arguments in function prototypes
Add parameter names in function prototypes whose paramater names are
missing.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2016-10-15 00:49:26 +09:00
Ryusuke Konishi
892bad14ba nilfs.h: add names to arguments in function prototypes
Add parameter names in function prototypes whose paramater names are
missing.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2016-10-14 06:02:26 +09:00
Ryusuke Konishi
191d289a77 segment.h: get rid of sector_t type
Replace sector_t type with uint64_t.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2016-10-13 00:32:47 +09:00
Ryusuke Konishi
a858abeeaa nilfs-utils: use {INT64,UINT64}_MAX instead of S64_MAX and U64_MAX
Use INT64_MAX in cleaner.c and remove S64_MAX and U64_MAX from
compat.h.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2016-10-12 00:54:44 +09:00
Ryusuke Konishi
7948e6bab5 nilfs-utils: replace __u32 etc. with standard uint32_t style types
Replace __u64, __u32, __u8, __s64, and __s32 with standard uint64_t,
uint32_t, uint8_t, int64_t and int32_t types, respectively, except for
nilfs2_api.h and nilfs2_ondisk.h.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2016-10-11 00:41:24 +09:00
Ryusuke Konishi
d850b3d3a6 mount/fstab.c: fix coding style of functions
Some functions are followed by a curly brace '{' in the same line:

  int
  mtab_does_not_exist(void) {
        ....
  }

This transforms them with the following standard style:

  int mtab_does_not_exist(void)
  {
        ....
  }

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2016-10-10 00:41:19 +09:00
Ryusuke Konishi
7558f95673 mount/fstab.c: get rid of function prototype of strsignal()
The "string.h" header file has this definition since _GNU_SOURCE is
defined.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2016-10-10 00:41:19 +09:00
Ryusuke Konishi
b6c2cc8870 nilfs-resize: remove unnecessary "else" from a conditional statement
Fix checkpatch error "ERROR: else should follow close brace '}'".

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2016-10-10 00:35:15 +09:00
Ryusuke Konishi
e9b7154541 nilfs_gc.h: include nilfs2_api.h explicitly
Refer to nilfs2_api.h since nilfs_suinfo_reclaimable() uses inline
functions nilfs_suinfo_{dirty,active,error}().

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2016-10-09 00:04:04 +09:00
Ryusuke Konishi
bac41d38ef nilfs.h: do not include unrelated header files
Sort out dependent header files: include "sys/types.h", and remove
references to "stdio.h", "stdlib.h", "unistd.h", "fcntl.h", "time.h",
and "sys/ioctl.h".

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2016-10-08 01:17:48 +09:00
Ryusuke Konishi
54f4b46e0e nilfs-tune: include fcntl.h and unistd.h directly
The implementation of nilfs-tune command needs to include "fcntl.h"
and "unistd.h" header files since nilfs-tune directly uses functions
and definitions declared there.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2016-10-07 01:19:02 +09:00
Ryusuke Konishi
070236a30b util.h: move definition of offsetof() macro to compat.h
Usually, "stddef.h" header file has the definition of offsetof()
macro.  Use it and refer to the alternative offsetof() definition in
compat.h only if the original macro is not available in "stddef.h".

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2016-10-07 01:19:02 +09:00
Ryusuke Konishi
83e400bdd8 nilfs_cleaner.h: include time.h explicitly
Refer to time.h since the timespec struct declared in "time.h" is used
in some api functions.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2016-10-06 00:34:28 +09:00
Ryusuke Konishi
1738df28ef nilfs_cleaner.h: do not include nilfs.h
Remove the reference to "nilfs.h" from "nilfs_cleaner.h" header file
since it doesn't depend on the NILFS api.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2016-10-06 00:05:43 +09:00
Ryusuke Konishi
4e6758b2cc libnilfs: make operations on nilfs options extensible
Re-define operations on nilfs options as inline functions using new
generic functions nilfs_opt_{test,set,clear}() in order to make them
more flexible for future extension.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2016-10-05 00:18:10 +09:00
Ryusuke Konishi
115a738aab libnilfs: hide the internal structure of nilfs object
Move the definition of nilfs structure into lib/nilfs.c.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2016-10-04 00:35:43 +09:00
Ryusuke Konishi
4511476747 libnilfs: hide internal semaphore operations from the interface
Add generic lock operations for nilfs to hide nilfs->n_sems[] array
from libnilfs interface, and use them to acquire, trylock, or release
the lock.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2016-10-03 01:23:16 +09:00
Ryusuke Konishi
bbdf214555 libsegment: check finfo position before reading finfo
Accesses to finfo in nilfs_file_next() and nilfs_file_init() can
overrun since the termination condition of the file iterator is tested
after these functions return and the position of finfo is checked
afterwards as well.

This fixes the issue by inserting pre-checks for the position of finfo
before reading it.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2016-10-02 20:32:00 +09:00
Ryusuke Konishi
f1a93b38e1 segment.c: keep size of summary information in nilfs_file struct
Add a member which keeps the size of segment summary information to
nilfs_file struct for convenience.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2016-10-02 20:32:00 +09:00
Ryusuke Konishi
8bdf8f47c6 libsegment: add sanity checks for per-file summary information
On-disk summary information of files can fall into inconsistent
states in theory:

 - The block count recorded in finfo can exceed the number of
   remaining payload blocks.
 - The number of data blocks recorded in finfo can be larger than the
   number of total blocks of the file, or
 - The total size of finfo and binfo structures can exceed the size of
   summary information of the partial segment.

This adds sanity checks for these glitches to nilfs_file, and adds a
framework to handle these errors as well.

Also, this enhances the error output routine of dumpseg command to
handle these errors nicely.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2016-09-30 00:13:14 +09:00
Ryusuke Konishi
98fca771e9 segment.c: add helper to calculate the number of summary blocks
Add a function to calculate the number of summary blocks and use it in
nilfs_file_init().

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2016-09-29 22:50:05 +09:00
Ryusuke Konishi
aff88a37b2 segment.c: add helper to calculate summary size for each file
Add a function to calculate the size of finfo and binfo structures
that a given file occupies within segment summary information, where
we make the helper separating the logic from nilfs_file_next().

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2016-09-28 21:01:56 +09:00
Ryusuke Konishi
f46c59053b lib/segment: hide macros to define binfo size from segment.h
The macros NILFS_BINFO_XXX_SIZE are used only by functions
in segment.c.  Move them into the library implementation.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2016-09-26 22:37:50 +09:00
Ryusuke Konishi
66754b6bb7 lib/segment: refactor file/block iterator
Rewrite nilfs_file/nilfs_block structs and their iterators to clarify
them.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2016-09-25 22:37:59 +09:00
Ryusuke Konishi
f827e854bc segment.h: use nilfs_binfo_{v,dat} structs to get binfo sizes
Define NILFS_BINFO_DATA_SIZE and NILFS_BINFO_DAT_NODE_SIZE with
nilfs_binfo_v and nilfs_binfo_dat structs, respectively.  These macros
gives the size of binfo data block in usual files and node blocks in
the DAT file.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2016-09-24 00:20:38 +09:00
Ryusuke Konishi
8a89320c7a libnilfs,libnilfsgc: bump up library version
Increment API version for libnilfs and libnilfsgc to reflect the
removal/addition/change of exported functions.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
2016-09-23 00:54:08 +09:00