]>
git.proxmox.com Git - ceph.git/blob - ceph/src/os/fs/XFS.cc
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2014 Red Hat
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
19 int XFS::set_alloc_hint(int fd
, uint64_t val
)
25 if (fstat(fd
, &sb
) < 0) {
29 if (!S_ISREG(sb
.st_mode
)) {
33 if (ioctl(fd
, XFS_IOC_FSGETXATTR
, &fsx
) < 0) {
39 if ((fsx
.fsx_xflags
& XFS_XFLAG_EXTSIZE
) && fsx
.fsx_extsize
== val
)
42 // xfs won't change extent size if any extents are allocated
43 if (fsx
.fsx_nextents
!= 0)
46 fsx
.fsx_xflags
|= XFS_XFLAG_EXTSIZE
;
47 fsx
.fsx_extsize
= val
;
49 if (ioctl(fd
, XFS_IOC_FSSETXATTR
, &fsx
) < 0) {