Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
2fab25cd
Commit
2fab25cd
authored
6 years ago
by
Kent Overstreet
Committed by
Kent Overstreet
1 year ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: more project quota fixes
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
69d46f90
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
21 deletions
+27
-21
fs/bcachefs/fs-ioctl.c
fs/bcachefs/fs-ioctl.c
+6
-20
fs/bcachefs/fs.h
fs/bcachefs/fs.h
+13
-0
fs/bcachefs/quota.h
fs/bcachefs/quota.h
+1
-1
fs/bcachefs/xattr.c
fs/bcachefs/xattr.c
+7
-0
No files found.
fs/bcachefs/fs-ioctl.c
View file @
2fab25cd
...
...
@@ -104,19 +104,6 @@ static int bch2_ioc_fsgetxattr(struct bch_inode_info *inode,
return
copy_to_user
(
arg
,
&
fa
,
sizeof
(
fa
));
}
static
int
bch2_set_projid
(
struct
bch_fs
*
c
,
struct
bch_inode_info
*
inode
,
u32
projid
)
{
struct
bch_qid
qid
=
inode
->
ei_qid
;
qid
.
q
[
QTYP_PRJ
]
=
projid
;
return
bch2_fs_quota_transfer
(
c
,
inode
,
qid
,
1
<<
QTYP_PRJ
,
KEY_TYPE_QUOTA_PREALLOC
);
}
static
int
fssetxattr_inode_update_fn
(
struct
bch_inode_info
*
inode
,
struct
bch_inode_unpacked
*
bi
,
void
*
p
)
...
...
@@ -124,11 +111,7 @@ static int fssetxattr_inode_update_fn(struct bch_inode_info *inode,
struct
flags_set
*
s
=
p
;
if
(
s
->
projid
!=
bi
->
bi_project
)
{
if
(
s
->
projid
)
bi
->
bi_fields_set
|=
1U
<<
Inode_opt_project
;
else
bi
->
bi_fields_set
&=
~
(
1U
<<
Inode_opt_project
);
bi
->
bi_project
=
s
->
projid
;
}
...
...
@@ -151,7 +134,10 @@ static int bch2_ioc_fssetxattr(struct bch_fs *c,
if
(
fa
.
fsx_xflags
)
return
-
EOPNOTSUPP
;
s
.
projid
=
fa
.
fsx_projid
;
if
(
fa
.
fsx_projid
>=
U32_MAX
)
return
-
EINVAL
;
s
.
projid
=
fa
.
fsx_projid
+
1
;
ret
=
mnt_want_write_file
(
file
);
if
(
ret
)
...
...
@@ -164,7 +150,7 @@ static int bch2_ioc_fssetxattr(struct bch_fs *c,
}
mutex_lock
(
&
inode
->
ei_update_lock
);
ret
=
bch2_set_projid
(
c
,
inode
,
fa
.
fsx_
projid
);
ret
=
bch2_set_projid
(
c
,
inode
,
s
.
projid
);
if
(
ret
)
goto
err_unlock
;
...
...
This diff is collapsed.
Click to expand it.
fs/bcachefs/fs.h
View file @
2fab25cd
...
...
@@ -121,6 +121,19 @@ int bch2_fs_quota_transfer(struct bch_fs *,
unsigned
,
enum
quota_acct_mode
);
static
inline
int
bch2_set_projid
(
struct
bch_fs
*
c
,
struct
bch_inode_info
*
inode
,
u32
projid
)
{
struct
bch_qid
qid
=
inode
->
ei_qid
;
qid
.
q
[
QTYP_PRJ
]
=
projid
;
return
bch2_fs_quota_transfer
(
c
,
inode
,
qid
,
1
<<
QTYP_PRJ
,
KEY_TYPE_QUOTA_PREALLOC
);
}
struct
inode
*
bch2_vfs_inode_get
(
struct
bch_fs
*
,
u64
);
/* returns 0 if we want to do the update, or error is passed up */
...
...
This diff is collapsed.
Click to expand it.
fs/bcachefs/quota.h
View file @
2fab25cd
...
...
@@ -20,7 +20,7 @@ static inline struct bch_qid bch_qid(struct bch_inode_unpacked *u)
return
(
struct
bch_qid
)
{
.
q
[
QTYP_USR
]
=
u
->
bi_uid
,
.
q
[
QTYP_GRP
]
=
u
->
bi_gid
,
.
q
[
QTYP_PRJ
]
=
u
->
bi_project
,
.
q
[
QTYP_PRJ
]
=
u
->
bi_project
?
u
->
bi_project
-
1
:
0
,
};
}
...
...
This diff is collapsed.
Click to expand it.
fs/bcachefs/xattr.c
View file @
2fab25cd
...
...
@@ -515,7 +515,14 @@ static int bch2_xattr_bcachefs_set(const struct xattr_handler *handler,
}
mutex_lock
(
&
inode
->
ei_update_lock
);
if
(
inode_opt_id
==
Inode_opt_project
)
{
ret
=
bch2_set_projid
(
c
,
inode
,
s
.
v
);
if
(
ret
)
goto
err
;
}
ret
=
bch2_write_inode
(
c
,
inode
,
inode_opt_set_fn
,
&
s
,
0
);
err:
mutex_unlock
(
&
inode
->
ei_update_lock
);
if
(
value
&&
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment